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
npm install -g aws-cdk |
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
npm install | |
npm run watch |
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
const layer = new lambda.LayerVersion(this, 'deno-layer', { | |
code: lambda.Code.fromAsset('src/layer'), | |
compatibleRuntimes: [lambda.Runtime.PROVIDED], | |
license: 'Apache-2.0', | |
description: 'A layer that enables Deno to run in AWS Lambda', | |
}); |
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
const name = new lambda.Function(this, 'NameHandler', { | |
runtime: lambda.Runtime.PROVIDED, | |
code: lambda.Code.fromAsset('src/program'), | |
handler: 'name.handler', | |
layers: layer, | |
}) |
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
new apigw.LambdaRestApi(this, 'Deno-Endpoint', { | |
handler: name | |
}); |
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 { | |
APIGatewayProxyEvent, | |
APIGatewayProxyResult, | |
Context | |
} from "https://deno.land/x/lambda/mod.ts"; | |
export async function handler( | |
event: APIGatewayProxyEvent, | |
context: Context | |
): Promise<APIGatewayProxyResult> { |
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
#!/usr/bin/env node | |
import * as cdk from '@aws-cdk/core'; | |
import { CdkOneStack } from '../lib/cdk-one-stack'; | |
const app = new cdk.App(); | |
new CdkOneStack(app, 'CdkOneStack'); // <- Stack name> |
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
# make a new folder for the project | |
mkdir bucket.website.com | |
# cd to the folder | |
cd bucket.website.com | |
# Initialise a cdk app | |
cdk init app --language typescript | |
# install the 3 additional modules we will need | |
npm install @aws-cdk/aws-s3 --save-dev | |
npm install @aws-cdk/aws-s3-deployment --save-dev | |
npm install @aws-cdk/aws-route53 --save-dev |
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
# Create a folder for the Program, this is my convention the program may have more parts | |
# for now it's just static so create just those folders | |
mkdir -p Program/static | |
# Populate the index.html file with some content | |
echo "S3 Hosting with CDK" > Program/static/index.html |
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
//Create the public S3 bucket | |
const publicAssets = new s3.Bucket(this, 'example-qr', { | |
bucketName: 'example.{you-domain}', | |
publicReadAccess: true, | |
removalPolicy: cdk.RemovalPolicy.DESTROY, | |
websiteIndexDocument: 'index.html', | |
}); |
OlderNewer