标签:poi follow 用户 service sage ESS xxxxxx 最好 存在
背景:参考链接:https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/sns.html
AWS新建用户,并授权sns:Publish,sns:Subscribe,最好再加限定来源IP,沿用旧Access keys可能存在异常,可以新建Access keys
代码:
#!/usr/bin/python
import boto3
import sys
client = boto3.client(
"sns",
aws_access_key_id=‘XXXXXXXx‘,
aws_secret_access_key=‘XXXXXXX‘,
region_name=‘XXXX‘
)
topic_arn = ‘arn:aws:sns:XXXXXXX‘
client.subscribe(
TopicArn=topic_arn,
Protocol=‘sms‘ ,
Endpoint=sys.argv[1]
)
client.publish(Message=sys.argv[2], TopicArn=topic_arn)
标签:poi follow 用户 service sage ESS xxxxxx 最好 存在
原文地址:https://blog.51cto.com/johnzheng/2416759