Cloudformation Accidentally change bucket name

1

Hi, I have a Cloudformation template, which creates a couple of resources, an IAM user, an access key, roles and an S3 bucket.

I re-used the same template to create another bucket and ran the command from the CLI. I, however, neglected to update the "--stack-name" parameter, and the update started taking place on the existing stack and not a new one.

The new stack has a new value for the bucket name, and went ahead and created a new bucket, then attempted to delete the old bucket, which contains data, so it could not be deleted. I can, however now not roll back to a state where it will use the existing bucket name, to enable me to manage the original stack anymore.

I have done a test run by creating a bucket and then importing that into a test stack. This works for the import, however once imported, it does not allow me to make any changes to the import bucket. A current setting on the bucket is

      ObjectLockEnabled: true
      VersioningConfiguration:
        Status: Enabled

If I have this option in the cloudformation template, it requires replacement. Yet the setting is currently in place already, I just need the template to match what is in place.

Any advice?

Bobk
질문됨 일 년 전380회 조회
2개 답변
0

I've been in situations like this where the actual state and the state CloudFormation thinks it is in are out of sync. You can either revert the change and have CloudFormation attempt to change it, but if that causes a replacement it isn't ideal. Or I've contacted AWS support and they have been able to correct the state on the CloudFormation backend.

Very similar to this discussion: https://stackoverflow.com/questions/54386020/how-to-fix-a-drifted-aws-cloudformation-stack

답변함 일 년 전
0

Thank you for the reply. The account, unfortunately, only has basic support, so I am not sure if they will assist. I will test the import option more and see what happens if I don't add the Object lock from my side. If it will keep the template In a way where I can at least make future changes while it ignores the ones it didn't want to import.

Bobk
답변함 일 년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠