CDK Constructs for AWS Cognito to AWS API Gateway to AWS Lambda integration
Project description
aws-cognito-apigateway-lambda module
---All classes are under active development and subject to non-backward compatible changes or removal in any future version. These are not subject to the Semantic Versioning model. This means that while you may use them, you may need to update your source code when upgrading to a newer version of this package.
Reference Documentation: | https://docs.aws.amazon.com/solutions/latest/constructs/ |
---|
Language | Package |
---|---|
Python | aws_solutions_constructs.aws_cognito_apigateway_lambda |
Typescript | @aws-solutions-constructs/aws-cognito-apigateway-lambda |
Java | software.amazon.awsconstructs.services.cognitoapigatewaylambda |
This AWS Solutions Construct implements an Amazon Cognito securing an Amazon API Gateway Lambda backed REST APIs pattern.
Here is a minimal deployable pattern definition:
const { CognitoToApiGatewayToLambda } = require('@aws-solutions-constructs/aws-cognito-apigateway-lambda');
const stack = new Stack(app, 'test-cognito-apigateway-lambda-stack');
const lambdaProps: lambda.FunctionProps = {
code: lambda.Code.asset(`${__dirname}/lambda`),
runtime: lambda.Runtime.NODEJS_12_X,
handler: 'index.handler'
};
new CognitoToApiGatewayToLambda(stack, 'test-cognito-apigateway-lambda', {
lambdaFunctionProps: lambdaProps,
deployLambda: true
});
Initializer
new CognitoToApiGatewayToLambda(scope: Construct, id: string, props: CognitoToApiGatewayToLambdaProps);
Parameters
- scope
Construct
- id
string
- props
CognitoToApiGatewayToLambdaProps
Pattern Construct Props
Name | Type | Description |
---|---|---|
deployLambda | boolean |
Whether to create a new Lambda function or use an existing Lambda function |
existingLambdaObj? | lambda.Function |
Existing instance of Lambda Function object |
lambdaFunctionProps? | lambda.FunctionProps |
Optional user provided props to override the default props for Lambda function |
apiGatewayProps? | api.LambdaRestApiProps |
Optional user provided props to override the default props for API Gateway |
cognitoUserPoolProps? | cognito.UserPoolProps |
Optional user provided props to override the default props for Cognito User Pool |
cognitoUserPoolClientProps? | cognito.UserPoolClientProps |
Optional user provided props to override the default props for Cognito User Pool Client |
Pattern Properties
Name | Type | Description |
---|---|---|
apiGateway | api.RestApi |
Returns an instance of api.RestApi created by the construct |
lambdaFunction | lambda.Function |
Returns an instance of lambda.Function created by the construct |
userPool | cognito.UserPool |
Returns an instance of cognito.UserPool created by the construct |
userPoolClient | cognito.UserPoolClient |
Returns an instance of cognito.UserPoolClient created by the construct |
Default settings
Out of the box implementation of the Construct without any override will set the following defaults:
Amazon Cognito
- Set password policy for User Pools
- Enforce the advanced security mode for User Pools
Amazon API Gateway
- Deploy an edge-optimized API endpoint
- Enable CloudWatch logging for API Gateway
- Configure least privilege access IAM role for API Gateway
- Set the default authorizationType for all API methods to IAM
AWS Lambda Function
- Configure least privilege access IAM role for Lambda function
- Enable reusing connections with Keep-Alive for NodeJs Lambda function
Architecture
© Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for aws-solutions-constructs.aws-cognito-apigateway-lambda-1.46.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9436230c45c2590984dff946e4e3412914e107c84b11ed9458adebe71100e7fc |
|
MD5 | 2c7541b832180c1efb9d384324734223 |
|
BLAKE2b-256 | dd1df45e96a28f88c5b6d5a74ebe33ad32b4f8489116c227160e04189a9fbf83 |
Hashes for aws_solutions_constructs.aws_cognito_apigateway_lambda-1.46.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 193bc925656b682bf9af43ce68ab8404f3106eed38debcf161662fd9a7278eec |
|
MD5 | c9306e8034310274f5854b699554298e |
|
BLAKE2b-256 | 411385ce87a92547c861e49470086a0ed40810ca6b35e56c0b17fa595b1912f1 |