BaşlayınÜcretsiz Başlayın

Sending multi-level alerts

Sam is going to prototype her alerting system with the water data and the water department.

According to the Director, when there are over 100 alerts outstanding, that's considered critical. If there are over 300, that's extreme.

She has done some calculations and came up with a vcounts dictionary, that contains current requests for 'water', 'streets' and 'trash'.

She has also already created the boto3 SNS client and stored it in the sns variable.

In this exercise, you will help Sam publish a critical and an extreme alert based on the thresholds!

Bu egzersiz

Introduction to AWS Boto in Python

kursunun bir parçasıdır
Kursu Görüntüle

Egzersiz talimatları

  • If there are over 100 water violations, publish to 'water_critical' topic.
  • If there are over 300 water violations, publish to 'water_extreme' topic.

Uygulamalı interaktif egzersiz

Bu örnek kodu tamamlayarak bu egzersizi bitirin.

if vcounts['water'] > 100:
  # If over 100 water violations, publish to water_critical
  sns.____(
    ____ = dept_arns['water_critical'],
    ____ = "{} water issues".format(vcounts['water']),
    ____ = "Help fix water violations NOW!")

if vcounts['water'] > 300:
  # If over 300 violations, publish to water_extreme
  sns.____(
    TopicArn = dept_arns['water_extreme'],
    ____ = "{} violations! RUN!".format(vcounts['water']),
    Subject = "THIS IS BAD.  WE ARE FLOODING!")
Kodu Düzenle ve Çalıştır