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
| // Use Gists to store code you would like to remember later on | |
| console.log(window); // log the "window" object to the console |
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 = function(event, context) { | |
| console.log('Hello, Cloudwatch!'); | |
| context.succeed('Hello, World!'); | |
| }; |
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 { App, Stack, StackProps } from 'aws-cdk-lib'; | |
| import * as lambda from 'aws-cdk-lib/aws-lambda'; | |
| import { Construct } from 'constructs'; | |
| export class LambdaStack extends Stack { | |
| constructor(scope: Construct, id: string, props: StackProps = {}) { | |
| super(scope, id, props); | |
| new lambda.Function(this, 'ExampleFunction', { | |
| functionName: 'example-lambda', |
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
| const { AwsCdkTypeScriptApp } = require('projen'); | |
| const project = new AwsCdkTypeScriptApp({ | |
| cdkVersion: '1.95.2', | |
| defaultReleaseBranch: 'main', | |
| name: 'prod-ready-cdk', | |
| // cdkDependencies: undefined, /* Which AWS CDK modules (those that start with "@aws-cdk/") this app uses. */ | |
| // deps: [], /* Runtime dependencies of this module. */ | |
| // description: undefined, /* The description is just a string that helps people understand the purpose of the package. */ | |
| // devDeps: [], /* Build dependencies for this module. */ |
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
| const { awscdk } = require('projen'); | |
| const project = new awscdk.AwsCdkTypeScriptApp({ | |
| authorAddress: '[email protected]', | |
| authorName: 'Kemal Cagin Gulsen', | |
| cdkVersion: '2.8.0', | |
| defaultReleaseBranch: 'main', | |
| name: 'prod-ready-cdk', | |
| description: 'A CDK project for my blog posts', | |
| repositoryUrl: 'https://github.com/cagingulsen/prod-ready-cdk.git', | |
| keywords: [ |
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 * as cdk from 'aws-cdk-lib'; | |
| import { Template } from 'aws-cdk-lib/assertions'; | |
| import { LambdaStack } from '../src/main'; | |
| test('Lambda created', () => { | |
| const app = new cdk.App(); | |
| const stack = new LambdaStack(app, 'LambdaStack'); | |
| const template = Template.fromStack(stack); | |
| template.resourceCountIs('AWS::Lambda::Function', 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
| import { Stack, StackProps } from 'aws-cdk-lib'; | |
| import * as lambda from 'aws-cdk-lib/aws-lambda'; | |
| import { Construct } from 'constructs'; | |
| // example cdk app stack | |
| export class LambdaStack extends Stack { | |
| constructor(scope: Construct, id: string, props?: StackProps) { | |
| super(scope, id, props); |
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 { Stack, StackProps, Stage } from 'aws-cdk-lib'; | |
| import { CodePipeline, CodePipelineSource, ShellStep } from 'aws-cdk-lib/pipelines'; | |
| import { Construct } from 'constructs'; | |
| import { LambdaStack } from './lambda-stack'; | |
| // 3a. We define a Lambda Stage that deploys the Lambda Stack. | |
| export class LambdaStage extends Stage { | |
| constructor(scope: Construct, id: string) { | |
| super(scope, id); | |
| new LambdaStack(this, 'LambdaStack'); |
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 { App } from 'aws-cdk-lib'; | |
| import { CdkPipelineStack } from './cdk-pipeline-stack'; | |
| // for development, use account/region from cdk cli | |
| const devEnv = { | |
| account: process.env.CDK_DEFAULT_ACCOUNT, | |
| region: process.env.CDK_DEFAULT_REGION, | |
| }; | |
| const app = new App(); |
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 * as cdk from 'aws-cdk-lib'; | |
| import { Template } from 'aws-cdk-lib/assertions'; | |
| import { LambdaStack } from '../src/lambda-stack'; | |
| test('Lambda created', () => { | |
| const app = new cdk.App(); | |
| const stack = new LambdaStack(app, 'LambdaStack'); | |
| const template = Template.fromStack(stack); | |
| template.resourceCountIs('AWS::Lambda::Function', 1); |
OlderNewer