Unchanged Cloudformation template results in creation of new ec2 resource

0

How can I determine what caused a nested Cloudformation stack to be updated when I made no changes to the template?

To be clear: I have a script that uploads my templates to s3, and I always upload them all even if I didn't change them, so in S3 I think the modified date is still changed. But I'm pretty sure this shouldn't trigger an update to the stack? In this case, I had changed a different template and was running an update for that.

Part of the reason I'm learning Cloudformation is to build my infra with some predictability - if I have some components relying on specific ec2 instance IDs, unpredictable replacements will be a hassle to manage because I'll have to go around updating IDs in configurations (for example variables for my Github Actions CD pipeline across multiple repos.)

In this case the unwanted update was for a template that creates these resources:

  • AWS::IAM::Role
  • AWS::IAM::InstanceProfile
  • AWS::EC2::Instance.

What I did change was an AWS::IAM::RolePolicy in a different template for the same parent stack, adding the following actions:

  • For my VPC resource: ec2:CreateVpcEndpoint, ec2:DeleteVpcEndpoints
  • For an S3 bucket: s3:PutObject

Are there internal updates in AWS that might trigger updates, like a new version of an AMI or something?

已提问 2 个月前408 查看次数
1 回答
1

Uploading a new template file to S3, even without any modifications, updates the file's metadata such as the last modified date. CloudFormation may interpret this as a change and proceed to update the stack.

profile picture
专家
已回答 1 个月前
  • Even if the "changed file" resulted in no changes to the resource itself?

  • What's strange is that there are three other sub-stacks that don't get updated, despite also having files uploaded to S3.

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则

相关内容