Skip to content

gary-alway/localstack-demo

Repository files navigation

localstack with serverless demo

This is somewhat of a contrived application that demonstrates how localstack can be used in conjunction with serverless and cloudformation for local development of AWS components:

Environment setup

yarn local:up

architecture

# tear down localstack docker container
yarn local:down

Testing

yarn dev

yarn test

query API

# clear S3, SQS and Dynamo
yarn purge

Localstack command samples

SNS

awslocal sns list-topics

awslocal sns publish --topic-arn "arn:aws:sns:us-east-1:000000000000:image-created" --message 'test image created message'

awslocal sns publish --topic-arn "arn:aws:sns:us-east-1:000000000000:image-updated" --message 'test image updated message'

SQS

awslocal sqs list-queues

awslocal sqs send-message --message-body="{}" --queue-url "http://localhost:4566/queue/test"

awslocal sqs receive-message --queue-url "http://localhost:4566/queue/test" --max-number-of-messages 10

awslocal sqs delete-message --queue-url "http://localhost:4566/queue/test" --receipt-handle <handle>

awslocal sqs send-message --message-body="test-dlq" --queue-url "http://localhost:4566/queue/imports"

awslocal sqs receive-message --queue-url "http://localhost:4566/queue/imports-dlq" --max-number-of-messages 10

S3

awslocal s3api list-buckets

awslocal s3 cp test/test-dynamo-record.json s3://images

awslocal s3api list-objects --bucket images

Bucket content is available here, using the image hash as the slug to get a specific image, e.g.

Dynamo DB

awslocal dynamodb list-tables

awslocal dynamodb put-item \
 --table-name images \
 --item file://test/test-dynamo-record.json \
 --return-consumed-capacity TOTAL \
 --return-item-collection-metrics SIZE

awslocal dynamodb scan --table-name images

awslocal dynamodbstreams list-streams

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published