<p>Updated the <a href="https://github.com/burukuru/jenkins-update-ec2-ami" rel="nofollow noreferrer">python script</a> from the PR above with:</p>

<ul>
<li>CSRF support to work better with Jenkins 2.x</li>
<li>full support for private Jenkins jobs</li>
</ul>

<p>Also I wrote up some usage instructions.</p>

CC BY-SA 3.0
2017-10-25T11:22:28.287Z
2017-10-25T11:22:28.287Z
Thanh
<p>For me, the best place to start is to have at the end of your packer.json a call to the <a href="https://www.packer.io/docs/post-processors/manifest.html" rel="nofollow noreferrer">manifest</a> post-processor.</p>

<p>This will contain the full details of the AMI that you have created in JSON format.</p>

<p>eg  "artifact_id": "us-west-1:ami-XXXXXXXX",   </p>

<p>This can then be read and acted on by any tooling of your choice.</p>

<p>Source: <a href="https://www.packer.io/docs/post-processors/manifest.html" rel="nofollow noreferrer">https://www.packer.io/docs/post-processors/manifest.html</a></p>

CC BY-SA 4.0
2019-08-01T09:22:09.043Z
2019-08-01T09:22:09.043Z
Marcus Adams
<p>The PR you are linking to contains a link to a <a href="https://gist.github.com/marvinpinto/a6c9b5119d418a65d489" rel="noreferrer">python script</a> that does exactly this, since you can run that script from anywhere you can access your Jenkins server.</p>

CC BY-SA 3.0
2017-03-15T17:17:03.387Z
2017-03-15T17:17:03.387Z
Michael Pereira
<p>I have been looking for a way to update AMI id in Jenkins EC2 plugin configuration after a packer build is run. After some digging, I found a promising way to do it <strong>IF</strong> the packer run is done by Jenkins itself, via <a href="https://github.com/jenkinsci/ec2-plugin/pull/154" rel="noreferrer">postbuild groovy plugin</a> (mind you, this remains to be tested, but looks good)</p>

<p>However I would like to be able to run the packer build anywhere, and have the resulting AMI id updated at Jenkins remotely, presumably via authenticated REST? Is that possible? Where would I start looking?</p>

CC BY-SA 3.0
2017-03-14T22:30:06.600Z
Not using it but I'd tackle the problem with a periodic job on Jenkins itself getting the ami id from aws ec2 describe-images
Tensibai
<jenkins><packer>
How to remotely update AMI id in Jenkins EC2 plugin?
Michael Bravo
# How to remotely update AMI id in Jenkins EC2 plugin?

(Asked by: username_0 on 2017-03-14)

I have been looking for a way to update AMI id in Jenkins EC2 plugin configuration after a packer build is run. After some digging, I found a promising way to do it **IF** the packer run is done by Jenkins itself, via [postbuild groovy plugin](https://github.com/jenkinsci/ec2-plugin/pull/154) (mind you, this remains to be tested, but looks good)

However I would like to be able to run the packer build anywhere, and have the resulting AMI id updated at Jenkins remotely, presumably via authenticated REST? Is that possible? Where would I start looking?

**Tags:** jenkins, packer

> **Comments:**
> **username_1**: Not using it but I'd tackle the problem with a periodic job on Jenkins itself getting the ami id from aws ec2 describe-images  

---

## 3 answers

### Answer by username_4 on 2017-03-15. Score: 6 | Accepted answer

The PR you are linking to contains a link to a [python script](https://gist.github.com/marvinpinto/a6c9b5119d418a65d489) that does exactly this, since you can run that script from anywhere you can access your Jenkins server.


---

### Answer by username_2 on 2017-10-25. Score: 3

Updated the [python script](https://github.com/burukuru/jenkins-update-ec2-ami) from the PR above with:

* CSRF support to work better with Jenkins 2.x
* full support for private Jenkins jobs

Also I wrote up some usage instructions.


---

### Answer by username_3 on 2019-08-01. Score: 1

For me, the best place to start is to have at the end of your packer.json a call to the [manifest](https://www.packer.io/docs/post-processors/manifest.html) post-processor.

This will contain the full details of the AMI that you have created in JSON format.

eg "artifact\_id": "us-west-1:ami-XXXXXXXX",

This can then be read and acted on by any tooling of your choice.

Source: <https://www.packer.io/docs/post-processors/manifest.html>


---

