Skip to content

Lambda for handling redirection of Route53 records to any destination of choice.

License

Notifications You must be signed in to change notification settings

qrstuff/route30x

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

route30x

CloudFormation template for creating the AWS components for redirection to another domain, using Cloudfront and Lambda@Edge, with a custom redirection code

Usage

Prerequisite:

  1. Install and configure AWS CLI.

  2. Create S3 bucket to store the packaged code used in deployment of Lambda Edge function.

Template Deployment:

The cloudformation template can be deployed directly using cli. Two steps are required: packaging the template to upload the lambda function code and creating the stack.

aws cloudformation package --template-file ./template.yml --s3-bucket s3-bucket-name --output-template-file out.yml

aws cloudformation create-stack --stack-name checkpoint --template-body file://out.yml \
--parameters \
ParameterKey=CdnCertificateArn,ParameterValue=source-domain-wildcard-cert-arn \
ParameterKey=DestinationDomain,ParameterValue=destination-domain \
ParameterKey=ZoneName,ParameterValue=source-zone-name \
ParameterKey=ZoneSubdomain,ParameterValue=source-zone-subdomain
--capabilities CAPABILITY_IAM CAPABILITY_AUTO_EXPAND

Available Parameters

Following parameters are available for customization. Defaults can be set in the template, and can be overridden via cli as mentioned in the Template Deployment.

  CdnCertificateArn:
    Type: String
    Description: ARN of the wildcard certificate for source domain
  DestinationDomain:
    Type: String
    Description: The Domain of the destination to redirect requests
  EnableLogs:
    Type: String
    Description: Lambda@Edge creates logs in multiple locations based on traffic. Switch to enable/disable logs
    AllowedValues:
      - true
      - false
    Default: true
  StatusCode:
    Type: Number
    Description: The status code of the redirect
    AllowedValues:
      - 301
      - 302
    Default: 301
  ZoneName:
    Type: String
    Description: Source zone name
  ZoneSubdomain:
    Type: String
    Description: Source zone subdomain

License

See the LICENSE file.

Notes

From the team at QRStuff with ❤️ for automation with Cloudformation.

About

Lambda for handling redirection of Route53 records to any destination of choice.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published