Skip to content

Instantly share code, notes, and snippets.

@steveperkins
Created September 7, 2016 02:09
Show Gist options
  • Save steveperkins/71156551b0c040a14e3223d4fd916b48 to your computer and use it in GitHub Desktop.
Save steveperkins/71156551b0c040a14e3223d4fd916b48 to your computer and use it in GitHub Desktop.
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