AWS SDK for Java
The AWS SDK for Java is a development kit for working with AWS services.

Preparation for work

  1. 1.
    Create a service account .
  2. 2.
    Assign a role to a service account .
  3. 3.
    Create a static access key .

Installation

To install the AWS SDK for JAVA, follow the instructions on the manufacturer's website.

Customization

To configure, create configuration files in your home directory and specify in them:
  • Static key in file .aws/credentials:
    1
    [default]
    2
    aws_access_key_id = <id>
    3
    aws_secret_access_key = <secretKey>
    Copied!
  • Default region in file .aws/config:
    1
    [default]
    2
    region=us-east-1
    Copied!
Use the address to access ColdStack s3.coldstack.io.

Code examples

The sample code is located in the directory aws-java-sdk/samples/AmazonS3in the archive with the SDK distribution kit.
To connect to Object Storage, replace the code in the example
1
AmazonS3 s3 = AmazonS3ClientBuilder.standard()
2
.withCredentials(new AWSStaticCredentialsProvider(credentials))
3
.withRegion("us-west-2")
4
.build();
Copied!
on the
1
AmazonS3 s3 = AmazonS3ClientBuilder.standard()
2
.withCredentials(new AWSStaticCredentialsProvider(credentials))
3
.withEndpointConfiguration(
4
new AmazonS3ClientBuilder.EndpointConfiguration(
5
"s3.coldstack.io", "us-east-1"
6
)
7
)
8
.build();
Copied!