Article

Table of Contents
Theme:
Was this article helpful?

3  out of  5 found this helpful

Try Vultr Today with

$50 Free on Us!

Want to contribute?

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

Manage Instance User Data with the Vultr Metadata API

Last Updated: Mon, Aug 30, 2021
FAQ

Introduction

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

Set User Data for New Deployment

To set user data on a new deployment, include Base64 encoded user data in the call to Create Instance.

Update User Data for an Instance

To update user data, use the V1 API /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 $600 by adding new articles