https://github.com/jcoreio/mindless-route53-cloudformation
Intelligently create DNS entries an EC2 Instance or load balancer output from a CloudFormation stack
https://github.com/jcoreio/mindless-route53-cloudformation
aws cloudformation dns route53
Last synced: about 2 months ago
JSON representation
Intelligently create DNS entries an EC2 Instance or load balancer output from a CloudFormation stack
- Host: GitHub
- URL: https://github.com/jcoreio/mindless-route53-cloudformation
- Owner: jcoreio
- License: mit
- Created: 2019-07-25T22:29:01.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2026-03-25T22:20:57.000Z (3 months ago)
- Last Synced: 2026-03-26T20:04:34.207Z (3 months ago)
- Topics: aws, cloudformation, dns, route53
- Language: TypeScript
- Size: 2.21 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 9
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# mindless-route53-cloudformation
[](https://circleci.com/gh/jcoreio/mindless-route53-cloudformation)
[](https://codecov.io/gh/jcoreio/mindless-route53-cloudformation)
[](https://github.com/semantic-release/semantic-release)
[](http://commitizen.github.io/cz-cli/)
[](https://badge.fury.io/js/mindless-route53-cloudformation)
Intelligently create DNS records an EC2 Instance or load balancer output from a CloudFormation stack.
Using this command makes it easier to deal with a stack getting hosed than creating the DNS records with CloudFormation -- when something goes really wrong you can just create a new stack, and update the DNS records to point to it with this command.
- [Node.js API](#nodejs-api)
- [`upsertRecordSetsForStack(options)`](#upsertrecordsetsforstackoptions)
- [`genRecordSetsForStack(options)`](#genrecordsetsforstackoptions)
- [CLI](#cli)
- [`cfroute53 upsert`](#cfroute53-upsert)
# Node.js API
## `upsertRecordSetsForStack(options)`
Upserts DNS records to Route 53 for either an
EC2 Instance output by a CloudFormation stack, or a load balancer output by it.
If there are multiple EC2 Instances and/or load balancers output by the stack,
an error will be thrown.
### `options`
#### `awsConfig` (`AWS.ConfigurationOptions`, _optional_)
The general configuration options for AWS services, like `credentials` and `region`
#### `StackName` (`string`, _required_)
The name of the stack to generate DNS entries for.
#### `DNSName` (`string`, _required_)
The desired domain name for the DNS entries.
#### `privateOnly` (`boolean`, _optional_)
`true` if only private zone DNS records should be created, `false` if both public and private
records should be created. Defaults to `false`.
#### `TTL` (`number`, _optional_)
The time-to-live for the DNS entries (not required for load balancers)
#### `region` (`string`, _optional_)
The AWS region to use (unless you are passing instances of the API clients you'll have to pass the `region`)
#### `CloudFormation` (`AWS.CloudFormation`, _optional_)
An CloudFormation API client configured how you want.
#### `EC2` (`AWS.EC2`, _optional_)
An EC2 API client configured how you want.
#### `ELBv2` (`AWS.ELBv2`, _optional_)
An ELBv2 API client configured how you want.
#### `Route53` (`AWS.Route53`, _optional_)
An Route53 API client configured how you want.
#### `log` (`Function`, _optional_, default: `console.error`)
A logging function
#### `verbose` (`boolean`, _optional_, default: `false`)
Enables verbose `log` output
#### Returns
A `Promise` that will resolve once the upsert is complete.
## `genRecordSetsForStack(options)`
Generates the `ResourceRecordSets` to upsert to Route 53 for either an
EC2 Instance output by a CloudFormation stack, or a load balancer output by it.
If there are multiple EC2 Instances and/or load balancers output by the stack,
an error will be thrown.
### `options`
#### `awsConfig` (`AWS.ConfigurationOptions`, _optional_)
The general configuration options for AWS services, like `credentials` and `region`
#### `StackName` (`string`, _required_)
The name of the stack to generate DNS entries for.
#### `DNSName` (`string`, _required_)
The desired domain name for the DNS entries.
#### `privateOnly` (`boolean`, _optional_)
`true` if only private zone DNS records should be created, `false` if both public and private
records should be created. Defaults to `false`.
#### `TTL` (`number`, _optional_)
The time-to-live for the DNS entries (not required for load balancers)
#### `region` (`string`, _optional_)
The AWS region to use (unless you are passing instances of the API clients you'll have to pass the `region`)
#### `CloudFormation` (`AWS.CloudFormation`, _optional_)
An CloudFormation API client configured how you want.
#### `EC2` (`AWS.EC2`, _optional_)
An EC2 API client configured how you want.
#### `ELBv2` (`AWS.ELBv2`, _optional_)
An ELBv2 API client configured how you want.
#### `log` (`Function`, _optional_, default: `console.error`)
A logging function
#### `verbose` (`boolean`, _optional_, default: `false`)
Enables verbose `log` output
### Returns
A `Promise` to be resolved with an array of the following:
```
{
ResourceRecordSet: {
Name: string,
Type: 'A',
ResourceRecords?: Array<{Value: string}>,
TTL?: number,
AliasTarget?: {
DNSName: string,
EvaluateTargetHealth: boolean,
HostedZoneId: string,
},
},
PrivateZone?: ?boolean,
OutputKey?: ?string,
InstanceId?: ?string,
LoadBalancerArn?: ?string,
}
```
# CLI
## `cfroute53 upsert`
Intelligently upserts Route 53 entries for an EC2 Instance or load balancer output from a CloudFormation stack.
First it will fetch information from AWS, then display the records it plans to upsert and ask you to confirm whether to upsert them.
If there are multiple EC2 Instances and/or load balancers output by the stack, the command will error out. (In the future, it may ask you to select which you would like to upsert Route 53 entries for.)
### Usage
```
cfroute53 upsert --region [--private-only] [--ttl
### Options
```
--version Show version number [boolean]
--help Show help [boolean]
-p, --private-only only create private zone DNS records [boolean]
--ttl the time-to-live for the record [number]
-c, --comment a comment for the change [string]
--region the AWS region [string]
-q, --quiet suppress output [boolean]
-v, --verbose enable verbose output [boolean]
-y, --yes don't ask for confirmation [boolean]
```