Search code examples
amazon-web-servicesaws-cloudformationaws-cli

AWS Cloudformation - reverse engineer an existing resource


Initially a while back created a cloudformation template to create multiple services on a given cluster, setup a aurora rds, redis and a load balancer.

The template was broken so i had to do various manual changes to get it working:

  • redis was created on the default vpc so had to manually do vpc - vpc peering
  • added https port forwarding on my alb
  • cors and various arn inline roles for the s3 bucket
  • and potentially dozen or so other changes

In the process of rewriting the cloudformation stack so my question is:

  1. Is there a way using the aws cli to reverse engineer my current alb, rds, s3 to get a cloud formation formation template for each them?.
  • so then i would be able to compare the cloud formation template with the new own and adjust it.
  1. Or is there a way to compare the current cloudformation stack with the current state of the resources and reverse engineer it that way.

Solution

  • Seems as former2 would be the best solution to your use-case:

    Generate CloudFormation / Terraform / Troposphere templates from your existing AWS resources