aws / aws/aws-cdk

aws-ses: EmailIdentity dkimRecords compatibility with Route53

Open
#26,738 3 comments 5 reactions 0 assignees View on GitHub
@aws-cdk/aws-ses bug effort/medium p2
Dominant language
TypeScript
Stars
12.9k
Forks
4.6k
Avg merge
2d 3h
Merged PRs (30d)
83

Description

### Describe the bug

When setting up a new verified email identity with `new EmailIdentity`, you get back a set of dkim records that you then need to add to your hosted zone.

Unfortunately the records are not fully compatible with an IRecordSet.

### Expected Behavior

I would expect the record.name to be compatible with a new CnameRecord

### Current Behavior

The dkimRecord names don't have a full stop at the end of them which means that when CDK runs, the domain will end up being duplicated.

### Reproduction Steps

```typescript
const zone = HostedZone.fromLookup(this, 'Zone', {
domainName: 'example.com'
});
const identity = new EmailIdentity(this, 'Identity', {
dkimIdentity: DkimIdentity.easyDkim(EasyDkimSigningKeyLength.RSA_2048_BIT),
dkimSigning: true,
feedbackForwarding: true,
identity: Identity.publicHostedZone(zone),
mailFromBehaviorOnMxFailure: MailFromBehaviorOnMxFailure.REJECT_MESSAGE,
mailFromDomain: 'mail.example.com'
});

identity.dkimRecords.forEach((record, index) => {
const cnameRecord = new CnameRecord(this, `dKim_${index}`, {
domainName: record.value,
recordName: record.name,
zone: zone
});
});
```

### Possible Solution

It would be nice if the record.name would include the full stop.
The workaround is this:

```typescript

identity.dkimRecords.forEach((record, index) => {
const cnameRecord = new CnameRecord(this, `dKim_${index}`, {
domainName: record.value,
recordName: `${record.name}.`,
zone: zone
});
});
```

---

Another solution would be to have a field that returns the domain keys alone so that we could construct the record names ourselves. Or just return the record name without the domain element.

---

An alternative approach would be to enrich the EmailIdentity with a zone parameter and make it add the records itself.

### Additional Information/Context

_No response_

### CDK CLI Version

2.91.0

### Framework Version

_No response_

### Node.js Version

v20.5.0

### OS

Ubuntu

### Language

Typescript

### Language Version

Typescript 5.1.6

### Other information

_No response_

Contributor guide

Open the contributing guide

Research direction

Start with the EmailIdentity.dkimRecords entry point and the Route53 CnameRecord recordName behavior shown in the reproduction. Reproduce the duplicated-domain result, inspect the existing SES and Route53 tests, and confirm that the chosen compatibility behavior is covered by a test and produces a valid CNAME record name.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, typescript
Domain
cloud, infrastructure
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.