简体   繁体   中英

Creating AWS EC2 instance image using saltstack?

Has anybody tried creating AWS AMI(image) using saltstack.

I tried using it was able to create new instance from existing AMIs but how to create image using salt-cloud?

Also attempted by using boto_ec2 but its give error that Module 'boto_ec2' is not available.

You can do that in 2 steps:

  1. you need to take a snapshot of your volume
  2. you can create an AMI from a given snapshots

You can see all saltstack ec2 commands at https://docs.saltstack.com/en/latest/ref/clouds/all/salt.cloud.clouds.ec2.html

  1. create the snapshots : create_snapshot

     salt-cloud -f create_snapshot my-ec2-config volume_id=vol-351d8826 salt-cloud -f create_snapshot my-ec2-config volume_id=vol-351d8826 \\ description="My Snapshot Description" 
  2. create the AMI : register_image

This command creates an ami from a snapshot

salt-cloud -f register_image my-ec2-config ami_name=my_ami \
description="my description" root_device_name=/dev/xvda snapshot_id=snap-xxxxxxxx

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM