Using localstack in my docker-compose mainly to mimic S3.
I know I can create buckets, thats not the issue. What I would like to do is automatically create the buckets when I run a docker-compose up.
Is there something build in already for localstack?
DATA_DIR: Local directory for saving persistent data (currently only supported for these services: Kinesis, DynamoDB, Elasticsearch, S3)
A change that came in with this commit since version
0.10.0
.With a script in directory
./aws/buckets.sh
:Note: the
set [-/+] x
is purely there to turn on and off outputting of the commands being executed.Will produce this output:
I was been able to achieve this with Localstack with kind of "workaround":
Create expected buckets, e.g.:
s3_api_calls.json
file in the Localstack directory (by default on Linux it's/tmp/localstack/data
/tmp/localstack/data
by default) before starting the stack again2019-03-21T08:38:28:INFO:localstack.utils.persistence: Restored 2 API calls from persistent file: /tmp/localstack/data/s3_api_calls.json
the in startup log after you start Localstack again and the bucket should be available:aws --endpoint-url=http://localhost:4572 s3 ls s3://test1