aws / aws/aws-cdk

ses: Config set L2 construct

Open
#20,375 0 comments 0 reactions 0 assignees View on GitHub
@aws-cdk/aws-ses effort/medium feature-request p3
Dominant language
TypeScript
Stars
12.9k
Forks
4.6k
Avg merge
1d 19h
Merged PRs (30d)
74

Description

### Describe the feature

I would love to have an L2 construct for SES ConfigSet that allows:

- to create config set with dynamic name
- allows to grant permission to send emails using code similar to one below
- allows to link all supported SES event destinations (supported via CFN, other like SNS via custom resource)
- allows to obtain name and ARN of the config set quite easily

### Use Case

- configuring multiple variations of sending emails via config sets with different configuration and destinations
- code held in CDK has better chance to be error-resistant
- less custom AWS resources in own codebase

### Proposed Solution

Code for granting permissions to send emails via config-set:
```python
def grant_send_email(
self,
*,
grantee: t.Union[iam.Policy, iam.ManagedPolicy],
from_addresses: t.Optional[t.Sequence[str]] = None,
recipients: t.Optional[t.Sequence[str]] = None,
) -> None:
policy.add_statements(
iam.PolicyStatement(
sid='SendEmailsViaConfigSet',
actions=[
'ses:SendEmail',
'ses:SendRawEmail',
],
resources=[
cdk.Stack.of(self).format_arn(
service='ses',
resource='identity',
resource_name='*',
arn_format=cdk.ArnFormat.SLASH_RESOURCE_NAME,
),
cdk.Stack.of(self).format_arn(
service='ses',
resource='configuration-set',
resource_name=self.config_set_name,
arn_format=cdk.ArnFormat.SLASH_RESOURCE_NAME,
),
],
conditions={
'ForAllValues:StringLike': {
'ses:Recipients': list(recipients),
} if recipients else None,
'StringEquals': {
'ses:FromAddress': list(from_address),
} if from_address else None,
},
),
)

```

### Other Information

None

### Acknowledgements

- [X] I may be able to implement this feature request
- [ ] This feature might incur a breaking change

### CDK version used

2.24.1

### Environment details (OS name and version, etc.)

MacOS BigSur

Contributor guide

Open the contributing guide

Research direction

Start by locating the SES ConfigSet implementation and its CloudFormation support, then compare how existing L2 constructs expose names, ARNs, grants, and event destinations. Done means supporting dynamic names, send permissions, supported destinations including the proposed SNS custom-resource path, and easy access to the config set name and ARN.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, typescript
Domain
cloud, infrastructure
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.