英文:
How to add a AWS public extension to a AWS Lambda cloud formation template?
问题
I want to add the 'AWS-Parameters-and-Secrets-Lambda-Extension' public extension to the cloud formation template of my AWS Lambda function. Everything I found so far adds the public extension either by i) the AWS lambda console or ii) the AWS cli. The cloud formation doc itself states that the AWS::Lambda::LayerVersion only allows to create lambda layers from a zip archive. I've also tried to export the cloud formation template of a function where I've added the extension using the AWS Lambda console, but that doesn't seem to do the trick. How do I add this extension to cloud formation?
英文:
I want to add the 'AWS-Parameters-and-Secrets-Lambda-Extension' public extension to the cloud formation template of my AWS Lambda function.
Everything I found so far adds the public extension either by i) the AWS lambda console or ii) the AWS cli. The cloud formation doc itself states that the AWS::Lambda::LayerVersion only allows to create lambda layers from a zip archive. I've also tried to export the cloud formation template of a function where I've added the extension using the AWS Lambda console, but that doesn't seem to do the trick.
How do I add this extension to cloud formation?
答案1
得分: 2
这一层是 AWS::Lambda::Function 的一部分,查看文档这里。
然后,层的 ARN 取决于您要部署 Lambda 的区域。这里是基于区域的列表。
对于 eu-west-1
,可以类似这样:
Resources:
Function:
Type: AWS::Lambda::Function
Properties:
Handler: index.handler
Role: arn:aws:iam::123456789012:role/lambda-role
Layers:
- arn:aws:lambda:eu-west-1:015030872274:layer:AWS-Parameters-and-Secrets-Lambda-Extension:4
Code:
S3Bucket: my-bucket
S3Key: function.zip
Runtime: nodejs12.x
Timeout: 5
TracingConfig:
Mode: Active
英文:
The layer is part of AWS::Lambda::Function, see the doc here.
Then the layer ARN depending on the region you want to deploy your lambda. Here is the list based on the region.
Something like this for eu-west-1
:
Resources:
Function:
Type: AWS::Lambda::Function
Properties:
Handler: index.handler
Role: arn:aws:iam::123456789012:role/lambda-role
Layers:
- arn:aws:lambda:eu-west-1:015030872274:layer:AWS-Parameters-and-Secrets-Lambda-Extension:4
Code:
S3Bucket: my-bucket
S3Key: function.zip
Runtime: nodejs12.x
Timeout: 5
TracingConfig:
Mode: Active
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论