Amazon s3 无法将notificationconfiguration添加到s3存储桶
创建云形成模板以创建带有通知的bucket 代码如下:Amazon s3 无法将notificationconfiguration添加到s3存储桶,amazon-s3,amazon-cloudformation,sam,Amazon S3,Amazon Cloudformation,Sam,创建云形成模板以创建带有通知的bucket 代码如下: AWSTemplateFormatVersion: '2010-09-09' Parameters: CBRS3ToS3IADelay: Description: Number of days before an S3 object is transitioned from S3 to S3-IA Type: Number Default: 365 CBRS3ToGlacierDelay: Desc
AWSTemplateFormatVersion: '2010-09-09'
Parameters:
CBRS3ToS3IADelay:
Description: Number of days before an S3 object is transitioned from S3 to S3-IA
Type: Number
Default: 365
CBRS3ToGlacierDelay:
Description: Number of days before an S3-IA object is transitioned from S3-IA to Glacier.
Type: Number
Default: 1460
CBRBucketName:
Description: S3 bucket name
Type: String
Default: "my-bucket-test0011"
Resources:
CBRS3Bucket:
Type: AWS::S3::Bucket
Properties:
BucketName:
Ref: CBRBucketName
AccessControl: Private
LifecycleConfiguration:
Rules:
- Id: CbrCertReportGlacierArchiveRule
Status: Enabled
Transitions:
- StorageClass: STANDARD_IA
TransitionInDays: !Ref CBRS3ToS3IADelay
- StorageClass: GLACIER
TransitionInDays: !Ref CBRS3ToGlacierDelay
NotificationConfiguration:
LambdaConfigurations:
-
Function: "arn:aws:lambda:xxxx:xxxx:function:xxxx"
Event: "s3:ObjectCreated:Put"
Filter:
S3Key:
Rules:
-
Name: suffix
Value: ".gz"
Tags:
- Key: PRODUCT
Value: CRAWS
VersioningConfiguration:
Status: Enabled
使用通知块的代码。
但上面的模板不适用于通知
获取以下错误:
Unable to validate the following destination configurations (Service: Amazon S3; Status Code: 400; Error Code: InvalidArgument
我可以在控制台上做
有人帮我解决这个问题吗 试着使用.gz并只输入gz。这太晚了,所以我回答这个问题的更多内容只是设法解决了同样的问题:由于对s3进行了初步检查,无法调用lambda函数,我们需要:
CBRS3BucketCanInvokeFunctionX:
Type: 'AWS::Lambda::Permission'
Properties:
FunctionName: ARN_OF_FUNCTION_X
Action: 'lambda:InvokeFunction'
Principal: s3.amazonaws.com
SourceAccount: !Ref 'AWS::AccountId'
SourceArn: !Sub 'arn:aws:s3:::${CBRBucketName}'
您的CBRS3Bucket还需要首先让上述资源运行:
CBRS3Bucket:
Type: AWS::S3::Bucket
DependsOn: CBRS3BucketCanInvokeFunctionX
这是完整的CFN模板吗?看看这个,它可能与: