awsemu vs AWS CLI
awsemu is a drop-in replacement for the AWS CLI. Every command, subcommand, and option from aws works identically with awsemu. The only difference is that awsemu automatically targets your local LocalEmu instance.
How It Works
- • awsemu automatically sets
--endpoint-url=http://localhost:4566on every call - • Credentials are pre-set to the AWS-published example pair (
AKIAIOSFODNN7EXAMPLEwith the matching example secret). The pair is inROOT_ACCESS_KEYSby default, so it works even underIAM_ENFORCEMENT=1. - • Everything from
aws helpworks withawsemu - • Any AWS CLI guide, tutorial, or StackOverflow answer applies directly. Just replace
awswithawsemu
Comparison
# AWS CLI (real AWS)
$ aws s3 ls
$ aws sqs create-queue --queue-name my-queue
# awsemu (LocalEmu) - identical syntax
$ awsemu s3 ls
$ awsemu sqs create-queue --queue-name my-queue Service-Specific Notes
While awsemu is a drop-in replacement, some services have LocalEmu-specific behaviors worth knowing about.
EC2
- • Use LocalEmu AMI IDs like
ami-ubuntu-22.04,ami-ubuntu-20.04, orami-debian-12instead of real AMI IDs - • SSH via the instance's
PrivateIpAddress, from a container on the same VPC network (see EC2: API reference)
EC2 Example
$ awsemu ec2 run-instances \
--image-id ami-ubuntu-22.04 \
--instance-type t2.micro \
--count 1
# PrivateIpAddress is the connectable address
$ awsemu ec2 describe-instances \
--query 'Reservations[].Instances[].PrivateIpAddress' RDS
- •
Endpoint.Addressislocalhost - •
Endpoint.Portis the Docker-mapped port on the host
RDS Example
$ awsemu rds create-db-instance \
--db-instance-identifier mydb \
--engine postgres \
--master-username admin \
--master-user-password secret123
# Connect with psql using the returned endpoint
$ awsemu rds describe-db-instances \
--query 'DBInstances[0].Endpoint'
Address: localhost
Port: 49267 # Dynamically assigned; check DescribeDBInstances OpenSearch
- • Domain endpoint is
localhost:<port>where the port is dynamically assigned
OpenSearch Example
$ awsemu opensearch create-domain --domain-name my-domain
# Get the domain endpoint
$ awsemu opensearch describe-domain \
--domain-name my-domain \
--query 'DomainStatus.Endpoint'
localhost:43215 Cognito
- • JWKS endpoint is available at
http://localhost:4566/<pool-id>/.well-known/jwks.json
Cognito Example
$ POOL_ID=$(awsemu cognito-idp create-user-pool \
--pool-name my-pool \
--query 'UserPool.Id' --output text)
# Fetch the JWKS for token verification
$ curl http://localhost:4566/$POOL_ID/.well-known/jwks.json SSM Session Manager
Use the real aws CLI for this one, not awsemu: with AWS_ENDPOINT_URL set, aws ssm start-session opens a genuine interactive shell against LocalEmu -- the wire codec matches the real session-manager-plugin byte-for-byte, no LocalEmu-specific interception.
SSM Session
$ export AWS_ENDPOINT_URL=http://localhost:4566
$ aws ssm start-session --target i-345e9b5f68e616e47
root@i-345e9b5f68e616e47:/# localemu ssh is a lighter alternative: a direct docker exec into the instance's container, run from the host, no SSM protocol or key pair involved:
Alternative
$ localemu ssh i-345e9b5f68e616e47
root@i-345e9b5f68e616e47:/# Quick Reference
| aws command | awsemu equivalent | Notes |
|---|---|---|
aws s3 ls | awsemu s3 ls | Identical |
aws ec2 run-instances | awsemu ec2 run-instances | Use LocalEmu AMI IDs |
aws rds describe-db-instances | awsemu rds describe-db-instances | Endpoint is localhost |
aws ssm start-session | aws ssm start-session | Real SSM protocol -- use plain aws with AWS_ENDPOINT_URL set |
aws <anything> | awsemu <anything> | Drop-in replacement |