{"id":16811014,"url":"https://github.com/johnf/cdk-cross-account-route53","last_synced_at":"2025-07-31T22:08:34.854Z","repository":{"id":65153145,"uuid":"584582032","full_name":"johnf/cdk-cross-account-route53","owner":"johnf","description":"CDK Construct to allow creation of Route 53 records in a different account","archived":false,"fork":false,"pushed_at":"2024-09-03T22:13:37.000Z","size":391,"stargazers_count":19,"open_issues_count":4,"forks_count":3,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-27T17:34:41.422Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/johnf.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-01-03T01:25:09.000Z","updated_at":"2024-12-31T12:05:50.000Z","dependencies_parsed_at":"2024-01-15T06:45:35.755Z","dependency_job_id":"e18f3b5b-a961-4af2-972e-5c187afc4172","html_url":"https://github.com/johnf/cdk-cross-account-route53","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johnf%2Fcdk-cross-account-route53","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johnf%2Fcdk-cross-account-route53/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johnf%2Fcdk-cross-account-route53/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johnf%2Fcdk-cross-account-route53/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/johnf","download_url":"https://codeload.github.com/johnf/cdk-cross-account-route53/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243174734,"owners_count":20248326,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-13T10:17:24.460Z","updated_at":"2025-03-17T03:31:33.098Z","avatar_url":"https://github.com/johnf.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# AWS CDK Cross Account Route53\n\nAWS [CDK](https://aws.amazon.com/cdk/) Constructs that define:\n- IAM role that can be used to allow discrete Route53 Record changes\n- Cross Account Record construct to create Route53 cross account Route53 records\n\nThese constructs allow you to create Route53 records where the zone exists in a separate AWS account to the Cloudformation Stack.\n\n## Getting started\n\n```shell\nyarn add cdk-cross-account-route53\n```\n\nFirst create the role in the stack for the AWS account which contains the hosted zone.\n\n```typescript\n// DNS Stack\nconst zone = new route53.PublicHostedZone(this, 'HostedZone', {\n  zoneName: 'example.com',\n});\n\nnew CrossAccountRoute53Role(this, 'WebRoute53Role', {\n  roleName: 'WebRoute53Role',\n  assumedBy: new iam.AccountPrincipal('22222222'), // Web Stack Account\n  zone,\n  records: [{ domainNames: 'www.example.com' }],\n });\n```\n\nThen in the child stack create the records\n\n```typescript\nconst hostedZoneId = 'Z12345'; // ID of the zone in the other account\n\nconst distribution = new cloudfront.Distribution(this, 'Distribution', {\n  domainNames: ['example.com'],\n});\n\nnew CrossAccountRoute53RecordSet(this, 'ARecord', {\n  delegationRoleName: 'WebRoute53Role',\n  delegationRoleAccount: '111111111', // The account that contains the zone and role\n  hostedZoneId,\n  resourceRecordSets: [{\n    Name: `example.com`,\n    Type: 'A',\n    AliasTarget: {\n      DNSName: distribution.distributionDomainName,\n      HostedZoneId: 'Z2FDTNDATAQYW2', // Cloudfront Hosted Zone Id\n      EvaluateTargetHealth: false,\n    },\n  }],\n});\n```\n\nIf you want to use wildcard matching on domains you can choose to not autonormalise the domains and pass in a wildcard e.g.\n\n```typescript\nnew CrossAccountRoute53Role(this, 'WebRoute53Role', {\n  roleName: 'WebRoute53Role',\n  assumedBy: new iam.AccountPrincipal('22222222'), // Web Stack Account\n  zone,\n  records: [{ domainNames: '*.example.com' }],\n  normaliseDomains: false,\n });\n```\n\n## CrossAccountRoute53Role\n\n### Initializer\n```typescript\nnew CrossAccountRoute53Role(scope: Construct, id: string, props: CrossAccountRoute53RoleProps)\n```\n\n*Parameters*\n\n* **scope** Construct\n* **id** string\n* **props** CrossAccountRoute53RoleProps\n\n### Construct Props\n\n| Name             | Type                                   | Description |\n| ----             | ----                                   | ----------- |\n| roleName         | `string`                               | The role name |\n| assumedBy        | `iam.IPrincipal`                       | The principals that are allowed to assume the role |\n| zone             | `route53.IHostedZone`                  | The hosted zone. |\n| records          | `CrossAccountRoute53RolePropsRecord[]` | The records that can be created by this role |\n| normaliseDomains | `boolean`                              | Normalise the domains names as per AWS documentation (default: true) |\n\n### CrossAccountRoute53RolePropsRecords\n\n| Name        | Type                               | Description |\n| ----        | ----                               | ----------- |\n| domainNames | `string \\| string[]`               | The names of the records that can be created or changed |\n| types       | `route53.RecordType[]`             | The typepsof records that can be created. Default `['A', 'AAAA']` |\n| actions     | `'CREATE' \\| 'UPSERT' \\| 'DELETE'` | The allowed actions. Default `['CREATE', 'UPSERT', 'DELETE']` |\n\n## CrossAccountRoute53RecordSet\n\n### Initializer\n```typescript\nnew CrossAccountRoute53RecordSet(scope: Construct, id: string, props: CrossAccountRoute53RecordSetProps)\n```\n\n*Parameters*\n\n* **scope** Construct\n* **id** string\n* **props** CrossAccountRoute53RecordSet\n\n### Construct Props\n\n| Name        | Type                                   | Description |\n| ----        | ----                                   | ----------- |\n| delegationRoleName    | `string`                     | The role name created in the account with the hosted zone |\n| delegationRoleAccount | `string`                     | The account identfier of the account with the hosted zone |\n| hostedZoneId          | `string`                     | The hosted zoned id |\n| resourceRecordSets    | `Route53.ResourceRecordSets` | The changes to be applied. These are in the same format as taken by [ChangeResourceRecordSets Action](https://docs.aws.amazon.com/Route53/latest/APIReference/API_ResourceRecordSet.html) |\n\n## Development Status\n\nThese constructs will stay in `v0.x.x` for a while, to allow easier bug fixing \u0026 breaking changes _if absolutely needed_.\nOnce bugs are fixed (if any), the constructs will be published with `v1` major version and will be marked as stable.\n\nOnly typescript has been tested.\n\n## Development\n\n* `npm run build`   compile typescript to js\n* `npm run watch`   watch for changes and compile\n* `npm run test`    perform the jest unit tests\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjohnf%2Fcdk-cross-account-route53","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjohnf%2Fcdk-cross-account-route53","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjohnf%2Fcdk-cross-account-route53/lists"}