This guide walks you through deploying the Fullstack AgentCore Solution Template (FAST) to AWS using Terraform.
CDK alternative: This guide covers Terraform deployment. FAST also supports AWS CDK -- see Deployment Guide for the CDK deployment guide. We recommend choosing one infrastructure tool and deleting the other directory (
infra-cdk/orinfra-terraform/) from your fork to keep things clean.
Before deploying, ensure you have:
- Terraform >= 1.5.0 (see Install Terraform)
- AWS CLI configured with credentials (
aws configure) - see AWS CLI Configuration guide - Python 3.11+ (for the frontend deployment script)
- Docker (only required for
backend_deployment_type = "docker") - see Install Docker Engine. Verify withdocker ps. Alternatively, Finch can be used on Mac. See below if you have a non-ARM machine. - An AWS account with sufficient permissions to create:
- S3 buckets
- Cognito User Pools
- Amplify Hosting projects
- Bedrock AgentCore resources
- IAM roles and policies
cd infra-terraform
cp terraform.tfvars.example terraform.tfvarsEdit terraform.tfvars to customize your deployment:
stack_name_base = "your-project-name" # Base name for all resources (max 35 chars)
admin_user_email = "admin@example.com" # Optional: auto-creates user & emails credentialsImportant:
- Change
stack_name_baseto a unique name for your project to avoid conflicts - Maximum length is 35 characters (due to AWS AgentCore runtime naming constraints)
| Variable | Description |
|---|---|
stack_name_base |
Base name for all resources |
| Variable | Description | Default |
|---|---|---|
admin_user_email |
Email for Cognito admin user | null |
backend_pattern |
Agent pattern to deploy | "strands-single-agent" |
backend_deployment_type |
"docker" (ECR container) or "zip" (S3 package) |
"docker" |
backend_network_mode |
Network mode (PUBLIC/VPC) | "PUBLIC" |
backend_vpc_id |
VPC ID (required when VPC mode) | null |
backend_vpc_subnet_ids |
Subnet IDs (required when VPC mode) | [] |
backend_vpc_security_group_ids |
Security group IDs (optional for VPC mode) | [] |
Region: Set via the AWS_REGION environment variable or AWS CLI profile (aws configure). The Terraform provider uses the standard AWS SDK resolution chain -- no region variable is needed.
Tags: The provider applies default tags (Project, ManagedBy, Repository) to all resources automatically. Add custom tags directly in the provider's default_tags block in main.tf.
Set backend_deployment_type in terraform.tfvars to "docker" (default) or "zip". See Deployment Types in the main Deployment Guide for guidance on choosing between them.
Terraform-specific notes:
- ZIP mode does not require Docker installed locally (unlike CDK, where Docker is always needed)
- ZIP packaging includes: The
patterns/<your-pattern>/,patterns/utils/, andtools/directories are bundled together with dependencies fromrequirements.txt
By default, the AgentCore Runtime runs in PUBLIC network mode with internet access. To deploy the runtime into an existing VPC for private network isolation, set backend_network_mode = "VPC" and provide your VPC details:
backend_network_mode = "VPC"
backend_vpc_id = "vpc-0abc1234def56789a"
backend_vpc_subnet_ids = ["subnet-aaaa1111bbbb2222c", "subnet-cccc3333dddd4444e"]
backend_vpc_security_group_ids = ["sg-0abc1234def56789a"] # OptionalThe backend_vpc_id and backend_vpc_subnet_ids fields are required when using VPC mode. The backend_vpc_security_group_ids field is optional -- if omitted, a default security group is created with HTTPS (TCP 443) self-referencing ingress and all-traffic egress.
For detailed VPC prerequisites -- including required VPC endpoints, subnet requirements, NAT Gateway guidance, and security group configuration -- see VPC Deployment in the main Deployment Guide.
Important: AgentCore Runtime availability is limited to specific Availability Zones per region. Verify your subnets are in supported AZs before deploying. See AWS documentation on supported Availability Zones for details.
cd infra-terraform
cp terraform.tfvars.example terraform.tfvars
# Edit terraform.tfvars with your configuration
terraform init
terraform apply
python scripts/deploy-frontend.pycd infra-terraform
terraform initBuild and deploy the complete stack:
terraform applyThe deployment will:
- Create Amplify Hosting app and S3 staging bucket
- Create a Cognito User Pool with web and machine clients
- Create AgentCore Memory for persistent conversations
- Set up OAuth2 Credential Provider for Runtime-to-Gateway authentication
- Create AgentCore Gateway with Lambda tool targets
- Build and deploy the AgentCore Runtime (Docker image or ZIP package)
- Create the Feedback API (API Gateway + Lambda + DynamoDB)
- Store configuration in SSM Parameters
- Docker mode (default): Automatically builds an ARM64 Docker image, pushes to ECR, and creates the runtime. Requires Docker to be running locally.
- Zip mode: Deploys a packager Lambda that bundles your agent code with ARM64 wheels, uploads to S3, and creates the runtime. No Docker required.
Note: If you provide a pre-built image via
container_uri, Terraform skips the build and uses your image directly.
# From infra-terraform directory
python scripts/deploy-frontend.pyThis script automatically:
- Generates fresh
aws-exports.jsonfrom Terraform outputs (see below for more information) - Installs/updates npm dependencies if needed
- Builds the frontend
- Deploys to AWS Amplify Hosting
You will see the URL for the application in the script's output, which will look similar to this:
App URL: https://main.d123abc456def7.amplifyapp.com
A shell alternative is also available for macOS/Linux:
./scripts/deploy-frontend.shIf you provided admin_user_email in config:
- Check your email for temporary password
- Sign in and change password on first login
If you didn't provide email:
- Go to the AWS Cognito Console
- Find your User Pool (named
{stack_name_base}-user-pool) - Click on the User Pool
- Go to "Users" tab
- Click "Create user"
- Fill in the user details:
- Email: Your email address
- Temporary password: Create a temporary password
- Mark email as verified: Check this box
- Click "Create user"
- Open the Amplify Hosting URL in your browser
- Sign in with the Cognito user you created
- You'll be prompted to change your temporary password on first login
To update the frontend code:
# From infra-terraform directory
python scripts/deploy-frontend.pyTo update the backend agent:
cd infra-terraform
terraform applyTerraform detects code changes automatically and rebuilds/redeploys the runtime. After a backend update that replaces the runtime, redeploy the frontend to pick up the new Runtime ARN:
python scripts/deploy-frontend.pyIf you prefer to build the Docker image separately (e.g., in CI/CD):
./scripts/build-and-push-image.shOptions:
./scripts/build-and-push-image.sh -h # Show help
./scripts/build-and-push-image.sh -p langgraph-single-agent # Use LangGraph pattern
./scripts/build-and-push-image.sh -s my-stack -r us-west-2 # Override stack/region# Get deployment summary
terraform output deployment_summary
# Get all outputs
terraform output# From infra-terraform directory
pip install boto3 requests colorama # First time only
python scripts/test-agent.py 'Hello, what can you do?'- Frontend logs: Check Amplify build logs in the AWS Console
- Backend logs: Check CloudWatch logs for the AgentCore runtime
- Feedback API logs: Check CloudWatch logs for the feedback Lambda
To remove all resources:
cd infra-terraform
terraform destroyTerraform handles resource dependencies automatically and destroys in the correct order.
Warning: This will delete all data including Cognito users, S3 buckets, DynamoDB tables, and ECR images.
After destroy completes, verify no resources remain:
aws resourcegroupstaggingapi get-resources --tag-filters Key=Project,Values=<your-stack-name>-
terraform applyfails with Docker errors- Ensure Docker is installed and the daemon is running:
docker ps - On Mac, open Docker Desktop or start Finch:
finch vm start - On Linux:
sudo systemctl start docker - If using
backend_deployment_type = "zip", Docker is not required
- Ensure Docker is installed and the daemon is running:
-
"Architecture incompatible" or "exec format error" during Docker build
- This occurs when deploying from a non-ARM machine without cross-platform build setup
- Follow the Docker Cross-Platform Build Setup instructions below
- Ensure you've installed QEMU emulation:
docker run --privileged --rm tonistiigi/binfmt --install all - Verify ARM64 support:
docker buildx lsshould showlinux/arm64in platforms
-
Terraform Init Fails
Ensure you have the correct provider versions:
terraform init -upgrade
-
Authentication errors
Verify AWS credentials:
aws sts get-caller-identity
Also verify you created a Cognito user and that the user's email is verified.
-
"Agent Runtime ARN not configured" or 404 errors
- Ensure the backend deployed successfully
- Redeploy the frontend to pick up the latest Runtime ARN:
python scripts/deploy-frontend.py
- Verify SSM parameters match Terraform outputs:
terraform output runtime_arn
-
Permission errors
- Verify your AWS credentials have sufficient permissions
- Check IAM roles created by the stack
- Check CloudWatch logs for detailed error messages
- Review
terraform outputfor resource identifiers - Ensure all prerequisites are met
See Security Considerations in the main Deployment Guide. Additionally, consider deploying in VPC mode for network isolation.
Bedrock AgentCore Runtime only supports ARM64 architecture. If you're deploying from a non-ARM machine (x86_64/amd64), you need to enable Docker's cross-platform building capabilities. See Docker Cross-Platform Build Setup in the main Deployment Guide for setup instructions.
The aws-exports.json file provides the frontend with Cognito authentication configuration. See Understanding aws-exports.json in the main Deployment Guide for details on its purpose and structure.
For Terraform deployments, the file is generated by deploy-frontend.py which fetches configuration from terraform output -json (rather than CDK stack outputs). You should not manually edit this file as it's regenerated on each deployment.