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 - • The SSH port for an instance is returned in the
localemu:ssh-porttag
EC2 Example
$ awsemu ec2 run-instances \
--image-id ami-ubuntu-22.04 \
--instance-type t2.micro \
--count 1
# SSH port is in the tags
$ awsemu ec2 describe-instances \
--query 'Reservations[].Instances[].Tags[?Key==`localemu:ssh-port`].Value' 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
awsemu ssm start-session is intercepted by LocalEmu. Instead of connecting through the real SSM agent, it runs docker exec to open an interactive shell inside the EC2 instance container.
SSM Session
# Opens an interactive shell inside the EC2 container
$ awsemu ssm start-session --target i-345e9b5f68e616e47
root@i-345e9b5f68e616e47:/# localemu ssh is an alternative that works the same way:
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 | awsemu ssm start-session | Runs docker exec |
aws <anything> | awsemu <anything> | Drop-in replacement |