Browse the Repo

file-type-icon.circleci
file-type-iconexamples
file-type-iconmodules
file-type-iconattach-eni
file-type-iconpersistent-ebs-volume
file-type-iconroute53-helpers
file-type-iconbin
file-type-iconREADME.md
file-type-iconinstall.sh
file-type-iconsingle-server
file-type-icontest
file-type-icon.gitignore
file-type-iconCODEOWNERS
file-type-iconLICENSE.txt
file-type-iconREADME.md

Browse the Repo

file-type-icon.circleci
file-type-iconexamples
file-type-iconmodules
file-type-iconattach-eni
file-type-iconpersistent-ebs-volume
file-type-iconroute53-helpers
file-type-iconbin
file-type-iconREADME.md
file-type-iconinstall.sh
file-type-iconsingle-server
file-type-icontest
file-type-icon.gitignore
file-type-iconCODEOWNERS
file-type-iconLICENSE.txt
file-type-iconREADME.md
Single EC2 Instance

Single EC2 Instance

Run a single EC2 instance for stateless or stateful apps. Supports IAM roles, EBS volumes, ENIs, and EIPs.

Code Preview

Preview the Code

mobile file icon

README.md

down

Route 53 Helpers

This folder contains helper scripts for working with Amazon's DNS Service, Route 53. The helpers are:

  • add-dns-a-record: A script that can be run on an EC2 instance to add a DNS A record pointing to the instance's IP address.

Check out the route53-helpers example for how to use these scripts with Terraform.

Installing the helpers

You can install the helpers using the Gruntwork Installer:

gruntwork-install --module-name "route53-helpers" --repo "https://github.com/gruntwork-io/module-server" --tag "0.0.3"

Using the add-dns-a-record helper

The add-dns-a-record script has the following prerequisites:

  1. It must be run on an EC2 instance
  2. The EC2 instance must have an IAM role with permissions to modify Route 53 entries (see below)
  3. The EC2 instance must have the AWS CLI and jq installed

To run the script, simply pass it the AWS region, the id of the hosted zone where the DNS entry should be added, and the hostname to use for the DNS entry:

add-dns-a-record --aws-region us-east-1 --hosted-zone-id ASDF123456 --hostname foo.my-company.com

Run add-dns-a-record --help to see all available options.

IAM Permissions

Here is an example of an IAM policy your EC2 instance needs attached to its IAM role to run these scripts:

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "",
      "Action": "route53:ChangeResourceRecordSets",
      "Effect": "Allow",
      "Resource": "arn:aws:route53:::hostedzone/<ID_OF_HOSTED_ZONE>"
    }
  ]
}

Check out the route53-helpers example to see what this looks like in action.

Questions? Ask away.

We're here to talk about our services, answer any questions, give advice, or just to chat.

Ready to hand off the Gruntwork?