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?

1
  • 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? Aug 7, 2019 at 5:55

1 Answer 1

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.

1
  • 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 Aug 9, 2019 at 1:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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