Packer Image create a snapshot instead of an image

I had created a packer image that runs a shell script after booting a droplet using ubuntu.

The problem is that if I use that snapshot it will create droplets with the same data from the snapshot (obviously because is a “copy of another droplet”)

what I want to achieve is to run the script each time a droplet is created from that “snapshot” not to have the same data propagated over every droplet.

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Site Moderator
Site Moderator badge
November 22, 2023

Heya @andresogando,

I’m not sure I understand you entirely so let me try to reiterate and you can confirm or deny if It’s correct:

You’re looking/trying to create a process where a script runs each time a new droplet is created from a snapshot in Packer with Ubuntu, is that correct?

You’ll need to set up your script to execute as part of the droplet’s startup process. This way, every time a new droplet is created from the snapshot, the script will run afresh, allowing for dynamic data handling or configuration rather than just replicating the snapshot’s state.

Let me know if that is what you need to achieve or if I’m mistaken please provide a more detailed explanation and we can take it from there.

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Featured on Community

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel