- 31 Jan 2023
- 2 Minutes to read
- DarkLight
Amazon SNS
- Updated on 31 Jan 2023
- 2 Minutes to read
- DarkLight
Amazon Simple Notification Service (SNS) is a messaging service offered as a part of Amazon Web Services. It can be used for both application-to-application and application-to-person communications.
Amazon SNS can serve as a "communication bus" for the following AWS services:
- Amazon CloudWatch: Alarms
- Amazon GuardDuty: Findings, and additional sources of alerts and events.
1. Create an Amazon SNS integration in Torq
Perform these steps in Torq.
- Go to the Integrations page, locate the Amazon SNS card, and click Add.
- Enter a meaningful name for the integration. We recommend that the integration name identify what events it will be sending.
- Click Add.
- Copy the integration webhook URL - it will serve as the endpoint when creating a subscription in AWS.
2. Create a new SNS topic (optional)
This step is optional. You should only create a new SNS topic if the integration will receive events that are not already being sent to an existing SNS topic. You should skip this step if you already have a topic that contains (or will contain) the relevant events.
You can create the topic using the AWS console or the AWS CLI.
Using the AWS console
- In the AWS console navigate to Amazon SNS / Topics.
- Click Create topic.
- Select Standard type and enter a meaningful name, such as torq-integration-topic .
- Click Create topic.
Using the AWS CLI
Run the following command.
aws sns create-topic --name torq-integration-topic
The result should look similar to the following:
{
"ResponseMetadata": {
"RequestId": "1469e8d7-1642-564e-b85d-a19b4b341f83"
},
"TopicArn": "arn:aws:sns:us-west-2:123456789012:torq-integration-topic"
}
3. Subscribe Torq to an SNS topic
This step configures how SNS messages will be sent to the HTTPS Endpoint defined in the Amazon SNS Integration.
You can subscribe to the SNS topic using the AWS console or the AWS CLI.
Using the AWS console
- In the AWS Console navigate to Amazon SNS / Subscriptions.
- Click Create subscription.
- Select the Topic ARN either for the topic you created in the previous step or for an already created topic that contains the relevant messages.
- From the Protocol dropdown menu select HTTPS.
- In the Endpoint field paste the endpoint of the Amazon SNS integration you configured in Torq.
- Click Create subscription.
Using the AWS CLI
Run the following command:
aws sns subscribe \
--topic-arn <ARN Topic> \
--protocol HTTPS \
--notification-endpoint <endpoint of the _Amazon SNS_ integration you configured in Torq> \
--attributes RawMessageDelivery=true
The result should look like this:
{
"SubscriptionArn": "pending confirmation"
}
4. Confirm the subscription
After you subscribe your endpoint, Amazon SNS will send a subscription confirmation message to the endpoint. This message appears in the Event Log for the webhook.
- In Torq, navigate to the Activity Log. You can optionally filter the log by the source, in this case, whatever name you gave the Amazon SNS integration. Click the event matching the message sent from Amazon SNS. It will look similar to the following.
- Click the link under SubscribeURL.
This will confirm the subscription and all future events matching the topics you defined will be sent to the webhook.