Amazon ec2 使用ansible调整ec2类型的大小
我想从ansible调整ec2类型的大小 这是我的代码:Amazon ec2 使用ansible调整ec2类型的大小,amazon-ec2,ansible,Amazon Ec2,Ansible,我想从ansible调整ec2类型的大小 这是我的代码: - name: resize the instance ec2: aws_access_key: "{{ aws_access_key_var }}" aws_secret_key: "{{ aws_secret_key_var }}" region: "{{ region }}" instance_ids: - "{{ instance_id }}" instance_type:
- name: resize the instance
ec2:
aws_access_key: "{{ aws_access_key_var }}"
aws_secret_key: "{{ aws_secret_key_var }}"
region: "{{ region }}"
instance_ids:
- "{{ instance_id }}"
instance_type: "{\"Value\": \"t2.small\"}"
wait: True
register: ec2_result_file
但我得到了这个错误:
fatal: [localhost]: FAILED! => {"changed": false, "msg": "image parameter is required for new instance"}
我尝试使用命令行,一切都很好
aws ec2 modify-instance-attribute --region reg --instance-id i-xx --instance-type "{\"Value\": \"t2.small\"}
关于如何达成解决方案:
instance\u id
实例id列表,当前用于状态:缺席
,运行
,停止
状态
——您没有指定,因此它是默认状态
状态
参数的默认值是什么:它是存在
present
未在instance\u id
说明中列出,因此instance\u id
被完全忽略
解决方案:
将
state:running
添加到ec2
模块参数中。很抱歉,这是一个输入错误。再次感谢:)我尝试运行,已停止,但没有任何更改,只是启动机器或停止机器谢谢:):p