Error creating instance ( ec2 ) by CLI ...

0

Error creating instance ( ec2 ) by CLI ...

I'm using a .sh file with command lines ( CLI ) to connect and create an ec2 instance with the operating system ( Debian 11 ). The problem is in the ( OS friend... ), the following error is displayed ( considering that I discovered the debian 11 friend when I launched a manual instance ):

An error occurred (InvalidAMIID.NotFound) when calling the RunInstances operation: The image id '[ami-01e5ff16fd6e8c542]' does not exist.

Code :

aws ec2 run-instances --image-id ami-01e5ff16fd6e8c542 --count 1 --instance-type t2.micro --key-name MyKeyPair --security-group-ids sg-xxxxxxxxx --subnet-id subnet-xxxxxx

How can I give a solution ?

Johnny
asked a year ago228 views
1 Answer
0
Accepted Answer

Try adding the region --region us-east-1

aws ec2 run-instances --image-id ami-01e5ff16fd6e8c542 --count 1 --instance-type t2.micro --key-name MyKeyPair --security-group-ids sg-xxxxxxxxx --subnet-id subnet-xxxxxx --region us-east-1
profile picture
answered a year ago
profile picture
EXPERT
reviewed a year ago
profile picture
EXPERT
reviewed a year ago
  • Thank you very much.

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions