Help us understand the problem. What is going on with this article?

1. LocalStackによるインフラ構築に向けて

Quick introduction to localstack using localstack-demo

What is LocalStack ?

LocalStack provides an easy-to-use test/mocking framework for developing Cloud applications. It spins up a testing environment on your local machine that provides the same functionality and APIs as the real AWS cloud environment.

Setting up components

conda create -n localstack python=3.5
conda activate localstack
mkdir external-master
cd external-master && git clone https://github.com/good-idea/localstack-demo.git
git clone https://github.com/localstack/localstack.git
pip install awscli

Configuring

$aws configure --profile localstack
AWS Access Key ID [None]: dummy
AWS Secret Access Key [None]: dummy
Default region name [None]: us-east-1
Default output format [None]: json
$ tree .aws
.aws
├── config
└── credentials

0 directories, 2 files
$ cd .aws
$ ls
config      credentials
$ vim credentials
$ vim config

Launching localstack container

$ cd external-master/localstack-demo 
$ TMPDIR=/private$TMPDIR \
> DATA_DIR=/tmp/localstack/data \
> SERVICES=apigateway,kinesis,dynamodb,dynamodbstreams,elasticsearch,s3,\
> lambda,sns,sqs,redshift,es,ses,route53,cloudformation,cloudwatch,\
> ssm,secretsmanager,stepfunctions,logs,sts,iam,ec2 \
> docker-compose up -d
Creating network "localstack-demo_default" with the default driver
Creating localstack_demo ... done

Creating S3-bucket

Execute bellow commands after launching localstack.

aws --endpoint-url=http://localhost:4572 s3 mb s3://demo-bucket
aws --endpoint-url=http://localhost:4572 s3api put-bucket-acl --bucket demo-bucket --acl public-read

Finally, access to http://localhost:8055 and assumed result is bellow.

スクリーンショット 2020-03-31 午前11.49.09.png

How to reproduce(Fastest)

Using pre-setup docker container, we can reproduce environment easily.

docker pull yoshinobusekiyu4docker/nova-dev-env:localstack
TMPDIR=/private$TMPDIR DATA_DIR=/tmp/localstack/data SERVICES=apigateway,kinesis,dynamodb,dynamodbstreams,elasticsearch,s3,lambda,sns,sqs,redshift,es,ses,route53,cloudformation,cloudwatch,ssm,secretsmanager,stepfunctions,logs,sts,iam,ec2 
docker run -it -p '4563-4599:4563-4599' -p 8055:8080 yoshinobusekiyu4docker/nova-dev-env:localstack /bin/bash -c "localstack start"
aws --endpoint-url=http://localhost:4572 s3 mb s3://demo-bucket
aws --endpoint-url=http://localhost:4572 s3api put-bucket-acl --bucket demo-bucket --acl public-read

References

yoshinobu-sekiyu
社内基幹システムの構築と技術開発に関する可読性の高いドキュメント作成を目的に幅広い分野で記事投稿を検討しております。コメントなど、歓迎いたします。活発な議論をお待ちしております。
https://www.yoshinobusekiyu.net/
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away