8.17.2 • Published 2 months ago

@cpmech/az-cdk v8.17.2

Weekly downloads
141
License
MIT
Repository
github
Last release
2 months ago

Constructs and stacks for the AmaZon-AWS CDK

az-cdk implements some constructs for use with the fantastic AWS CDK tool.

Installation

npm install @cpmech/az-cdk

Examples

Website

Creates Route53, S3, and Cloudfront resources, in addition of taking care of all permissions.

NOTE: The hostedZoneId and certificateArn are optional - in this case, a new Route53 zone is created.

import { App, Stack } from '@aws-cdk/core';
import { WebsiteConstruct } from '@cpmech/az-cdk';

const app = new App();

const stack = new Stack(app, 'WebsiteStack');

new WebsiteConstruct(stack, 'Website', {
  domain: 'mydomain.com',
  comment: 'My Awesome Website',
  hostedZoneId: '<hosted-zone-id>',
  certificateArn: '<arn-of-certificate>',
});

Cognito

Creates a Cognito user pool, in addition of taking care of all permissions.

import { App, Stack } from '@aws-cdk/core';
import { CognitoConstruct } from '@cpmech/az-cdk';

const app = new App();

const stack = new Stack(app, 'CognitoStack');

new CognitoConstruct(stack, 'Cognito', {
  emailSendingAccount: 'info@mydomain.com',
  poolName: 'my-users',
});

Receive Emails (SES, SNS, and SQS)

Creates S{E,N,Q}S resources to receive emails, in addition of taking care of all permissions.

import { App, Stack } from '@aws-cdk/core';
import { ReceiveEmailSQSConstruct } from '@cpmech/az-cdk';

const app = new App();

const stack = new Stack(app, 'EmailsStack');

new ReceiveEmailSQSConstruct(stack, 'EmailSQS', {
  emails: ['admin@mydomain.com', 'tester@mydomain.com'],
});

Lambda and API Gateway (service)

Creates lambda functions and the API Gateway, in addition of taking care of all permissions.

NOTE: customDomain is optional.

import { App, Stack } from '@aws-cdk/core';
import { LambdaApiConstruct, LambdaLayersConstruct } from '@cpmech/az-cdk';

const app = new App();

const stack = new Stack(app, 'ServiceStack');

new LambdaApiConstruct(stack, 'API', {
  gatewayName: 'API',
  cognitoId: '<cognito-user-pool-id>',
  lambdas: [
    {
      filenameKey: 'index',
      handlerName: 'handler',
      httpMethods: ['GET', 'POST'],
      route: 'helloworld',
    },
  ],
  layers: new LambdaLayersConstruct(stack, 'Layers'),
  customDomain: {
    prefixedDomain: 'api.mydomain.com',
    certificateArn: '<arn-of-certificate>',
    r53HostedZoneId: '<hosted-zone-id>',
  },
  dirDist: 'dist',
});

Pipeline for Website

Creates a CodePipeline to update a website.

import { App } from '@aws-cdk/core';
import { WebsitePipelineStack, ssmSecret } from '@cpmech/az-cdk';

const app = new App();

new WebsitePipelineStack(app, 'WebsitePipelineStack', {
  githubRepo: '<github-repo>',
  githubUser: '<github-user>',
  githubSecret: ssmSecret('<ssm-param-github>'),
  websiteBucketName: 'mydomain.com-website',
  cloudfrontDistributionId: '<cloudfront-id>',
  assetsDir: 'public',
  notificationEmails: ['my@email.com'],
});

Pipeline for Lambda (service)

Creates a CodePipeline to update a service stack.

import { App, Stack } from '@aws-cdk/core';
import { PipelineStack, ssmSecret } from '@cpmech/az-cdk';

const app = new App();

new PipelineStack(app, 'PipelineStack', {
  githubRepo: '<github-repo>',
  githubUser: '<github-user>',
  githubSecret: ssmSecret('<ssm-param-github>'),
  services: ['apigateway', 'lambda'],
  notificationEmails: ['my@email.com'],
});
8.17.2

2 months ago

8.17.1

9 months ago

8.17.0

9 months ago

8.16.0

3 years ago

8.15.0

3 years ago

8.14.0

3 years ago

8.13.0

3 years ago

8.12.0

3 years ago

8.12.1

3 years ago

8.11.0

3 years ago

8.10.0

3 years ago

8.9.0

3 years ago

8.6.0

3 years ago

8.7.0

3 years ago

8.8.0

3 years ago

8.5.0

3 years ago

8.4.0

3 years ago

8.3.0

3 years ago

8.2.0

3 years ago

8.1.0

3 years ago

8.0.0

3 years ago

7.39.0

3 years ago

7.38.1

3 years ago

7.38.0

3 years ago

7.37.0

4 years ago

7.36.1

4 years ago

7.36.0

4 years ago

7.35.2

4 years ago

7.35.1

4 years ago

7.35.0

4 years ago

7.34.0

4 years ago

7.33.0

4 years ago

7.32.0

4 years ago

7.31.0

4 years ago

7.30.0

4 years ago

7.29.0

4 years ago

7.28.0

4 years ago

7.27.0

4 years ago

7.26.0

4 years ago

7.25.0

4 years ago

7.24.0

4 years ago

7.23.0

4 years ago

7.22.0

4 years ago

7.21.0

4 years ago

7.20.0

4 years ago

7.19.0

4 years ago

7.18.0

4 years ago

7.17.0

4 years ago

7.16.0

4 years ago

7.15.0

4 years ago

7.14.0

4 years ago

7.13.0

4 years ago

7.12.0

4 years ago

7.11.0

4 years ago

7.10.0

4 years ago

7.9.0

4 years ago

7.8.0

4 years ago

7.6.0

4 years ago

7.7.0

4 years ago

7.5.0

4 years ago

7.4.1

4 years ago

7.4.0

4 years ago

7.3.0

4 years ago

7.2.0

4 years ago

7.1.0

4 years ago

7.0.0

4 years ago

6.20.0

4 years ago

6.19.0

4 years ago

6.18.0

4 years ago

6.17.0

4 years ago

6.17.1

4 years ago

6.15.0

4 years ago

6.14.0

4 years ago

6.13.0

4 years ago

6.12.0

4 years ago

6.11.0

4 years ago

6.9.0

4 years ago

6.8.0

4 years ago

6.7.0

4 years ago

6.6.0

4 years ago

6.5.0

4 years ago

6.3.0

4 years ago

6.4.0

4 years ago

6.1.0

4 years ago

6.1.1

4 years ago

6.2.0

4 years ago

6.0.0

4 years ago

5.23.0

4 years ago

5.22.0

4 years ago

5.20.0

4 years ago

5.21.0

4 years ago

5.19.0

4 years ago

5.18.0

4 years ago

5.17.0

4 years ago

5.15.0

4 years ago

5.16.0

4 years ago

5.14.0

4 years ago

5.13.0

4 years ago

5.12.0

4 years ago

5.11.0

4 years ago

5.10.0

4 years ago

5.9.0

4 years ago

5.8.0

4 years ago

5.7.0

4 years ago

5.6.0

4 years ago

5.5.0

4 years ago

5.4.0

4 years ago

5.3.0

4 years ago

5.2.0

4 years ago

5.1.0

4 years ago

5.0.0

4 years ago

4.25.0

4 years ago

4.24.0

4 years ago

4.21.1

4 years ago

4.21.0

4 years ago

4.20.0

4 years ago

4.19.0

4 years ago

4.18.0

4 years ago

4.17.0

4 years ago

4.15.0

4 years ago

4.14.0

4 years ago

4.13.0

4 years ago

4.12.0

4 years ago

4.11.0

5 years ago

4.10.0

5 years ago

4.9.0

5 years ago

4.8.0

5 years ago

4.7.0

5 years ago

4.6.1

5 years ago

4.6.0

5 years ago

4.5.0

5 years ago

4.4.0

5 years ago

4.3.0

5 years ago

4.1.0

5 years ago

4.0.0

5 years ago

3.12.0

5 years ago

3.10.0

5 years ago

3.9.0

5 years ago

3.8.0

5 years ago

3.7.0

5 years ago

3.6.1

5 years ago

3.6.0

5 years ago

3.5.0

5 years ago

3.4.1

5 years ago

3.4.0

5 years ago

3.3.2

5 years ago

3.3.1

5 years ago

3.3.0

5 years ago

3.2.1

5 years ago

3.2.0

5 years ago

3.1.0

5 years ago

3.0.0

5 years ago

2.10.1

5 years ago

2.10.0

5 years ago

2.9.1

5 years ago

2.9.0

5 years ago

2.8.0

5 years ago

2.7.0

5 years ago

2.6.1

5 years ago

2.6.0

5 years ago

2.5.0

5 years ago

2.4.4

5 years ago

2.4.3

5 years ago

2.4.2

5 years ago

2.4.1

5 years ago

2.4.0

5 years ago

2.3.2

5 years ago

2.3.1

5 years ago

2.3.0

5 years ago

2.2.0

5 years ago

2.1.13

5 years ago

2.1.12

5 years ago

2.1.11

5 years ago

2.1.10

5 years ago

2.1.9

5 years ago

2.1.8

5 years ago

2.1.7

5 years ago

2.1.6

5 years ago

2.1.5

5 years ago

2.1.4

5 years ago

2.1.3

5 years ago

2.1.2

5 years ago

2.1.1

5 years ago

2.1.0

5 years ago

1.3.2

5 years ago

1.3.1

5 years ago

1.3.0

5 years ago

1.2.3

5 years ago

1.2.2

5 years ago

1.2.1

5 years ago

1.2.0

5 years ago

1.1.0

5 years ago

1.0.0

5 years ago

0.5.3

5 years ago

0.5.2

5 years ago

0.5.1

5 years ago

0.5.0

5 years ago

0.4.4

5 years ago

0.4.3

5 years ago

0.4.2

5 years ago

0.4.1

5 years ago

0.4.0

5 years ago

0.3.0

5 years ago

0.2.1

5 years ago

0.2.0

5 years ago

0.1.1

5 years ago

0.1.0

5 years ago