所以我试图超越 lambda 环境,我使用了字符串插值,但有一个小东西我无法理解,所以基本上下面是我的 Lambda,如果你看到函数名称它有一个 Environment 的占位符。但是当我像这样部署它时
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}