To use the AWS SDK for Java, ensure that you have the following elements:
- A suitable Java Development Environment.
- A 3DS OUTSCALE account and access keys. For more information, see Getting Started.
- 3DS OUTSCALE credentials (access keys) set in your environment or using the shared (by the AWS CLI and other SDKs) credentials file.
Linux and Windows Configuration
- Download the SDK from https://sdk-for-java.amazonwebservices.com/latest/aws-java-sdk.zip.
- After downloading the SDK, extract the content into a local directory.
The SDK contains the following directories:
documentation– Contains the API documentation, which is also available at the following address: AWS SDK for Java Reference.
lib– Contains the SDK
samples– Contains working code samples that demonstrate how to use the SDK.
third-party– Contains third-party libraries that are used by the SDK, such as Apache commons logging, AspectJ and the Spring framework.
To use the SDK, add the full path to the
third-party directories to the dependencies in your build file, and add them to your java
to run your code.
The AWS SDK for Java comes packaged with a number of code samples that demonstrate many of the features of the SDK in build-able, runnable programs that you can study or modify to implement your own 3DS OUTSCALE solutions using the AWS SDK for Java.
If you want to run simple scripts, you can use Ant to easily build and run them from the command line.
To initialize your connector on the 3DS OUTSCALE endpoint, you need to create your EC2 connection using the following code:
Replace _REGION_NAME_ with the Region you want to use.
In this sample, we use an EC2 client to get a list of all the Availability Zones, and all instances sorted by reservation ID:
To create a VPC:
Import the following libraries:
Execute the following code: