Cloudformation cached template

0

Hello everyone,

I have a problem with bash script which creates S3 bucket, takes the template from my local directory and uploads it in S3 bucket, after this step it should create CloudFormation stack from the same template that is in S3 bucket.

I modified this file (template) and ran a script, the S3 bucket has a modified template but when I go to Stack it still has older version of template (although CloudFront was triggered).

What could be causing the issue?

Thanks in advance

asked 3 months ago126 views
1 Answer
0

CloudFormation does not "watch" S3 locations by default. Do you have some automation or Event Bridge Rule that is watching that S3 location? Have you checked the metrics for that rule to see whether it triggered or not?

profile pictureAWS
danjhd
answered 3 months ago
  • Hey danjhd, I do not have Event Bridge configured.

    I had a problem with lambda version and changed this, started the script with new version listed in template and run it for the first time in the new account.

    After some time I saw that the applied changes were there in S3 bucket (cfn-templates-bucket) but the template is the same as one from before in the cloudformation stack with old version of lambda and it was even deleted because the stack failed because old lambda python version.

    I have part in bash script which copies the template to the s3 mentioned before and created template url variable that was used as input for aws cloudformation create-stack.

  • It may be something to do with timing. Perhaps the S3 copy operation has not completely finished at the time you do the create-stack so it might be using the old file in S3. Using a different file name each time would help you identify this or the "true error". However, i would suggest taking a look at an Event Bridge rule that triggers from S3 object event and have that rule do the create-stack for you. Then you would remove that part from your bash script and just do the upload.

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions