Updates on aws-core

U

To build an EC2Client, you can use the support method buildAmazonEC2(). The EC2Client is initialized with configuration from the application.properties files on the classpath.

@UtilityClass
public class EC2Client {

    public static AmazonEC2 buildAmazonEC2() {

        final Properties properties = Config.getProperties();
        return AmazonEC2ClientBuilder.standard()
                .withCredentials(new ProfileCredentialsProvider(properties.getProperty("config")))
                .withRegion(properties.getProperty("region"))
                .build();
    }
}

Next class is the S3Client class. This class can be used to create an AmazonS3 Client object.

@UtilityClass
public class S3Client {

    public static AmazonS3 buildAmazonS3() {

        final Properties properties = Config.getProperties();
        return AmazonS3ClientBuilder.standard()
                .withCredentials(new ProfileCredentialsProvider(properties.getProperty("profile")))
                .withRegion(properties.getProperty("region"))
                .build();
    }
}

About the author

Add comment

By gerben

Meest recente berichten

Recente reacties

Archief

Categorie├źn

Meta