@makemydeal/cdk-network-stack

1.153.1 • Public • Published

cdk-network-stack

This stack will allow you to create a HostedZone and Certificate so you can have a custom domain name for use in API Gateway, CloudFront or anywhere else.

Stacks

Stack Description
NetworkStack Allow for creation of a HostedZone and Certificate for a custom domain name.

NetworkStack Properties

| Property | Required | Type | Description | --- | --- | --- | applicationName | Yes | string | Name of the application and used as a prefix for all lambda names | environmentName | Yes | string | The logical environment (dev, qa, etc) | domainName | Yes | string | The full domain name (test-dev.accelerate.dealer.com for example) | env | No | cdk.Environment | The environment needed for this work. This is important to set the same as other stacks so you can use the public properties of the stack

Public "Output" Properties

| Property | Type | Description | --- | --- | certificate | ICertificate | Reference to the created Certificate | hostedZone | IHostedZone | Reference to the created Hosted Zone | domainName | string | The full domain name (test-dev.accelerate.dealer.com for example)

Managers

Managers are used to have a consolidated object that will control the CICD and Build process. This allows the same object to be passed to the CICD and APP setups. They allow for custom actions to be run during the IAC Setup, the Environment Setup, and when creating the stack. These managers will be passed to the CICD process.

Each stack above has a corresponding manager:

  • NetworkStackManager

Creating HostedZones and Certificates

There are a couple manual steps to do when creating a HostedZone and Certificate. These have to happen the first time as you run the pipeline, but won't have to happen again.

DNS Validation of Certificate

AWS Certificate Manager uses DNS Validation of the certificate. Here are instructions on how to do that: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-certificatemanager-certificate.html

HostedZone NS records

Depending on the domain you select, you may need to go to the HostedZone in the account that is managing the nameserver and add NS records there. For instance, accelerate.dealer.com is in awsmmd account. Follow these steps:

  • After the HostedZone is created in the account (while the pipeline is still running if possible), you can go to the NS record and copy the value. It should be 4 nameservers.
  • Go to the account that owns the hosted zone
  • Open the hosted zone, and add a new record
  • Add a NS record with the record name being your domain test.accelerate.dealer.com for instance, and for the value, take the NS values you copied in step 1.

Usage

import { NetworkStack } from '@makemydeal/cdk-network-stack';

const networkStack = networkManager.CreateStack(app, {
    domainName, // the full domain you wish to create
    environmentName, // environment name like dev, qa, etc
    env // AWS account/region
});

Readme

Keywords

Package Sidebar

Install

npm i @makemydeal/cdk-network-stack

Weekly Downloads

3

Version

1.153.1

License

ISC

Unpacked Size

377 kB

Total Files

16

Last publish

Collaborators

  • mmd-devops