Skip to content

(aws_ses: EmailIdentity): (EmailIdentity grantSendEmail missing permission in case there is a configuration set defined) #34402

Open
@pitayapj

Description

@pitayapj

Describe the bug

not sure if this can consider a bug. But when using EmailIdentity.grantSendEmail() in AWS CDK, the generated IAM policy does not include the ses:SendEmail and ses:SendRawEmail action with the required ConfigurationSetName condition, resulting in a failure to send emails when a configuration set is attached.

Regression Issue

  • Select this option if this issue appears to be a regression.

Last Known Working CDK Library Version

No response

Expected Behavior

Calling grantSendEmail() should grant permissions that allow sending emails with or without a configuration set. Specifically, it should include a policy allowing:

{
  "Action": "ses:SendEmail",
  "Effect": "Allow",
  "Resource": "*",
  "Condition": {
    "StringEquals": {
      "ses:ConfigurationSetName": "<your-config-set-name>"
    }
  }
}

Current Behavior

only permission for declared entity

{
        "Action": [
            "ses:SendEmail",
            "ses:SendRawEmail"
        ],
        "Resource": "arn:aws:ses:region:account:identity/example.com",
        "Effect": "Allow"
    }

Reproduction Steps

const mailConfigureSet = new ses.ConfigurationSet(this, 'mailConfigureSet', {
  configurationSetName: `default-mail-configure-set`,
  tlsPolicy: ses.ConfigurationSetTlsPolicy.REQUIRE,
});

const domainIdentity = new ses.EmailIdentity(this, 'domainIdentity', {
  identity: 'domain.com',
  configurationSet: mailConfigureSet,
  mailFromDomain: 'domain.com',
});
domainIdentity.grantSendEmail(taskDef.taskRole);

Possible Solution

No response

Additional Information/Context

No response

AWS CDK Library version (aws-cdk-lib)

2.188.0

AWS CDK CLI version

2.1010.0

Node.js Version

20

OS

macOS

Language

TypeScript

Language Version

No response

Other information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    @aws-cdk/aws-sesRelated to Amazon Simple Email ServicebugThis issue is a bug.p2

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions