A simple example of configuring and using an AWS S3 client in a Bootique app.
Different Git branches contain example code for different versions of Bootique:
To build and run the project, ensure you have the following installed on your machine:
- Docker
- Java 11 or newer
- Maven
- Access to an S3 bucket on AWS (for testing)
and then follow these steps:
git clone [email protected]:bootique-examples/bootique-aws-examples.git
cd bootique-aws-examples
Run the following command to build the code, run the tests and package the app:
mvn clean package
The following command prints a help message with supported options:
java -jar target/bootique-aws-examples-3.0.jar
Get an Amazon account that you can play with. Take note of the access and secret keys. Copy config.sample.yml
file
to config.yml
. Put both keys in and the Bucket default region in config.yml
. (Make sure the region matches the
bucket location). To list the bucket contents run the --list
command:
java -jar target/bootique-aws-examples-3.0.jar -c config.yml -l -b mybucket
To store some text in a file in a bucket, run --send-text-to-s3
command:
java -jar target/bootique-aws-examples-3.0.jar -c config.yml -s \
-b mybucket -t "hello aws" -p 'somefolder/myfile.txt'
You can rerun the list command again to check that the file got created.