npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@fallobst22/cdk-cross-account-route53

v0.0.17

Published

CDK Construct to allow creation of Route 53 records in a different account

Downloads

431

Readme

AWS CDK Cross Account Route53

AWS CDK Constructs that define:

  • IAM role that can be used to allow discrete Route53 Record changes
  • Cross Account Record construct to create Route53 cross account Route53 records

These constructs allow you to create Route53 records where the zone exists in a separate AWS account to the Cloudformation Stack.

Getting started

yarn add @fallobst22/cdk-cross-account-route53

First create the role in the stack for the AWS account which contains the hosted zone.

// DNS Stack
const zone = new route53.PublicHostedZone(this, 'HostedZone', {
  zoneName: 'example.com',
});

new CrossAccountRoute53Role(this, 'WebRoute53Role', {
  roleName: 'WebRoute53Role',
  assumedBy: new iam.AccountPrincipal('22222222'), // Web Stack Account
  zone,
  records: [{ domains: ['www.example.com'] }],
 });

Then in the child stack create the records

const hostedZoneId = 'Z12345'; // ID of the zone in the other account

const distribution = new cloudfront.Distribution(this, 'Distribution', {
  domainNames: ['example.com'],
});

new CrossAccountRoute53RecordSet(this, 'ARecord', {
  delegationRoleName: 'WebRoute53Role',
  delegationRoleAccount: '111111111', // The account that contains the zone and role
  hostedZoneId,
  resourceRecordSets: [{
    Name: `example.com`,
    Type: 'A',
    AliasTarget: {
      DNSName: distribution.distributionDomainName,
      HostedZoneId: 'Z2FDTNDATAQYW2', // Cloudfront Hosted Zone Id
      EvaluateTargetHealth: false,
    },
  }],
});

CrossAccountRoute53Role

Initializer

new CrossAccountRoute53Role(scope: Construct, id: string, props: CrossAccountRoute53RoleProps)

Parameters

  • scope Construct
  • id string
  • props CrossAccountRoute53RoleProps

Construct Props

| Name | Type | Description | | ---- | ---- | ----------- | | roleName | string | The role name | | assumedBy | iam.IPrincipal | The principals that are allowed to assume the role | | zone | route53.IHostedZone | The hosted zone. | | records | CrossAccountRoute53RolePropsRecord[] | The records that can be created by this role |

CrossAccountRoute53RolePropsRecords

| Name | Type | Description | | ---- | ---- | ----------- | | domainNames | string \| string[] | The names of the records that can be created or changed | | types | route53.RecordType[] | The typepsof records that can be created. Default ['A', 'AAAA'] | | actions | 'CREATE' \| 'UPSERT' \| 'DELETE' | The allowed actions. Default ['CREATE', 'UPSERT', 'DELETE'] |

CrossAccountRoute53RecordSet

Initializer

new CrossAccountRoute53RecordSet(scope: Construct, id: string, props: CrossAccountRoute53RecordSetProps)

Parameters

  • scope Construct
  • id string
  • props CrossAccountRoute53RecordSet

Construct Props

| Name | Type | Description | | ---- | ---- | ----------- | | delegationRoleName | string | The role name created in the account with the hosted zone | | delegationRoleAccount | string | The account identfier of the account with the hosted zone | | hostedZoneId | string | The hosted zoned id | | resourceRecordSets | Route53.ResourceRecordSets | The changes to be applied. These are in the same format as taken by ChangeResourceRecordSets Action |

Development Status

These constructs will stay in v0.x.x for a while, to allow easier bug fixing & breaking changes if absolutely needed. Once bugs are fixed (if any), the constructs will be published with v1 major version and will be marked as stable.

Only typescript has been tested.

Development

  • npm run build compile typescript to js
  • npm run watch watch for changes and compile
  • npm run test perform the jest unit tests