1

At the moment, when i'm developing AWS cloudformation and EC2 userdata scripts I make source code edits, destroy any existing stack and launch the new one. This is a slow process. Every time I have to wait for a stack to destroy itself and the new one to deploy. If my userdata script dosnt work I have to load up the log and debug the issue.

What development workflow do you use, is there a better way of doing this?

1 Answer 1

0

If you update your CloudFormation (CFN) stack, the UserData should be updated accordingly - and be available on the machine.

You can then retrieve the metadata with the following command:

cfn-get-metadata --stack $STACKNAME --resource $RESOURCE --region $REGION

where $STACKNAME is your stack, $RESOURCE is your Configuration. and $REGION is your region. An example would be:

cfn-get-metadata --stack WebserverStaging-EYMMJRF0BU01 --resource myLaunchConfiguration --region eu-west-1

If you like to try the new configuration, you can execute it with:

sudo cfn-init -v --stack $STACKNAME --resource $LAUNCHCONFIG --region $REGION

If you are on a ec2 instance, you can most often retrieve the command directly from /var/log/cloud-init-output.log

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.