How to troubleshoot AWS CloudFormation
2 min readJul 13, 2019
- Please look for the error code that you are receiving and consult the guide in here https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/troubleshooting.html
- If you used a Classic Load Balacer also check out this 1) https://aws.amazon.com/premiumsupport/knowledge-center/load-balancer-http-502-errors/ 2) https://docs.aws.amazon.com/elasticloadbalancing/latest/classic/elb-troubleshooting.html
- If you used an Application Load Balacer also check out this https://docs.aws.amazon.com/elasticloadbalancing/latest/application/load-balancer-troubleshooting.html
- Monitor your application load balancer https://docs.aws.amazon.com/elasticloadbalancing/latest/application/load-balancer-monitoring.html
EC2 instances
- I am having problems with the load balancer or with the EC2 instance. I don’t know how to verify that the commands in the UserData executed correctly and if the problems are in the EC2 instances.
There are 2 ways to troubleshoot the servers and the UserData:
- Test the UserData first by creating a EC2 instances with the same specifications in the LaunchConfiguration. Launch the instance in the EC2 dashboard, NOT in CloudFormation.
- Configure your UserData in your CloudFormation script so that you can see the logs of the invocation of the UserData in the System Log.
To troubleshoot issues on your EC2 instance bootstrap without having to access the instance through SSH, you can add code to your user-data bash script that redirects all the output both to the /var/log/user-data.log and to /dev/console. When the code is executed, you can see your user-data invocation logs in your console.
Please look at these tutorials: