Based on our experience, we found 2 possible ways to transfer the existing manually deployed (from the web console user interface) AWS infrastructure to Cloudformation (CF).
- Using
aws cli run $aws service_name_here describe for each element making up your stack, for example, for the RDS database stack :- RDS Instance β
Type: AWS::RDS::DBInstance , - RDS (EC2) SG β
Type: AWS::EC2::SecurityGroup , - Group
Type: AWS::RDS::DBSubnetGroup RDS β Type: AWS::RDS::DBSubnetGroup and - RDS DB Parameter Group β
Type: AWS::RDS::DBParameterGroup
And manually translate to CF based on the output received from aws cli for each of the components. This approach usually requires more experience in both AWS and CF, but the templates you create can be structured and developed in accordance with best practice, fully parameterized ( Sub, Ref, Join, Fn::GetAtt:, Fn::ImportValue ), modular. When conditions applied and at the 1st iteration, the result is likely to be close to the final state of the templates (interesting reference examples: https://github.com/widdix/aws-cf-templates/ ).
- Using AWS CloudFormer :
Extra points! :)
Using Terraforming ( https://github.com/dtan4/terraforming ). Given the new version of Terraform 0.12.0-beta2 (already supported in the stable release of terraform-provider-aws 2.7.0 ), with new features and a more friendly syntax, while not terraform-provider-aws 2.7.0 , this is a tool with open source and cloud Regardless of the provider, I would not miss the opportunity to generate Terraform code based on the existing AWS infrastructure, if possible, in the form of modules and submodules having as a link β https://registry.terraform.io/ as alternatives to AWS. CF.
Some other new alternatives for exporting your current deployed AWS infrastructure to Cloudformation / Terraform code:
source share