amazon-ec2 - 如何在运行时更改实例类型

标签 amazon-ec2 ansible

如何在运行时更改实例类型

我正在运行 t2.small 实例,我弯下腰并使用 t2.medium 实例运行它,但运行 t2.small 的实例

ec2:
 key_name: "{{key_name}}"
 region: "{{aws_region}}"
 state: running
 instance_type: t2.medium
 instance_ids: "{{ item.id }}"
 aws_access_key: "{{aws_access_key_id}}"
 aws_secret_key: "{{aws_secret_access_key}}"

似乎 ansible 忽略了 instance_type

最佳答案

您不能只使用新的大小运行您的实例,您应该先修改您的实例大小,然后停止它,然后再运行它。

修改您的实例大小 > [ reference ]

ec2-modify-instance-attribute <instance id> --instance-type <new type>

您还应该注意 this , 具体>

You can resize an instance only if its current instance type and the new instance type that you want are compatible in the following ways:

  • Virtualization type. Linux AMIs use one of two types of virtualization: paravirtual (PV) or hardware virtual machine (HVM). You can't resize an instance that was launched from a PV AMI to an instance type that is HVM only. For more information, see Linux AMI Virtualization Types.
  • Network. Some instance types are not supported in EC2-Classic and must be launched in a VPC. Therefore, you can't resize an instance in EC2-Classic to a instance type that is available only in a VPC unless you have a nondefault VPC. For more information, see Instance Types Available Only in a VPC.
  • Platform. All Amazon EC2 instance types support 64-bit AMIs, but only the following instance types support 32-bit AMIs: t2.nano, t2.micro, t2.small, t2.medium, c3.large, t1.micro, m1.small, m1.medium, and c1.medium. If you are resizing a 32-bit instance, you are limited to these instance types.

关于amazon-ec2 - 如何在运行时更改实例类型,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35823953/

相关文章:

amazon-web-services - 使用 AWS CloudFormation 更新 SNS 订阅的替代方案

amazon-web-services - 选择合适的 AWS 服务和软件工具

amazon-web-services - 当我们不提及节点名称时,Chef 如何获取 aws ec2 的实例 ID

amazon-web-services - 使用 AWS CLI 从 S3 获取上次修改的对象

linux - 使用 Ansible 永久设置环境变量

postgresql - 2个Docker容器(JBOSS/DATABASE)之间的网络连接

ansible - ansible playbook中when条件中的多个值

ssh - Spark EC2 SSH 连接错误 SSH 返回码 255

amazon-web-services - AWS 参数组合无效

ansible - Ansible处理程序-独占重启或重新加载