<blockquote>
  <p>Is there any way to tell which AMI my EC2 instance was created from?</p>
</blockquote>

<h2>Short answer: yes.</h2>

<h2>Longer answer: yes - how would you like to get it?</h2>

<p>The AMI which the EC2 instance was launched with is part of the <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-metadata.html" rel="nofollow noreferrer">EC2 instance metadata</a></p>

<p>Every instance publishes its metadata, which you can retrieve via the HTTP interface:</p>

<pre><code>curl http://&lt;instance.ip.address&gt;/latest/meta-data/ami-id
</code></pre>

<p>(lifted directly from the AWS docs)</p>

<p>Many people prefer the Python library for the AWS API (<a href="https://boto3.amazonaws.com/v1/documentation/" rel="nofollow noreferrer">boto3</a>). In this particular case you would need to use the <code>instance.image_id</code> method.</p>

CC BY-SA 4.0
2019-08-02T16:40:58.530Z
If OP updates the question, I could give a more specific answer to the question.
Bruce Becker
CC BY-SA 4.0
2019-08-02T16:51:33.703Z
Thanks I also see it in the console (console.aws.amazon.com).  Not sure why I didn't see it before.  Thanks!
ClintM
CC BY-SA 4.0
2019-08-02T16:39:00.780Z
2019-08-02T16:46:24.217Z
2019-08-02T16:46:24.217Z
Bruce Becker
<p>Is there any way to tell which AMI my EC2 instance was created from?</p>

CC BY-SA 4.0
2019-08-02T15:31:35.163Z
I'm voting to close this question as off-topic because it can be simply answered by reading the AWS docs.
Bruce Becker
CC BY-SA 4.0
2019-08-02T15:42:45.580Z
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
CC BY-SA 4.0
2019-08-02T16:40:34.450Z
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
<amazon-web-services><amazon-ec2><amazon-ami>
Which AMI was my EC2 instance created from?
ClintM
# Which AMI was my EC2 instance created from?

(Asked by: username_0 on 2019-08-02)

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

**Tags:** amazon-web-services, amazon-ec2, amazon-ami

> **Comments:**
> **username_1**: I'm voting to close this question as off-topic because it can be simply answered by reading the AWS docs.  
> **username_0**: 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!  
> **username_1**: hi @username_0 - 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.  

---

## 1 answers

### Answer by username_1 on 2019-08-02. Score: 2 | Accepted answer

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:///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.

> **Comments:**
> **username_1**: If OP updates the question, I could give a more specific answer to the question.  
> **username_0**: Thanks I also see it in the console (console.aws.amazon.com).  Not sure why I didn't see it before.  Thanks!  

---

