Bird
0
0

Given this Python code using boto3, what will be the output if the subscription is successful?

medium📝 Predict Output Q13 of 15
AWS - SNS and SQS
Given this Python code using boto3, what will be the output if the subscription is successful?
import boto3
sns = boto3.client('sns')
response = sns.subscribe(
    TopicArn='arn:aws:sns:us-east-1:123456789012:MyTopic',
    Protocol='email',
    Endpoint='user@example.com'
)
print(response['SubscriptionArn'])
A'pending confirmation' string indicating subscription needs confirmation
BAn error message about missing permissions
CThe ARN of the SNS topic
DThe ARN of the new subscription if confirmed
Step-by-Step Solution
Solution:
  1. Step 1: Understand SNS email subscription behavior

    Email subscriptions require the user to confirm by clicking a link. Until then, the SubscriptionArn is 'pending confirmation'.
  2. Step 2: Analyze the printed output

    The code prints response['SubscriptionArn'], which will be 'pending confirmation' until user confirms.
  3. Final Answer:

    'pending confirmation' string indicating subscription needs confirmation -> Option A
  4. Quick Check:

    Email subscription = pending confirmation [OK]
Quick Trick: Email subscriptions show 'pending confirmation' until user confirms [OK]
Common Mistakes:
MISTAKES
  • Expecting immediate subscription ARN without confirmation
  • Confusing topic ARN with subscription ARN
  • Assuming no confirmation needed for email protocol

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More AWS Quizzes