MildStack Logo

AWS Local

Use the standard AWS CLI with MildStack by pointing it to your local endpoint.

Using the AWS CLI with MildStack

You can use the official AWS CLI to interact with MildStack. Since MildStack is fully compatible with AWS SDKs and tools, the only thing you need to change is the endpoint URL.

Setup

Create a Local Profile

Set up a dedicated AWS CLI profile for MildStack:

aws configure set aws_access_key_id test --profile mildstack
aws configure set aws_secret_access_key test --profile mildstack
aws configure set region us-east-1 --profile mildstack

MildStack ignores credentials entirely. You can use any values for the access key and secret — they just need to be present for the AWS CLI to work.

Using the Profile

Add --endpoint-url and --profile to every AWS CLI command:

aws s3 ls --endpoint-url http://localhost:4566 --profile mildstack

Shell Alias (Optional)

To avoid typing the flags every time, create a shell alias:

# Add to your ~/.zshrc or ~/.bashrc
alias awslocal='aws --endpoint-url http://localhost:4566 --profile mildstack'

Now you can use it like the regular AWS CLI:

awslocal s3 ls
awslocal dynamodb list-tables
awslocal sqs list-queues

S3 Examples

# Create a bucket
awslocal s3 mb s3://my-bucket

# Upload a file
awslocal s3 cp ./data.json s3://my-bucket/data.json

# List bucket contents
awslocal s3 ls s3://my-bucket

# Download a file
awslocal s3 cp s3://my-bucket/data.json ./downloaded.json

# Sync a directory
awslocal s3 sync ./my-folder s3://my-bucket/my-folder

# Delete a file
awslocal s3 rm s3://my-bucket/data.json

# Delete a bucket (must be empty)
awslocal s3 rb s3://my-bucket

DynamoDB Examples

# Create a table
awslocal dynamodb create-table \
  --table-name Users \
  --attribute-definitions AttributeName=id,AttributeType=S \
  --key-schema AttributeName=id,KeyType=HASH \
  --billing-mode PAY_PER_REQUEST

# List tables
awslocal dynamodb list-tables

# Put an item
awslocal dynamodb put-item \
  --table-name Users \
  --item '{"id": {"S": "user-1"}, "name": {"S": "Alice"}, "email": {"S": "[email protected]"}}'

# Get an item
awslocal dynamodb get-item \
  --table-name Users \
  --key '{"id": {"S": "user-1"}}'

# Query items
awslocal dynamodb query \
  --table-name Users \
  --key-condition-expression "id = :id" \
  --expression-attribute-values '{":id": {"S": "user-1"}}'

# Scan all items
awslocal dynamodb scan --table-name Users

# Delete a table
awslocal dynamodb delete-table --table-name Users

SQS Examples

# Create a queue
awslocal sqs create-queue --queue-name my-queue

# Create a FIFO queue
awslocal sqs create-queue \
  --queue-name my-queue.fifo \
  --attributes FifoQueue=true,ContentBasedDeduplication=true

# List queues
awslocal sqs list-queues

# Send a message
awslocal sqs send-message \
  --queue-url http://localhost:4566/000000000000/my-queue \
  --message-body '{"event": "order.created", "orderId": "123"}'

# Receive messages
awslocal sqs receive-message \
  --queue-url http://localhost:4566/000000000000/my-queue

# Delete a queue
awslocal sqs delete-queue \
  --queue-url http://localhost:4566/000000000000/my-queue

Tips

  • Port mismatch? If your instance is running on a port other than 4566, update your alias or --endpoint-url accordingly.
  • JSON output: Add --output json for machine-readable responses, or --output table for human-readable tables.
  • Multiple instances: Create separate aliases for each instance port if you're running more than one.

On this page