Docs / awsemu vs AWS CLI

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

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

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

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

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

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