AWS S3 Cloudormation更新堆栈失败

时间:2018-05-04 21:43:31

标签: amazon-web-services amazon-s3 amazon-cloudformation

我有一个S3的云形态模板,我试图创建一次,然后更新它。但是当我尝试更新它时失败并显示错误消息GetLastError()

OpenProcess()

第二次尝试更新<bucket_name> already exists in stack <arn:id>作为参数传递

    "S3Bucket": {
        "Type": "AWS::S3::Bucket",
        "DeletionPolicy": "Retain",
        "Properties": {
            "AccessControl": "BucketOwnerFullControl",
            "BucketName": {
                "Fn::Join": [
                    "-",
                    [
                        {
                            "Fn::GetAtt": [
                                "VPCInfo",
                                "VPCname"
                            ]
                        },
                        {
                            "Ref": "BucketName"
                        }
                    ]
                ]
            },
            "LoggingConfiguration": {
                "DestinationBucketName": {
                    "Fn::Join": [
                        "",
                        [
                            {
                                "Fn::GetAtt": [
                                    "VPCInfo",
                                    "VPCname"
                                ]
                            },
                            "-s3logs"
                        ]
                    ]
                },
                "LogFilePrefix": {
                    "Fn::Join": [
                        "-",
                        [
                            {
                                "Fn::GetAtt": [
                                    "VPCInfo",
                                    "VPCname"
                                ]
                            },
                            {
                                "Ref": "AWS::StackName"
                            }
                        ]
                    ]
                }
            },
            "VersioningConfiguration": {
                "Status": "Enabled"
            }
        }
    }

更新S3堆栈的正确方法是什么?我试图做两次的原因是由于这个原因 - &gt; https://aws.amazon.com/premiumsupport/knowledge-center/unable-validate-destination-s3/

1 个答案:

答案 0 :(得分:1)

我相信您正在删除CFT并重新创建它。您的问题是"DeletionPolicy": "Retain",即使您删除了CFT,它仍会保留S3存储桶。如果你更新现有的,你应该没事。

如果您删除CFT或将"DeletionPolicy": "Retain"更改为"DeletionPolicy": "Delete"

,只需手动删除存储桶