0
0
AWScloud~10 mins

SNS topics and subscriptions in AWS - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to create an SNS topic named 'MyTopic'.

AWS
resource "aws_sns_topic" "example" {
  name = "[1]"
}
Drag options to blanks, or click blank then click option'
ATopicName
BMyTopic
CSNSExample
DExampleTopic
Attempts:
3 left
💡 Hint
Common Mistakes
Using a different topic name than requested.
Leaving the name blank.
2fill in blank
medium

Complete the code to subscribe an email endpoint to the SNS topic.

AWS
resource "aws_sns_topic_subscription" "example" {
  topic_arn = aws_sns_topic.example.arn
  protocol  = "[1]"
  endpoint  = "user@example.com"
}
Drag options to blanks, or click blank then click option'
Aemail
Blambda
Csms
Dhttp
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'sms' or 'http' instead of 'email' for email endpoints.
Misspelling the protocol string.
3fill in blank
hard

Fix the error in the subscription code by completing the missing attribute.

AWS
resource "aws_sns_topic_subscription" "example" {
  topic_arn = aws_sns_topic.example.arn
  protocol  = "email"
  [1] = "user@example.com"
}
Drag options to blanks, or click blank then click option'
Atarget
Baddress
Curl
Dendpoint
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'url' or 'address' instead of 'endpoint'.
Omitting the endpoint attribute.
4fill in blank
hard

Fill both blanks to create an SNS topic with display name and subscribe an SMS endpoint.

AWS
resource "aws_sns_topic" "example" {
  name         = "[1]"
  display_name = "[2]"
}

resource "aws_sns_topic_subscription" "sms_sub" {
  topic_arn = aws_sns_topic.example.arn
  protocol  = "sms"
  endpoint  = "+1234567890"
}
Drag options to blanks, or click blank then click option'
AAlertsTopic
BMyTopic
CAlerts
DNotification
Attempts:
3 left
💡 Hint
Common Mistakes
Swapping name and display_name values.
Using incorrect names.
5fill in blank
hard

Fill all three blanks to create an SNS topic, subscribe an HTTP endpoint, and set the subscription's raw message delivery.

AWS
resource "aws_sns_topic" "example" {
  name = "[1]"
}

resource "aws_sns_topic_subscription" "http_sub" {
  topic_arn            = aws_sns_topic.example.arn
  protocol             = "[2]"
  endpoint             = "https://example.com/notify"
  raw_message_delivery = [3]
}
Drag options to blanks, or click blank then click option'
AWebhookTopic
Bhttp
Ctrue
Dfalse
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'false' for raw_message_delivery when true is needed.
Using wrong protocol like 'email' for HTTP endpoint.