How to trigger SNS topic if IAM user is created

0

I got a code at internet to send email via SES service if IAM user is created, I need to trigger my SNS if IAM user is created , can anyone please help me with this please??

Let me share the link of lambda code for ses with iam , https://vinayakpandey-7997.medium.com/get-email-notification-on-aws-iam-user-creation-aa26e8f75d65

I tried using sns and got my mail. Only lambda code differs and rest are same. I want to get the account number,date,time and name of the iam user to be sent as mail

My SNS code:

import boto3

def lambda_handler(event, context):
    sns_user=boto3.client('sns')
    response=sns_user.publish(
    TopicArn='xxxxxxxxxxxxxxx', 
    Message="iam user created",
    Subject='Iam user creation Alert !!!',)
    return

I receive message like iam user created , I want like Iam user named "NAME" has been created on "ACCOUNT_NUMBER" on "DATE" at "TIME"

Can anyone please help me to sort this out!!

1回答
0
profile pictureAWS
エキスパート
回答済み 2年前

ログインしていません。 ログイン 回答を投稿する。

優れた回答とは、質問に明確に答え、建設的なフィードバックを提供し、質問者の専門分野におけるスキルの向上を促すものです。

質問に答えるためのガイドライン

関連するコンテンツ