In this exercise you are going to apply 3 Musketeers for running AWS commands. You will need to follow the 4 patterns presented in class.
Consider that the developer does not have AWS installed in his machine.
- Create
docker-compose.yaml
with a service that builds based on a Dockerfile:- Use the
Dockerfile
provided here, it containsmake
andaws
installed.
- Use the
- Create a
Makefile
with the following Make targets:create_bucket
: it will create a S3 bucketdelete_bucket
: it will list objects for a bucket- This
Makefile
will have a variable for the bucket nameexport BUCKET_NAME ?= test
- Create the scripts for the AWS commands:
scripts/create_bucket.sh
- will create a bucket with name in the variable BUCKET_NAME -aws s3 mb s3://${BUCKET_NAME}
scripts/delete_bucket.sh
- will list objects in the bucket -aws s3 rb s3://${BUCKET_NAME}
- Create a
.env
file and pass the attributeenv_file
in your docker-compose.yaml service. This .env file will have:- AWS_ACCESS_KEY_ID
- AWS_SECRET_ACCESS_KEY
- AWS_REGION=ap-southeast-2
- BUCKET_NAME
- Also, remember that the Docker container will try to run a make target so the local code needs to be visible inside the container (map a volume for it in your docker-compose.yaml)
- Configure AWS credentials for the CLI using environment variables
- Call the Make target
make create_bucket
passing the BUCKET_NAME variable - Call the Make target
make delete_bucket
passing the BUCKET_NAME
You should be able to create and delete buckets using the full 3 Musketeers approach.
- README.md: based on the ANSWER.md file with a link to the following files from your answer:
- Dockerfile (copied from here)
- with the instructions to build your docker image
- scripts/create_bucket.sh
- scripts/delete_bucket.sh
- .env
- Makefile
- with the three targets mentioned above, updated with the 4 patterns from 3 Musketeers seen in class.
- output.md
- Explanation and outputs of the following commands:
make create_bucket
,make delete_bucket
- Explanation and outputs of the following commands:
- Dockerfile (copied from here)