Getting started with the Cloud Pods CLI
With the LocalStack Cloud Pods command-line interface (CLI), the
pod command, you can create cloud pods and manage them from a terminal. The Cloud Pods CLI is ideal in the following situations:
- Taking a snapshot of your running LocalStack instance.
- Sharing your snapshot across teams with LocalStack Team features.
- Injecting snapshots into a running instance without a restart.
LocalStack Cloud Pods CLI is directly available with the LocalStack installation, and no further installation is required to get started. If you are a Pro user, we recommend you to export the
LOCALSTACK_API_KEY as an environment variable to allow you to use the full spectrum of LocalStack Cloud Pods feature.
For Community users, we recommend you to use a different remote, with public GitHub repositories being the recommended way to store your Cloud Pods data. The creation of pods (with the
export command) would require a Pro account, but the pulling and injection of public community pods (read-only) would work with Community as well.
In this tutorial, you’ll learn how to make a basic usage of LocalStack Cloud Pods CLI. This tutorial is intended for Pro users who wish to get more acquainted with Cloud Pods CLI. It assumes you have basic knowledge of:
- Understanding of Cloud Pods workflow
By the end of this tutorial, you would be able to create a snapshot of your running LocalStack instance, commit it and would be able to push this to your LocalStack account.
To get started, start your LocalStack instance with your
LOCALSTACK_API_KEY configured as an environment variable:
awslocalCLI to create AWS resources inside your running LocalStack instance.
As an example, we will create a S3 bucket using the
awslocalCLI and enter some data inside it:
$ awslocal s3 mb s3://test $ echo "hello world" > /tmp/hello-world $ awslocal s3 cp /tmp/hello-world s3://test/hello-world $ awslocal s3 ls s3://test/
Create a Cloud Pod using the
--nameflag to specify the Pod name:
$ localstack pod config --name <pod-name>
Optional: You can also specify a list of services for your Cloud Pod with the following command:
$ localstack pod config --services <comma-seperated-services-names>
Commit your Pod state using the
commitcommand by specifying the
--messageflag to specify the Pod name your created previously and the commit message associated with the change:
$ localstack pod commit --name <pod-name> --message "<commit-message>"
Check the list of Cloud Pods on your machine using the
$ localstack pod list ┏━━━━━━━━━━━━━━┳━━━━━━━━━━━┓ ┃ local/remote ┃ Name ┃ ┡━━━━━━━━━━━━━━╇━━━━━━━━━━━┩ │ local │ pod-name │ └──────────────┴───────────┘
Optional: You can inspect the contents of a Cloud Pod using the
$ localstack pod inspect --name <pod-name> - 000000000000 - S3 - global - listBuckets - Buckets - 0 - Name = test - CreationDate = 2022-10-04T17:03:47.000Z - Owner - DisplayName = webfile - ID = bcaf1ffd86f41161ca5fb16fd081034f
Push the Cloud Pod to LocalStack’s remote storage using
pushcommand with the
--nameflag and the
$ localstack pod push --name <pod-name> --message "<message>" Successfully pushed the current state Successfully registered <pod-name> with remote!
To publish your Cloud Pod locally, prefer using the
--localflag to publish it.
On an alternate machine, start LocalStack with the API key configured, and pull the Cloud Pod we created previously using
pullcommand with the
$ localstack pod pull --name <pod-name> Done.
Let’s check the S3 buckets in our Cloud Pod:
$ awslocal s3 ls s3://test/ 2022-10-04 22:33:54 12 hello-world