【以下的问题经过翻译处理】 我有一个现有的S3存储桶,我想将其导入到一个新的CloudFormation堆栈中。ExistingDestinationBucket
已经存在。
我找到的AWS文档详细说明了从现有资源创建一个全新的堆栈,或者将现有资源添加到现有堆栈中,但这两种方法都不能满足我的需求。我需要将S3存储桶包含在堆栈中,以便我可以为Lambda函数定义触发器。以下是我的CloudFormation模板。
在以导入形式运行时,AWS要求我标识现有的Lambda函数 - 但这个函数不存在。当作为全新资源运行时,我收到一个错误,指出该存储桶已经存在。
是否有办法实现我所需的操作?
AWSTemplateFormatVersion: "2010-09-09"
Description: "Lighthouse run infrastructure"
Resources:
ExistingDestinationBucket:
Type: "AWS::S3::Bucket"
DeletionPolicy: "Retain"
Properties:
BucketName: !Sub "rapidspike-pages-lambda-${AWS::Region}"
NotificationConfiguration:
LambdaConfigurations:
Event: "s3:ObjectCreated:*"
Filter: "*/summary.json"
Function: !Ref PostProcessingFunc
PostProcessingFunc:
Type: "AWS::Lambda::Function"
Properties:
Description: ""
FunctionName: "lighthouse-run-post-processing"
Handler: "src/handlers/handler.handler"
Code:
S3Bucket: !Sub "lighthouse-run-functions-ap-south-1"
S3Key: "postprocess.zip"
MemorySize: 512
Runtime: "nodejs16.x"
Timeout: 60
TracingConfig:
Mode: "PassThrough"
EphemeralStorage:
Size: 512