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 Answer

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions