AI & Agent Workflows
Introduction
Section titled “Introduction”LocalStack gives AI coding assistants a local AWS-compatible environment to work against. Instead of letting an agent experiment in a real AWS account, you can ask it to create infrastructure, deploy code, inspect logs, and test resources in LocalStack first.
This is useful when you want to:
- Prototype AWS applications & infrastructure code from natural language prompts.
- Validate AI-generated Terraform, CDK, or AWS CLI commands before using a cloud account.
- Give an AI assistant a safe place to inspect resources, debug logs, and iterate on deployments.
- Use reusable agent instructions for LocalStack-aware infrastructure workflows.
Common workflows
Section titled “Common workflows”There are three common ways to use LocalStack in AI-assisted development:
- Use the LocalStack MCP Server when your AI assistant supports MCP clients such as Cursor, Claude, Codex, or OpenCode.
- Use LocalStack Skills when you want reusable agent instructions for deploying and testing AWS architectures against LocalStack.
- Use LocalStack with
tflocal,cdklocal, orawslocalwhen you want the agent to generate infrastructure code or commands that you review and run locally.
You do not need all three approaches to get started. If your editor supports MCP, start with the LocalStack MCP Server. Or, you can use Skills if you want reusable agent instructions. If not, ask your assistant to generate Terraform, CDK, or AWS CLI steps and run them with LocalStack’s local wrappers.
Connect an MCP client
Section titled “Connect an MCP client”The LocalStack MCP Server connects MCP-compatible clients to your LocalStack environment. Once configured, your AI assistant can use LocalStack tools to start the container, deploy infrastructure, run AWS CLI commands, inspect logs, manage state, and query resources.
All MCP server tools require a valid Auth Token configured as LOCALSTACK_AUTH_TOKEN.
Use agent skills
Section titled “Use agent skills”LocalStack Skills provide reusable instructions for AI agents working with LocalStack. They help agents follow LocalStack-specific conventions when creating infrastructure, deploying resources, running tests, and inspecting local cloud state.
Skills are most useful when you want the assistant to follow a repeatable workflow, for example:
- Scaffold a local AWS application and deploy it to LocalStack.
- Convert an AWS architecture idea into Terraform or CDK that targets LocalStack first.
- Debug a failing local deployment by checking resources, logs, and configuration.
- Save or restore LocalStack state as part of an iterative development loop.
Refer to the LocalStack Skills repository for available skills and setup instructions.
Example prompt sequence
Section titled “Example prompt sequence”After LocalStack and your preferred AI tooling are configured, you can use a sequence like this:
Create a Terraform application with an S3 bucket, a Lambda function, and a DynamoDB table.Make it deployable to LocalStack with tflocal.Deploy the application to LocalStack and fix any errors from the deployment.Invoke the Lambda function locally, inspect the DynamoDB table, and summarize what resources were created.Add an integration test that verifies the Lambda writes an item to DynamoDB.Run the test against LocalStack.This keeps the feedback loop local while still giving the assistant a realistic AWS-compatible target.
Review before applying to AWS
Section titled “Review before applying to AWS”AI-generated infrastructure still needs review. Treat LocalStack as the first validation step, not as a replacement for code review, tests, or production deployment controls.
Before applying changes to AWS, check that:
- The generated infrastructure matches your intended architecture.
- Resource names, IAM policies, and environment variables are appropriate for your project.
- Tests pass against LocalStack.
- You understand any changes the assistant made to application code or deployment configuration.
Next steps
Section titled “Next steps”- Configure the LocalStack MCP Server if your AI assistant supports MCP.
- Review LocalStack Skills for reusable agent workflows.
- Continue with the Local Development guide if you want a guided Lambda and DynamoDB example before adding AI tooling.