0

Is there any way to tell which AMI my EC2 instance was created from?

3
  • 2
    I'm voting to close this question as off-topic because it can be simply answered by reading the AWS docs. – Bruce Becker Aug 2 '19 at 15:31
  • Hi @bruce-becker… welcome to StackExchange if you can answer my question by pointing me to the source of the documentation that would be much appreciated and I would surely reward you with reputation points. Thanks! – ClintM Aug 2 '19 at 15:42
  • hi @ClintM - Could you update your question to make it a bit more specific? The reason I voted to close this was because it's almost impossible to answer accurately because there are so many ways to solve the question. Maybe give some more context of what your environment looks like, what language you prefer, whether this is automated, via the console, etc etc. – Bruce Becker Aug 2 '19 at 16:40
2

Is there any way to tell which AMI my EC2 instance was created from?

Short answer: yes.

Longer answer: yes - how would you like to get it?

The AMI which the EC2 instance was launched with is part of the EC2 instance metadata

Every instance publishes its metadata, which you can retrieve via the HTTP interface:

curl http://<instance.ip.address>/latest/meta-data/ami-id

(lifted directly from the AWS docs)

Many people prefer the Python library for the AWS API (boto3). In this particular case you would need to use the instance.image_id method.

2
  • If OP updates the question, I could give a more specific answer to the question. – Bruce Becker Aug 2 '19 at 16:40
  • 1
    Thanks I also see it in the console (console.aws.amazon.com). Not sure why I didn't see it before. Thanks! – ClintM Aug 2 '19 at 16:51

Not the answer you're looking for? Browse other questions tagged or ask your own question.