1

How can I create an AWS Launch template from existing AWS EC2 instance of another AWS account?
Something like if the account user can share his configuration file containing details such as AMI, Instance type, Instance details, Storage details, Tags, Security details, etc. of his instance settings and I can just import the file while Launching my new instance and it will create and exact same environment.

1

Using aws cli, from the first account get the launch template data, and save it to a json file:

aws ec2 get-launch-template-data \
  --instance-id i-0123d646e8048babc \
  --query 'LaunchTemplateData' \
> account1-launch-data.json

And then in the second account, create the template from the json file:

aws ec2 create-launch-template \
  --launch-template-name Account2Template \
  --version-description Account1Copy \
  --launch-template-data file://account1-launch-data.json

You can then use this template to launch the ec2 instance using its launch template id:

aws ec2 run-instances \
  --launch-template LaunchTemplateId=<template id>,Version=1
|improve this answer|||||

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.