# How to add a plugin to all agents

**URL:** <https://forum.buildkite.community/t/how-to-add-a-plugin-to-all-agents/4477>\
**Category:** General\
**Created:** [August 18, 2025, 3:13pm UTC](https://forum.buildkite.community/t/how-to-add-a-plugin-to-all-agents/4477 "2025-08-18T15:13:16Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![peerallan](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.buildkite.community/peerallan/32/1537_2.png) [@peerallan](https://forum.buildkite.community/u/peerallan)\
**Post date:** [August 18, 2025, 3:13pm UTC](https://forum.buildkite.community/t/how-to-add-a-plugin-to-all-agents/4477/1 "2025-08-18T15:13:16Z")

</div>

When using Elastic Stack you can see that there are global plugins like ECR being used that are just part of the default agent flow. How can I add my own plugins to this flow on the agents? That is to say, I want a plugin with a post-checkout script that I want to run on all agents just like how the ECR plugin does.

Where to I put the plugins on the agent and how do I get the agent to use them?

Thanks!

---

<div class="post-metadata">

**Author:** ![Ola](https://avatars.discourse-cdn.com/v4/letter/o/dbc845/32.png) [@Ola](https://forum.buildkite.community/u/Ola)\
**Post date:** [August 18, 2025, 5:05pm UTC](https://forum.buildkite.community/t/how-to-add-a-plugin-to-all-agents/4477/2 "2025-08-18T17:05:55Z")

</div>

Hi @peerallan,  
Great question about adding global plugins to your Elastic CI Stack agents.

The most straightforward approach is to use a bootstrap script with the `BootstrapScriptUrl` parameter. In your bootstrap script, you can install your plugin and create a post-checkout hook in `/etc/buildkite-agent/hooks/`. Something like:

```auto
#!/bin/bash
# Your bootstrap script
cat > /etc/buildkite-agent/hooks/post-checkout <<'EOF'
#!/bin/bash
# Your plugin logic here
EOF
chmod +x /etc/buildkite-agent/hooks/post-checkout

```

If your plugin logic is more complex, you could have the bootstrap script pull the actual plugin code from S3 or another source and then set it up in the post-checkout hook.

For a more permanent solution, you could also build your own custom AMI with the plugins pre-installed, similar to how the ECR plugin is included. This is actually how the ECR plugin you mentioned is configured.

Quick question though - what specific functionality are you looking to add with your global plugin? Knowing your use case might help me suggest the best approach for your situation.
