LocalStack Cloud Pods

Search for a command to run...

No comments yet. Be the first to comment.
Bite-size LocalStack features inspired by frequently asked questions. Each post zooms in on a single example-backed topic, unlocking insights to elevate user knowledge and pave the path to success.
Is your application interacting with Amazon Web Services? No worries! AWS provides client libraries and SDKs for a wide range of programming languages, here are just a few of them: As promised, LocalStack can be a drop-in replacement for the most po...
Learn how to test the EventBridge archive and replay feature with a Lambda target using LocalStack and AWS CLI — all on your local machine.

Learn how to deploy and debug ECS tasks locally with LocalStack by attaching a remote debugger in VS Code to facilitate local development & testing!

Learn how to run an EC2 instance using LocalStack's core cloud emulator and AWS CLI to facilitate development & testing right on your local machine!

Introduction In today’s tech landscape, large language models (LLMs) and AI are transforming both tech-centric and traditional businesses. AI functionality is being integrated across various platforms to enhance user experience. However, developing a...

After seeing how LocalStack Cloud Pods help teams work better together, let's look at the other ways companies can keep their snapshots in their own court. For environments with stricter security policies, there are a few storage options that help pr...

Cloud Pods - sounds fancy, right? Well, they certainly are an elegant solution - they're all about a dynamic and efficient approach to managing state within your LocalStack ecosystem and sharing it like a pro with your squad.
Gone are the days of mundane infrastructure setup and data restore routines at every startup of LocalStack. Cloud Pods eliminate all those reboot worries, making it a breeze to set the stage for your top-priority work.
We’ll get to a follow-along example in a minute, but first, let’s have a look at how things work.
Instead of simply restoring a state when restarting LocalStack, Cloud Pods allow you to take snapshots of your local instance (with the save command) and inject such snapshots into a running instance (with the load command) without requiring a restart.
In addition, we provide a remote storage backend that can be used to store the state of your running application and share it with your team members.

Now, let’s explore how this is done.
Clone the repository.
git clone https://github.com/tinyg210/stack-bytes-apigw-lambda-s3.git
Export your LOCALSTACK_API_KEY as an environment variable.
export LOCALSTACK_API_KEY=<YOUR_API_KEY>
*Sidenote: make sure there’s apigw-lambda.jar in the /stack-bytes-lambda/target/ folder. If not, or if anything fails, please run mvn clean package shade:shade in the stack-bytes-lambda folder.
Start LocalStack:
docker compose up
Let’s add some Quotes to our S3 storage:
curl --location 'http://id12345.execute-api.localhost.localstack.cloud:4566/dev/quoteApi' \
--header 'Content-Type: application/json' \
--data '{
"author": "Shrek",
"text": "NO! You dense, irritating, miniature beast of burden! Ogres are like onions!"
}'
curl --location 'http://id12345.execute-api.localhost.localstack.cloud:4566/dev/quoteApi' \
--header 'Content-Type: application/json' \
--data '{
"author": "Donkey",
"text": "And in the morning...I\'m making waffles!"
}'
Log in to the localstack CLI tool with your registered account and password to get the full Cloud Pod experience. You can only create a snapshot on your machine if you are not logged in.
localstack login
Now that we have a reasonable amount of data, let’s save our state:
localstack pod save cloud-pod-quotes
Cloud Pod cloud-pod-quotes successfully exported.
We can confidently shut down our containers.
docker compose down
Verify the pod is there for your team to see.
localstack pod list
┏━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ local/remote ┃ Name ┃
┡━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┩
│ remote │ cloud-pod-quotes │
Let’s start a fresh instance of LocalStack, this time using the CLI tool.
localstack start
Load the pod into the LocalStack container.
localstack pod load cloud-pod-quotes
Verify that the state and data are there:
curl --location 'http://id12345.execute-api.localhost.localstack.cloud:4566/dev/quoteApi?author=Donkey'
{"text":"Quote: And in the morning...I'm making waffles!"}
curl --location 'http://id12345.execute-api.localhost.localstack.cloud:4566/dev/quoteApi?author=Shrek'
{"text":"Quote: NO! You dense, irritating, miniature beast of burden! Ogres are like onions!"}⏎
Smooth sailing all the way! We did a little state and data magic and tucked them neatly into a Cloud Pod. Now, it's our secret weapon – perfect for sprinkling LocalStack goodness into those repetitive acts like CI tests. And hey, sharing is caring, right? So, we pass this Cloud Pod gem to our colleagues for a front-row seat to our LocalStack brilliance.