Created
February 24, 2021 12:13
-
-
Save apoorvmote/3adbdadb77963a07b9651f43c50328e0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { HostedZone } from '@aws-cdk/aws-route53'; | |
import { HttpsRedirect } from '@aws-cdk/aws-route53-patterns'; | |
import * as cdk from '@aws-cdk/core'; | |
export class HttpsRedirectStack extends cdk.Stack { | |
constructor(scope: cdk.Construct, id: string, props?: cdk.StackProps) { | |
super(scope, id, props); | |
// The code that defines your stack goes here | |
const hostedZone = HostedZone.fromHostedZoneAttributes(this, 'HostedZoneWithAttrs', { | |
hostedZoneId: 'myZoneId', | |
zoneName: 'example.com' | |
}) | |
new HttpsRedirect(this, 'wwwToNonWww', { | |
recordNames: ['www.example.com'], | |
targetDomain: 'example.com', | |
zone: hostedZone | |
}) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment