【问题标题】:Creating AWS EC2 instance image using saltstack?使用 saltstack 创建 AWS EC2 实例映像?
【发布时间】:2016-09-09 15:40:45
【问题描述】:

有没有人尝试使用 saltstack 创建 AWS AMI(image)。

我尝试使用它能够从现有 AMI 创建新实例,但如何使用 salt-cloud 创建映像?

也尝试使用 boto_ec2,但它给出了模块“boto_ec2”不可用的错误。

【问题讨论】:

标签: amazon-web-services amazon-ec2 salt-stack devops salt-cloud


【解决方案1】:

您可以分两步完成:

  1. 您需要拍摄卷的快照
  2. 您可以从给定的快照创建 AMI

你可以在https://docs.saltstack.com/en/latest/ref/clouds/all/salt.cloud.clouds.ec2.html查看所有 saltstack ec2 命令

  1. 创建快照: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. 创建 AMI:register_image

此命令从快照创建一个 ami

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

【讨论】:

  • 但我想在给定实例 ID 或 ID 列表的情况下创建另一个克隆。因为必须为 50 台服务器执行此操作。因为这个过程对自动化没有帮助。
  • 然后你应该做的是使用CloudClient并编写一个python脚本来自动在你想要图像的所有服务器上运行它。
猜你喜欢
  • 2014-08-06
  • 1970-01-01
  • 2014-05-29
  • 2015-05-16
  • 2016-12-07
  • 1970-01-01
  • 1970-01-01
  • 2015-07-02
  • 1970-01-01
相关资源
最近更新 更多