# Dynamic instances of Elastic Agent

**URL:** <https://discuss.elastic.co/t/dynamic-instances-of-elastic-agent/337005>\
**Category:** Elastic Agent\
**Created:** [June 27, 2023, 2:14pm UTC](https://discuss.elastic.co/t/dynamic-instances-of-elastic-agent/337005 "2023-06-27T14:14:11Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![hti](https://avatars.discourse-cdn.com/v4/letter/h/e19b73/32.png) [@hti](https://discuss.elastic.co/u/hti)\
**Post date:** [June 27, 2023, 2:14pm UTC](https://discuss.elastic.co/t/dynamic-instances-of-elastic-agent/337005/1 "2023-06-27T14:14:11Z")

</div>

Hello,

we are spawning multiple Windows Server instances from a golden image. These instances get destroyed and recreated daily.  
For log collection we installed and enrolled the Elastic Agent in the golden image. We do get logs of all server instances, but have troubles when the agent policy is updated (it is not assigned correctly on all instances).

Therefore, we try to enroll each server instance individually. The easiest option for us would be, to just recreate the agent id on startup. We tried to delete the state.enc and fleet.enc file, but then the agent won't start.

Does anyone have experience with running Elastic Agent on server instances the are recreated regularly, e.g. for VDI servers? Elastic Agent for Kubernetes maps a static machine-id file but I could not find something similar for non-Kubernetes environments (apart from the encrypted fleet.enc and state.enc files).

Best regards,  
hti

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 25, 2023, 2:15pm UTC](https://discuss.elastic.co/t/dynamic-instances-of-elastic-agent/337005/2 "2023-07-25T14:15:07Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
