This file contains hidden or 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
| // updated application-stack.ts class | |
| // note the buildSanityCheckCodeBuild method | |
| import { Construct } from "constructs"; | |
| import { CfnOutput, Stage, StageProps } from "aws-cdk-lib"; | |
| import { BuildSpec, ComputeType } from "aws-cdk-lib/aws-codebuild"; | |
| import { CodeBuildStep, CodePipelineSource } from "aws-cdk-lib/pipelines"; | |
| import { DelegatedDomainStack } from "../stacks/application-stack"; |
This file contains hidden or 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
| #!/bin/bash | |
| set -e | |
| # making sure we read the NAME_SERVER variable from the CDK CFN output as an array | |
| IFS=' ' read -r -a NS_ARRAY <<< "$DELEGATED_NAME_SERVERS" | |
| # storing the name servers from the dig request as an array too | |
| DIG_RESULT=($(dig +short NS ${DELEGATED_DOMAIN_NAME})) | |
| for nsEntry in ${DIG_RESULT[@]}; | |
| do |
This file contains hidden or 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 { | |
| AwsCustomResource, | |
| AwsCustomResourcePolicy, | |
| PhysicalResourceId, | |
| } from "aws-cdk-lib/custom-resources"; | |
| import { Construct } from "constructs"; | |
| import { CfnOutput, Fn } from "aws-cdk-lib"; | |
| import { IHostedZone } from "aws-cdk-lib/aws-route53"; | |
| import { domains } from "../../constants/domains"; |
This file contains hidden or 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 { Construct } from "constructs"; | |
| import { Stage, StageProps } from "aws-cdk-lib"; | |
| import { DelegatedDomainStack } from "../stacks/application-stack"; | |
| interface DelegatedDomainPipelineStageProps extends StageProps { | |
| stage: "dev" | "prod"; | |
| } | |
| export class DelegatedDomainPipelineStage extends Stage { | |
| constructor( |
This file contains hidden or 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 { Construct } from "constructs"; | |
| import { CfnOutput, Stack, StackProps } from "aws-cdk-lib"; | |
| import { buildDelegatedDomainHostedZone } from "../services/Route53/delegatedDomainHostedZone"; | |
| import { buildDelegatedNameServerRecord } from "../services/CustomResources/delegatedNameServerRecord"; | |
| import { domains } from "../constants/domains"; | |
| interface DelegatedDomainStackProps extends StackProps { | |
| stageConfig: { | |
| stage: "dev" | "prod"; |
This file contains hidden or 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 { Construct } from "constructs"; | |
| import { | |
| Role, | |
| Effect, | |
| PolicyDocument, | |
| PolicyStatement, | |
| AccountPrincipal, | |
| CompositePrincipal, | |
| } from "aws-cdk-lib/aws-iam"; | |
| import { IHostedZone } from "aws-cdk-lib/aws-route53"; |
This file contains hidden or 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
| package main | |
| import ( | |
| "log" | |
| "os" | |
| "path/filepath" | |
| "time" | |
| "github.com/aws/aws-sdk-go/aws" | |
| "github.com/aws/aws-sdk-go/aws/session" |
This file contains hidden or 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
| exports.handler = async (event, context, callback) => { | |
| const request = event.Records[0].cf.request; | |
| request.uri = "/content" + request.uri; | |
| return callback(null, request); | |
| }; | |
This file contains hidden or 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
| func createCloudfrontDistro(s *session.Session, functionARN string) { | |
| cdnHandler := cloudfront.New(s) | |
| config := &cloudfront.CreateDistributionInput{ | |
| DistributionConfig: &cloudfront.DistributionConfig{ | |
| CallerReference: aws.String(bucketNameOrigin), | |
| Comment: aws.String(bucketNameOrigin), | |
| Enabled: aws.Bool(true), | |
| Origins: &cloudfront.Origins{ // here we tell cloudfront that we want to use a Bucket as origin | |
| Quantity: aws.Int64(1), |
This file contains hidden or 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
| package main | |
| import ( | |
| "log" | |
| "github.com/aws/aws-sdk-go/aws" | |
| "github.com/aws/aws-sdk-go/aws/session" | |
| "github.com/aws/aws-sdk-go/service/iam" | |
| "github.com/aws/aws-sdk-go/service/lambda" | |
| "github.com/aws/aws-sdk-go/service/s3" |
NewerOlder