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,
});
Initializer
new CognitoToApiGatewayToLambda(scope: Construct, id: string, props: CognitoToApiGatewayToLambdaProps);
Parameters
- scope
Construct
- id
string
- props
CognitoToApiGatewayToLambdaProps
Pattern Construct Props
Name | Type | Description |
---|---|---|
existingLambdaObj? | lambda.Function |
Existing instance of Lambda Function object, if this is set then the lambdaFunctionProps is ignored. |
lambdaFunctionProps? | lambda.FunctionProps |
User provided props to override the default props for the 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.51.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 41c11be3aa2bda3eef0d1c36ec15c285a486151845fd4a98dce4d4a8cd84cd42 |
|
MD5 | 127ef734236c633e47b984b355a1995c |
|
BLAKE2b-256 | a3c917211af8beb42483ada90dfabb0ef7cd013c49e38a0032a4f213068fd499 |
Hashes for aws_solutions_constructs.aws_cognito_apigateway_lambda-1.51.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8ecedcfc0bd4a654d72869d7d979527adad8cbb6e1736f8ab66d6c7dc4613306 |
|
MD5 | 2c3467caf9a5c267bef9c8da3308f0bd |
|
BLAKE2b-256 | 42eadd37d829bda90d02f7e9cc13c26c52dbdc8822876e732d066b3980c085d7 |