Managing Vagrant Cloud
1. Logging In
| Method | Description | Notes |
|---|---|---|
| vagrant cloud login | Authenticate with Vagrant Cloud using credentials | Requires valid username and API token |
| vagrant cloud login --token <api_token> | Authenticate with Vagrant Cloud using an API token | Token can be generated from Vagrant Cloud dashboard |
Note: The Vagrant Cloud login credentials are stored in
~/.vagrant.d/credentials.
2. Creating Box
| Step | Description | Action |
|---|---|---|
| 1 | Prepare base image | Create a Vagrant box using a supported provider (e.g., VirtualBox, VMware) |
| 2 | Configure Vagrantfile | Ensure the Vagrantfile is properly configured with correct box name and version |
| 3 | Package the box | Run vagrant package --output my-box.box |
| 4 | Upload to Vagrant Cloud | Use vagrant cloud publish command with required metadata |
Example: Publishing to Vagrant Cloud
vagrant cloud publish my-org/my-box 1.0.0 virtualbox my-box.box
3. Publishing Box Version
| Field | Description | Value |
|---|---|---|
| name | Box name | example/box-name |
| version | Version number | 1.0.0 |
| description | Box description | Short description of the box |
| providers | Providers supported | ["virtualbox", "libvirt"] |
Example: Adding a Provider to Box Version
vagrant cloud box version provider add example/box-name 1.0.0 virtualbox
4. Adding Provider
Providers in Vagrant define the environment where your virtual machine runs. Adding a provider allows you to use different hypervisors or cloud platforms.
| Provider | Description | Installation Command | Notes |
|---|---|---|---|
| virtualbox | VirtualBox is a free and open-source hypervisor for x86 computers. | vagrant plugin install vagrant-virtualbox |
Requires VirtualBox to be installed on the host machine. |
| libvirt | Libvirt is a toolkit for managing virtualization platforms. | vagrant plugin install vagrant-libvirt |
Requires libvirt and qemu-kvm to be installed on the host machine. |
| aws | Amazon Web Services provider for deploying instances. | vagrant plugin install vagrant-aws |
Requires AWS credentials configured via environment variables or IAM roles. |
| azure | Microsoft Azure provider for deploying virtual machines. | vagrant plugin install vagrant-azure |
Requires Azure CLI or service principal credentials. |
| gcp | Google Cloud Platform provider for deploying instances. | vagrant plugin install vagrant-gcp |
Requires GCP service account key or application default credentials. |
Note: Ensure that the required software (e.g., VirtualBox) is installed before installing the Vagrant plugin.
5. Uploading Box File
Example: Upload Box File to Vagrant Cloud
vagrant cloud box create myorg/mybox
vagrant cloud box version create myorg/mybox 1.0.0
vagrant cloud box version file create myorg/mybox 1.0.0 --file /path/to/box-file.box
| Command | Description | Notes |
|---|---|---|
| vagrant cloud box create | Creates a new box in Vagrant Cloud | Requires organization and box name |
| vagrant cloud box version create | Creates a new version of the box | Version must be semantic (e.g., 1.0.0) |
| vagrant cloud box version file create | Uploads a box file to the specified version | Must specify the file path and version |
Note: Ensure the box file is compatible with the target provider (e.g., VirtualBox, VMware).
6. Releasing Box Version
| Field | Description | Notes |
|---|---|---|
| name | string |
Unique identifier for the box version |
| version | string |
Version number (e.g., 1.0.0) |
| description | string |
Optional description of the version |
| metadata | object |
Additional metadata (e.g., { "provider": "virtualbox" }) |
Example: Releasing a Box Version via API
curl -X POST \
-H "Authorization: Bearer <TOKEN>" \
-H "Content-Type: application/json" \
-d '{
"name": "mybox",
"version": "1.0.0",
"description": "Initial release of mybox",
"metadata": {
"provider": "virtualbox"
}
}' \
https://app.vagrantcloud.com/api/v1/box/myorg/mybox/version
Note: Ensure the version string follows semantic versioning (e.g.,
1.0.0) to maintain compatibility.
7. Revoking Box Version
| Field | Description | Value |
|---|---|---|
| box.name | Name of the box to revoke | example/box-name |
| version | Version of the box to revoke | 1.0.0 |
Note: Revoking a box version makes it unavailable for new deployments but does not remove it from existing Vagrant environments using that version.
8. Deleting Box
| Property | Description | Notes |
|---|---|---|
| vagrant box remove | Removes a box from the local system | Requires the box name and provider (e.g., virtualbox) |
Note: This command only removes the box from the local system. It does not affect Vagrant Cloud or any remote repositories.
9. Searching Boxes
| Field | Description | Example |
|---|---|---|
| name | Name of the box | ubuntu/focal64 |
| provider | Provider for the box (e.g., virtualbox, vmware) | virtualbox |
| version | Version of the box | 20.04.1 |
| description | Short description of the box | Ubuntu 20.04 LTS with VirtualBox provider |
| created_at | Date the box was created | 2023-05-10T14:30:00Z |
10. Managing Organizations
| Property | Description | Values |
|---|---|---|
| organization.name | Name of the organization | myorg |
| organization.description | Description of the organization | My company's Vagrant organization |
| organization.avatar_url | URL to the organization's avatar image | https://example.com/avatar.png |
Example: Create Organization
vagrant cloud org create --name myorg --description "My company's Vagrant organization"
Example: Update Organization
vagrant cloud org update --name myorg --description "Updated description"
Note: Organization names must be unique across Vagrant Cloud.