tanitall / s3-domain-parking

Configurable lightweight domain parking page with Google Analytics support.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

AWS S3 Domain Parking

This project creates an S3 bucket that is configured to host a static website with CORS enabled. All you have to do is to configure the project and create a CNAME record in your domain.

Prerequisites

  1. AWS free tier account;
  2. Programmatic access to AWS account with the following permissions: s3:PutObject, s3:PutBucketWebsite, s3:GetBucketWebsite, s3:GetBucketCORS, s3:PutBucketAcl, s3:CreateBucket, s3:ListBucket, s3:PutBucketCORS, s3:GetBucketAcl, s3:HeadBucket, s3:PutObjectAcl.
  3. Access to Domain management (Namecheap, GoDaddy, etc.);
  4. Google Analytics account (optional).
  5. Node.js and npm installed.

Limitations

Because of the way S3 static website hosting works, it is not possible to create a CNAME record of the top level of your domain. Therefore, you can park (subdomain).domain.com (e.g www.domain.com). Having said that, some DNS providers (Namecheap) allow redirecting the top level domain to a subdomain. See question here.

Configuration

Before your parking page is ready, please make sure to configure it for your needs. All configuration lays inside config.json:

{
    "trackingId": "",
    "domainName": "",
    "innerHtml": "Coming soon...",
    "accessKeyId": "",
    "secretAccessKey": "",
    "awsRegion": "us-east-1",
    "showRibbon": true|false
}

All fields are mandatory unless stated otherwise.

  • trackingId: Google Analytics Tracking ID (see below how to obtain). This is property is optional - if not defined, tracking will be deactivated.
  • domainName: The domain name which will be shown on your parking page.
  • innerHtml: The HTML/text which will appear under the domain name.
  • accessKeyId: AWS Access Key ID (see below how to obtain).
  • secretAccessKey: AWS Secret Key (see below how to obtain).
  • awsRegion: AWS region. Defaults to us-east-1 and doesn't really matter for our use-case, still required by aws-sdk.
  • showRibbon: Display the ribbon at the top of the page (thanks to fork-me-on-github-retina-ribbons!).

Obtaining Google Analytics Tracking ID

Instructions

Deploy to S3

To deploy your parking page, open terminal and run:

  1. npm install
  2. npm run deploy
  3. When the process completes, create a CNAME record, as shown on the screen.

You're all set! Visit your domain to verify the landing page works. Please note that it might take some time for some DNS service providers to update your domain records.

About

Configurable lightweight domain parking page with Google Analytics support.

License:MIT License


Languages

Language:TypeScript 61.0%Language:JavaScript 29.4%Language:HTML 8.9%Language:CSS 0.8%