Lambdaなどで処理を実行した後に簡易的にSNSメールを用いて通知を行う場合が多々あるので、 テンプレート用に作りました。
import boto3
def send_mail(region_name, topic_arn, subject, message):
sns = boto3.resource('sns', region_name)
try:
response = sns.Topic(topic_arn).publish(
Subject=subject,
Message=message
)
print("response={}".format(response))
except Exception as e:
print("********** exception occurs **************")
print("type: " + str(type(e)))
print("message: " + e.message)


