Last active
June 11, 2019 21:02
-
-
Save obxpete/341785005f3fb885d4732a3a90bcebab to your computer and use it in GitHub Desktop.
AWS SNS example in ColdFusion
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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