Aan de slagGa gratis aan de slag

Creating multiple topics

Sam suddenly became a black sheep because she is responsible for an onslaught of text messages and notifications to department directors.

No one will go to lunch with her anymore!

To fix this, she decided to create a general topic per department for routine notifications, and a critical topic for urgent notifications.

Managers will subscribe only to critical notifications, while supervisors can monitor general notifications.

For example, the streets department would have 'streets_general' and 'streets_critical' as topics.

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

Help Sam create a tiered topic structure… and have friends again!

Deze oefening maakt deel uit van de cursus

Introduction to AWS Boto in Python

Cursus bekijken

Oefeninstructies

  • For every department, create a general topic.
  • For every department, create a critical topic.
  • Print all the topics created in SNS

Praktische interactieve oefening

Probeer deze oefening eens door deze voorbeeldcode in te vullen.

# Create list of departments
departments = ['trash', 'streets', 'water']

for dept in departments:
  	# For every department, create a general topic
    sns.____(____="{}_general".format(dept))
    
    # For every department, create a critical topic
    sns.____(____="{}_critical".format(____))

# Print all the topics in SNS
response = sns.____()
print(response['Topics'])
Code bewerken en uitvoeren