Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
package org.lightside.demo;
import com.amazonaws.auth.AWSStaticCredentialsProvider;
import com.amazonaws.auth.BasicAWSCredentials;
import com.amazonaws.regions.Regions;
import com.amazonaws.services.iotdata.AWSIotData;
import com.amazonaws.services.iotdata.AWSIotDataClientBuilder;
import com.amazonaws.services.simpleemail.AmazonSimpleEmailServiceClient;
import com.amazonaws.services.sns.AmazonSNSClient;
public class AwsClientFactoryDemo {
private static final String CLIENT_TOKEN = "your IAM user's token here";
private static final String CLIENT_SECRET = "your IAM user's secret token here";
private static final BasicAWSCredentials CREDENTIALS = new BasicAWSCredentials(CLIENT_TOKEN, CLIENT_SECRET);
private static AmazonSNSClient snsClient = null;
public static AmazonSNSClient getSnsClient() {
if(null == snsClient) {
snsClient = new AmazonSNSClient(CREDENTIALS)
.withRegion(Regions.US_WEST_2);
}
return snsClient;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment