SNS-Abonnements

Einführung in AWS Boto mit Python

Maksim Pecherskiy

Data Engineer

Abonnementliste

Abonnementliste

Einführung in AWS Boto mit Python

Abonnementliste

Abonnementliste

Einführung in AWS Boto mit Python

Abonnementliste

Abonnementliste

Einführung in AWS Boto mit Python

Abonnementliste

Abonnementliste

Einführung in AWS Boto mit Python

Eine SMS-Benachrichtigung abonnieren

sns = boto3.client('sns', 
                   region_name='us-east-1', 
                   aws_access_key_id=AWS_KEY_ID,                   
                   aws_secret_access_key=AWS_SECRET)
response = sns.subscribe(
  TopicArn = 'arn:aws:sns:us-east-1:320333787981:city_alerts',
  Protocol = 'SMS',
  Endpoint = '+13125551123')
Einführung in AWS Boto mit Python

SMS-Abonnement erstellen

SMS-Abonnement erstellen

Einführung in AWS Boto mit Python

Ein E-Mail-Abonnement erstellen

response = sns.subscribe(
  TopicArn = 'arn:aws:sns:us-east-1:320333787981:city_alerts', 
  Protocol='email', 
  Endpoint='[email protected]')
Einführung in AWS Boto mit Python

Ein E-Mail-Abonnement erstellen

E-Mail-Abonnement erstellen

Einführung in AWS Boto mit Python

Ein E-Mail-Abonnement erstellen

E-Mail-Abonnement erstellen

Bestätigte E-Mail-Adresse E-Mail bestätigen

Einführung in AWS Boto mit Python

Abonnements nach Topic auflisten

sns.list_subscriptions_by_topic(
  TopicArn='arn:aws:sns:us-east-1:320333787981:city_alerts')
Einführung in AWS Boto mit Python

Abonnements auflisten

Abonnements auflisten

Einführung in AWS Boto mit Python

Abonnements auflisten

sns.list_subscriptions()['Subscriptions']
Einführung in AWS Boto mit Python

Abonnements löschen

sns.unsubscribe(
  SubscriptionArn='arn:aws:sns:us-east-1:320333787981:city_alerts:9f2dad1d-8844-4fe8-86f7-3f627ae8420f'
)
Einführung in AWS Boto mit Python

Mehrere Abonnements löschen

Abonnementliste abrufen

response = sns.list_subscriptions_by_topic(
  TopicArn='arn:aws:sns:us-east-1:320333787981:city_alerts')
subs = response['Subscriptions']

SMS-Abonnements abbestellen

for sub in subs:
  if sub['Protocol'] == 'sms':
    sns.unsubscribe(sub['SubscriptionArn'])
Einführung in AWS Boto mit Python

Rückblick

SMS
  • Protocol='sms'
  • Endpoint='+13122334433'
  • Status: 'confirmed'
E-Mail
Einführung in AWS Boto mit Python

Rückblick

Ein Abonnement erstellen

response = sns.subscribe(
  TopicArn = 'arn:aws:sns:us-east-1:320333787981:city_alerts',
  Protocol = 'sms',
  Endpoint = '+13125551123')

Abonnements nach Topic auflisten

response = sns.list_subscriptions_by_topic(
  TopicArn='arn:aws:sns:us-east-1:320333787981:city_alerts')
subs = response['Subscriptions']
Einführung in AWS Boto mit Python

Rückblick

Abonnements auflisten

sns.list_subscriptions()['Subscriptions']

Ein Abonnement löschen

sns.unsubscribe(
  SubscriptionArn='arn:aws:sns:us-east-1:320333787981:city_alerts:9f2dad1d-8844-4fe8-86f7-3f627ae8420f'
)
Einführung in AWS Boto mit Python

Lass uns üben!

Einführung in AWS Boto mit Python

Preparing Video For Download...