Article

Table of Contents
Theme:
Was this article helpful?

1  out of  2 found this helpful

Try Vultr Today with

$50 Free on Us!

Want to contribute?

You could earn up to $300 by adding new articles!

Manage Instance User Data with the Vultr Metadata API

Last Updated: Thu, Oct 22, 2020
FAQ

Introduction

When deploying a new cloud server instance, you can set user data for an instance, which is useful for startup scripts. You can also update the user data for an instance.

Set User Data for New Deployment

To set user data on a new deployment, include Base64 encoded user data in the call to /v1/server/create endpoint.

Update User Data for an Instance

To update user data, use the /v1/server/set_user_data endpoint to set Base64 encoded user data.

$ curl https://api.vultr.com/v1/server/set_user_data \
    -H 'API-Key: YOUR_API_KEY' \
    --data 'SUBID=YOUR_SUB_ID' \
    --data 'userdata=QmUgU3VyZSBUbyBEcmluayBZb3VyIE92YWx0aW5lLgo='

Retrieve User Data

To retrieve user data, use the Metadata API /latest/user-data endpoint from the running instance. The Base64 encoded value is decoded and returned as text.

# curl http://169.254.169.254/latest/user-data
Be Sure To Drink Your Ovaltine.

If you update a running instance, the /latest/user-data Metadata endpoint will return old values until the instance is rebooted or reinstalled.

Want to contribute?

You could earn up to $300 by adding new articles