所以我试图超越lambda环境,我使用了字符串插值,但是有一件事我无法理解,所以下面基本上是我的lambda,如果你看到函数名,它有一个环境的占位符。但是当我像这样部署的时候
aws cloudformation deploy --template-file build/output.yaml --stack-name test-stack --capabilities CAPABILITY_IAM --parameter-overrides Environment=de
v
占位符不更新以下代码
Parameters:
Environment:
Type: String
Resources:
HelloWorldFunction:
Type: AWS::Serverless::Function # More info about Function Resource: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#awsserverlessfunction
Properties:
CodeUri: src
Handler: index.lambda_handler
Runtime: python3.6
FunctionName: HelloLambda-${Environment}
MemorySize: 128
Timeout: 30
Policies:
- AWSLambdaBasicExecutionRole
但如果我也这样做的话
参数:
环境:
类型:字符串
资源:
HelloWorldFunction:
Type: AWS::Serverless::Function # More info about Function Resource: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#awsserverlessfunction
Properties:
CodeUri: src
Handler: index.lambda_handler
Runtime: python3.6
FunctionName: !Sub HelloLambda-${Environment}
MemorySize: 128
Timeout: 30
Policies:
- AWSLambdaBasicExecutionRole
上面的执行工作,有什么区别吗
FunctionName: !Sub HelloLambda-${Environment}
和
FunctionName: HelloLambda-${Environment}