2 Respostas
- Mais recentes
- Mais votos
- Mais comentários
2
Hi,
You'll find lots of examples for CFN templates with Lambda aliases in this page: https://shisho.dev/dojo/providers/aws/Lambda/aws-lambda-alias/
For example, it points to https://github.com/mcnamarabrian/native-cf-lambda-aliasing/blob/b9b12dcbc4355cc6ed5aa2f2ea46896a769eb83b/template-v0.yml#L47
AWSTemplateFormatVersion: 2010-09-09
Description: Sample CF template that illustrates using Alias + Versions
Resources:
HelloFunction:
Type: AWS::Lambda::Function
Properties:
Handler: index.handler
Code:
ZipFile: |
def handler(event, context):
print('Hello world')
return('Hello world')
Runtime: python3.6
Role: !GetAtt HelloFunctionRole.Arn
HelloFunctionRole:
Type: AWS::IAM::Role
Properties:
AssumeRolePolicyDocument:
Version: 2012-10-17
Statement:
- Effect: Allow
Principal:
Service:
- lambda.amazonaws.com
Action:
- sts:AssumeRole
Path: /
Policies:
- PolicyName: root
PolicyDocument:
Version: 2012-10-17
Statement:
- Effect: Allow
Action:
- 'logs:*'
Resource: 'arn:aws:logs:*:*:*'
HelloVersion1:
Type: AWS::Lambda::Version
Properties:
FunctionName: !Ref HelloFunction
Description: Version 1
HelloAlias:
Type: AWS::Lambda::Alias
Properties:
FunctionName: !Ref HelloFunction
FunctionVersion: !GetAtt HelloVersion1.Version
Name: PROD
Best,
Didier
1
I would think it differently. You could have each environment in a separated aws account (dev, test, prod) so that you can handle the environment in isolation and more securely.
Conteúdo relevante
feita há um ano

Please can you guide me more and elaborate please Thank You.