Thanks to visit codestin.com
Credit goes to github.com

Skip to content

aws-ses: add grant methods to EmailIdentity #29083

@karaken12

Description

@karaken12

Describe the feature

Add a general grant method to EmailIdentity objects, as well as a more specific method for the send email action.

Use Case

When granting send email access to a lambda the grant needs to be constructed manually, including constructing the ARN for the identity. e.g.

  Grant.addToPrincipal({
    grantee,
    actions: ["ses:SendEmail"],
    resourceArns: [
      this.stack.formatArn({
        service: 'ses',
        resource: 'identity',
        resourceName: '[email protected]',
      }),
    ],
    scope: this
  })

This is dissimilar to other constructs, which generally expose a grant method and one or more convenience methods for particularly relevant groups of actions.

Proposed Solution

Implement a grant and a grantSendEmail method on EmailIdentity (and IEmailIdentity), so that the above use can be accomplished with a simple

    const emailIdentity = new EmailIdentity(this, 'Identity', {
      identity: Identity.email('[email protected]')
    });
    emailIdentity.grantSendEmail(grantee);

Other Information

No response

Acknowledgements

  • I may be able to implement this feature request
  • This feature might incur a breaking change

CDK version used

2.126.0

Environment details (OS name and version, etc.)

Ubuntu 22.04

Metadata

Metadata

Assignees

No one assigned

    Labels

    @aws-cdk/aws-sesRelated to Amazon Simple Email Serviceeffort/smallSmall work item – less than a day of effortfeature-requestA feature should be added or improved.p2

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions