| Environment | |
|---|---|
| Services | Amazon S3, DynamoDB |
| Categories | JAVA AWS SDK |
This repository's purpose is to support the LocalStack documentation on using the platform with Java applications. The two examples are using the Java AWS SDK v1 and v2. The AWS SDK for Java 2.x is a major rewrite of the 1.x code base built on top of Java 8+. It includes many updates, such as improved consistency, ease of use, and strongly enforced immutability. Please refer to the AWS guide on how to migrate your code to version 2.x from 1.x.
- Maven 3.8.5 & Java 17
- LocalStack
- Docker - for running LocalStack
- AWS CLI and awslocal
- Start LocalStack:
- use the
localstack startcommand - or you can use this minimal
docker composeconfiguration file
- use the
- For each module (
java-sdk-v1andjava-sdk-v2) there are shell scripts that need to be executed to create the necessary resources (S3 bucket and DynamoDB table). These files are the same for both projects, if you choose to try both SDKs, you only need to run them once. - Run the respective services using the
mvn exec:java -Dexec.mainClass=command. For example, to run the SDK v1 DynamoDB actions you would usemvn exec:java -Dexec.mainClass="v1.dynamodb.DynamoDBService". You can, of course, use your preferred IDE's built-in tools to run themainfunction.