AWS export configuration as a cloud configuration template

I use AWS CLI and cloud information, and I did not find the link in the documentation.

Does anyone know if it is possible to create a cloud information template from the current configuration.

Suppose I want to get cloud information templates from my current security group configuration.

Any idea, is it possible to export this configuration as a template using the command line?

Sincerely.

+9
source share
3 answers

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).

  1. 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/ ).

  1. Using AWS CloudFormer :

Extra points! :)

  1. 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.

  2. Some other new alternatives for exporting your current deployed AWS infrastructure to Cloudformation / Terraform code:

+3
source

You cannot use the AWS CLI, but you can use the CloudFormer [1] tool to create a CloudFormation template from existing resources. I had a good success. Templates are not as "beautiful" as manually created templates, but they provide a good starting point.

[1] http://aws.amazon.com/developertools/6460180344805680

+12
source

In addition to CloudFormer, you can take a look at Bellerophon: https://github.com/arminhammer/bellerophon .

+6
source

All Articles