Skip to content

Instantly share code, notes, and snippets.

@obxpete
Last active June 11, 2019 21:02
Show Gist options
  • Save obxpete/341785005f3fb885d4732a3a90bcebab to your computer and use it in GitHub Desktop.
Save obxpete/341785005f3fb885d4732a3a90bcebab to your computer and use it in GitHub Desktop.
AWS SNS example in ColdFusion
BasicAWSCredentials = createObject("java", 'com.amazonaws.auth.BasicAWSCredentials').init(yourAccessKey, your
secretKey);
// turn credentials into a provider object
AWSCredentialsProviderObj = createObject("java", "com.amazonaws.auth.AWSStaticCredentialsProvider").init(BasicAWSCredentials);
// create our client
AWSSNSClient = createObject("java", "com.amazonaws.services.sns.AmazonSNSClientBuilder").standard().withRegion("us-east-1").withCredentials(AWSCredentialsProviderObj).build();
// create/identify the topicArn, snsMessage and snsSubject text strings of what you want your topic to publish.
// ...
// create and populate our AWS publishRequest Object
snsSubject = "Mail Server Problems";
publishRequestObj = CreateObject('java', 'com.amazonaws.services.sns.model.PublishRequest').init();
publishRequestObj.setTopicArn(topicArn);
publishRequestObj.setMessage(snsMessage);
publishRequestObj.setSubject(snsSubject);
// fire away!
AWSSNSClient.Publish(publishRequestObj);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment