自動予約受付アプリの中で、メールの転送作業が必要で、その転送設定をユーザーに勝手にしてもらいたいので、lambdaで実装する必要があった。 SNSのtopicを新規で作って、そこにsubscriptionを設定する。 import boto3 def main(param): client = boto3.client('sns') response = client.create_topic( Name=f'sendMail{param["shopId"]}' ) print(response) arn = response["TopicArn"] sns = boto3.resource('sns') topic = sns.Topic(arn) subscription = topic.subscribe( Protocol='email', Endpoint=param["mail"], ReturnSubscriptionArn=True ) def lambda_handler(event, context): try: print(event) print(event["body"]) return main(json.loads(event["body"])) except: import traceback traceback.print_exc() でき