Bird
0
0

You run this Python code to subscribe an HTTPS endpoint to an SNS topic but receive an error:

medium📝 Debug Q7 of 15
AWS - SNS and SQS
You run this Python code to subscribe an HTTPS endpoint to an SNS topic but receive an error:
sns_client.subscribe(TopicArn='arn:aws:sns:us-east-1:123456789012:MyTopic', Protocol='https', Endpoint='http://example.com')

What is the cause of the error?
AThe Endpoint URL uses 'http://' but the protocol is 'https', causing a mismatch.
BSNS does not support HTTPS protocol for subscriptions.
CThe TopicArn format is incorrect and causes the error.
DThe Endpoint URL must be an IP address, not a domain name.
Step-by-Step Solution
Solution:
  1. Step 1: Check protocol and endpoint URL consistency

    The protocol parameter is set to 'https', but the Endpoint URL starts with 'http://', which is inconsistent.
  2. Step 2: Understand SNS subscription requirements

    SNS requires the Endpoint URL to match the protocol specified. For 'https' protocol, the endpoint must start with 'https://'.
  3. Final Answer:

    The Endpoint URL uses 'http://' but the protocol is 'https', causing a mismatch. -> Option A
  4. Quick Check:

    Protocol and endpoint URL scheme must match [OK]
Quick Trick: Ensure Endpoint URL scheme matches the Protocol parameter [OK]
Common Mistakes:
MISTAKES
  • Assuming SNS does not support HTTPS protocol
  • Ignoring mismatch between protocol and endpoint URL scheme
  • Incorrect TopicArn format causing confusion

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More AWS Quizzes