How can I export and import EC2 Launch Templates?

0

How can I export and import EC2 Launch Templates, including version history and launch scripts (advanced)? Exporting to another EC2 account/region is not sufficient, I need a way to get them off AWS and stored locally.

Thanks!

2 Antworten
1
Akzeptierte Antwort

Hi Sensible Saas,

There is no out of the box way to export a launch template.

What you could do is to exploit the describe template (https://docs.aws.amazon.com/cli/latest/reference/ec2/describe-launch-templates.html) and describe versions (https://docs.aws.amazon.com/cli/latest/reference/ec2/describe-launch-template-versions.html) api/sdk and use a lambda function to extract to a specific JSON structure that fits your use case.

Similarly you can then refer engineer your logic and use the create launch template and create launch template versions to recreate the resources.

Hope it inspires you

profile picture
EXPERTE
beantwortet vor einem Jahr
profile picture
EXPERTE
überprüft vor einem Monat
  • Thanks, was hoping for a trivial way but sounds like it would be easier to just rebuild with Terraform/Ansible

1

A better way than exporting ones made in the console is leveraging CloudFormation to create the LaunchTemplates, this way you can always have a JSON/YAML format of the Launch Template that you can go back and look at.

https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-launchtemplate.html

profile pictureAWS
EXPERTE
Rob_H
beantwortet vor einem Jahr
  • Why would anyone use CloudFormation over Terraform?

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen