LoslegenKostenlos loslegen

Subscribing to topics

Many department directors are already receiving critical notifications.

Now Sam is ready to start subscribing City Council members.

She knows that they can be finicky, and elected officials are not known for their attention to detail or tolerance for failure.

She is nervous, but decides to start by subscribing the friendliest Council Member she knows. She got Elena Block's email and phone number.

Sam has initialized the boto3 SNS client and stored it in the sns variable.

She has also stored the topic ARN for streets_critical in the str_critical_arn variable.

Help Sam subscribe her first Council member to the streets_critical topic!

Diese Übung ist Teil des Kurses

Introduction to AWS Boto in Python

Kurs anzeigen

Anleitung zur Übung

  • Subscribe Elena's phone number to the 'streets_critical' topic.
  • Print the SMS subscription ARN.
  • Subscribe Elena's email to the 'streets_critical topic.
  • Print the email subscription ARN.

Interaktive Übung

Versuche dich an dieser Übung, indem du diesen Beispielcode vervollständigst.

# Subscribe Elena's phone number to streets_critical topic
resp_sms = sns.____(
  TopicArn = str_critical_arn, 
  ____='sms', ____="+16196777733")

# Print the SubscriptionArn
print(resp_sms['____'])

# Subscribe Elena's email to streets_critical topic.
resp_email = sns.____(
  ____ = str_critical_arn, 
  Protocol='____', ____="[email protected]")

# Print the SubscriptionArn
print(resp_email['____'])
Code bearbeiten und ausführen