在Lambda函数中从AWS SES发送电子邮件时访问被拒绝 [英] Access Denied while sending email from AWS SES in Lambda function

查看:505
本文介绍了在Lambda函数中从AWS SES发送电子邮件时访问被拒绝的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在AWS Lambda函数中使用Amazon SES发送电子邮件,为此,我面临以下错误.

I am trying to send an email using Amazon SES in AWS Lambda function, For this i am facing the following error.

AccessDenied:资源arn:aws:sts::XXXXX:assumed-role/lambda_basic_execution/awslambda_XXXX' is not authorized to perform ses:SendEmail'

AccessDenied: User arn:aws:sts::XXXXX:assumed-role/lambda_basic_execution/awslambda_XXXX' is not authorized to performses:SendEmail' on resource `arn:aws:ses:us-west-2:XXX:identity/example@example.com'

我已授予

"IAS角色的"ses:SendEmail","ses:SendRawEmail".

"ses:SendEmail", "ses:SendRawEmail" for the IAM role.

推荐答案

所以,我也遇到了Rakesh解释过的相同问题,但是他不明白他说的要这样做的步骤,这里是带有步骤的详细解释

So, I was also having the same problem which Rakesh has explained but couldn't understand the steps he was saying to do so here is a detailed explanation with steps.

您需要执行以下操作 安全性,身份和法规遵从性-> IAM->角色->选择您的lambda函数->然后编辑策略->在JSON中打开它并添加以下部分

You need to do the following Security, Identity & Compliance -> IAM -> Roles -> select your lambda function -> then edit policy -> open it in JSON and add the below part

{
  "Effect":"Allow",
  "Action":[
    "ses:SendEmail",
    "ses:SendRawEmail"
  ],
  "Resource":"*"
}

或者您可以根据需要从这些策略示例中进行操作

or you can do as per requirement from these policy examples https://docs.aws.amazon.com/ses/latest/DeveloperGuide/control-user-access.html#iam-and-ses-examples-email-sending-actions also, you need to verify the email address first so don't forget that. Hope this helps everyone.

这篇关于在Lambda函数中从AWS SES发送电子邮件时访问被拒绝的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆