serverless-respat-cloudfront-redirect

2.0.0 • Public • Published

serverless-respat-cloudfront-redirect

Resource pattern to redirect requests at a certain domain

Usage

This package is intended for use with the serverless-respat plugin. (install/usage info).

Install:

npm install --save-dev serverless-respat-cloudfront-redirect

Add patterns to the "custom" object in your serverless config file:

"custom": {
    "serverless-respat": {
        prefix: "${self:service}-${opt:stage}",
        patterns: [
            {
                pattern: require("serverless-respat-cloudfront-redirect"),
                config: {
                    redirect_from: 'www.YOUR_DOMAIN',
                    redirect_to: 'YOUR_DOMAIN',
                    region: '${self:provider.region}',
                    acm_certificate_arn: 'CERTIFICATE_ARN'
                }
            }
        ]
    }
}

You will need to setup Route53 (or other DNS service) to point to the Cloudfront resources created

Config options

pattern_name - (string, default: "CloudfrontRedirect") A pattern name included in resource names.

redirect_from (string, REQUIRED) - The domain that you want to redirect to another domain.

redirect_to (string, REQUIRED) - The domain that you want to redirect to.

region (string, REQUIRED) - The AWS region.

acm_certificate_arn (string, REQUIRED) - The ARN of the ACM certificate to use for HTTPS.

/serverless-respat-cloudfront-redirect/

    Package Sidebar

    Install

    npm i serverless-respat-cloudfront-redirect

    Weekly Downloads

    7

    Version

    2.0.0

    License

    MIT

    Unpacked Size

    11.1 kB

    Total Files

    13

    Last publish

    Collaborators

    • traviswimer