0

Typically I spin up all aws ec2 instances together with all its accompanying security groups, volumes, etc ... by executing a series of aws cli commands.

However when I manually use the aws console in a browser to spin up instances, I am wondering if there is a tool I can run to exhaustively probe this set of running ec2 instances and output runable aws commands to recreate the currently running instances?

Does such a tool exist ?

I have never looked at Terraform, so I wonder if that has such a utility?

  • Although it won't produce AWS CLI commands, you can get what you want with Terraform. If that's acceptable to you, perhaps you could reword the question and this could be provided as an answer? – Bruce Becker Aug 7 '19 at 5:55
1

Terraform would be the best resource to create these EC2 instances repeatedly.

I would highly recommend you to create a variables.tf or terraform.tfvars file template allowing you to create a new instance of these resources and store that file and the state file securely away for future management of the resources. A versioned S3 bucket would do quite well for this.

Please note that once you create your Terraform code you can instruct Terraform which state file(s) to work with, etc. Allowing you to reuse the same code over and over without duplication.

| improve this answer | |
  • if have never used terraform ... is it worth learning its own config syntax ? ... in the past I just used template text files then resolved env vars and used bash and sed to search N replace then it spit out all the various aws cli commands to spin up or teardown the cluster + instances + sg etc ... not sure picking up terraform would help at this point – Scott Stensland Aug 9 '19 at 1:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.