Sal Cloud could not find aws AMI

232 Views Asked by At

I am using Salt Cloud (aws as a provider) and my profile file is:

ec2-profile:
  provider: ec2-config
  image: ami-7e2da54e
  size: Micro Instance

I run this for testing:

sudo salt-cloud --profile=ec2-private test_minion -l debug

I had this error:

[DEBUG   ] Using AWS endpoint: ec2.us-east-1.amazonaws.com
[DEBUG   ] AWS Request: https://ec2.us-east-1.amazonaws.com/?Action=RunInstances&ImageId=ami-7e2da54e&InstanceType=Micro%20Instance&KeyName=salt_cloud_key&MaxCount=1&MinCount=1&Version=2014-10-01
[INFO    ] Starting new HTTPS connection (1): ec2.us-east-1.amazonaws.com
[DEBUG   ] Setting read timeout to None
[DEBUG   ] "GET /?Action=RunInstances&ImageId=ami-7e2da54e&InstanceType=Micro%20Instance&KeyName=salt_cloud_key&MaxCount=1&MinCount=1&Version=2014-10-01 HTTP/1.1" 400 None
[DEBUG   ] AWS Response Status Code: 400
[ERROR   ] AWS Response Status Code and Error: [400 400 Client Error: Bad Request] {'Errors': {'Error': {'Message': "The image id '[ami-7e2da54e]' does not exist", 'Code': 'InvalidAMIID.NotFound'}}, 'RequestID': '6b8f2fb5-b24e-4438-8e45-c6b01dc08519'}
[ERROR   ] Error requesting instance: Errors
Error: There was a profile error: Failed to deploy VM

Do you have any ideas ?

Update:

I changed the image AMI id. Now I am having this debug message:

InvalidParameterValue

Which is (according to AWS documentation):

An invalid or out-of-range value was supplied for the input parameter.
1

There are 1 best solutions below

0
On

Use AWS CLI to check whether AMI is valid for your region

aws ec2 describe-images --image-ids ami-XXXXXXX

For salt-cloud profile.conf "size" parameter, the correct AWS naming for it is "Instance Type". You can either check AWS for correct naming. https://aws.amazon.com/ec2/instance-types/

Or you can use salt-cloud command to list the instance type using --list-sizes command

salt-cloud --list-sizes <provider_name>
salt-cloud --list-sizes test_minion

p/s: Do not take salt-cloud naming for granted, the developers seems alway choose confusing attribute name. It is a good idea to document the naming map to pass to next person is new to saltstack