SNS-prenumerationer

Introduktion till AWS Boto i Python

Maksim Pecherskiy

Data Engineer

Prenumerationslista

Prenumerationslista

Introduktion till AWS Boto i Python

Prenumerationslista

Prenumerationslista

Introduktion till AWS Boto i Python

Prenumerationslista

Prenumerationslista

Introduktion till AWS Boto i Python

Prenumerationslista

Prenumerationslista

Introduktion till AWS Boto i Python

Skapa en SMS-prenumeration.

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')
Introduktion till AWS Boto i Python

Skapa en SMS-prenumeration.

Skapa SMS-prenumeration

Introduktion till AWS Boto i Python

Skapa en e-postprenumeration

response = sns.subscribe(
  TopicArn = 'arn:aws:sns:us-east-1:320333787981:city_alerts', 
  Protocol='email', 
  Endpoint='[email protected]')
Introduktion till AWS Boto i Python

Skapa en e-postprenumeration

Skapa en e-postprenumeration

Introduktion till AWS Boto i Python

Skapa en e-postprenumeration

Skapa en e-postprenumeration

Bekräftad e-postadress Bekräfta e-post

Introduktion till AWS Boto i Python

Lista prenumerationer per ämne

sns.list_subscriptions_by_topic(
  TopicArn='arn:aws:sns:us-east-1:320333787981:city_alerts')
Introduktion till AWS Boto i Python

Lista prenumerationer

Lista prenumerationer

Introduktion till AWS Boto i Python

Lista prenumerationer

sns.list_subscriptions()['Subscriptions']
Introduktion till AWS Boto i Python

Ta bort prenumerationer

sns.unsubscribe(
  SubscriptionArn='arn:aws:sns:us-east-1:320333787981:city_alerts:9f2dad1d-8844-4fe8-86f7-3f627ae8420f'
)
Introduktion till AWS Boto i Python

Ta bort flera prenumerationer

Hämta prenumerationslista

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

Avsluta SMS-prenumerationer

for sub in subs:
  if sub['Protocol'] == 'sms':
    sns.unsubscribe(sub['SubscriptionArn'])
Introduktion till AWS Boto i Python

Genomgång

SMS
  • Protocol='sms'
  • Endpoint='+13122334433'
  • Status: 'confirmed'
Email
Introduktion till AWS Boto i Python

Genomgång

Skapa en prenumeration

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

Lista prenumerationer per ämne

response = sns.list_subscriptions_by_topic(
  TopicArn='arn:aws:sns:us-east-1:320333787981:city_alerts')
subs = response['Subscriptions']
Introduktion till AWS Boto i Python

Genomgång

Lista prenumerationer

sns.list_subscriptions()['Subscriptions']

Ta bort en prenumeration

sns.unsubscribe(
  SubscriptionArn='arn:aws:sns:us-east-1:320333787981:city_alerts:9f2dad1d-8844-4fe8-86f7-3f627ae8420f'
)
Introduktion till AWS Boto i Python

Nu kör vi en övning!

Introduktion till AWS Boto i Python

Preparing Video For Download...