-
Notifications
You must be signed in to change notification settings - Fork 249
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat (Issue #65: aws-alb-lambda construct) #231
Conversation
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks like the basis for a pretty good construct. A couple issues around consistency with VPC handling, and a outstanding issue to resolve around how it can default to https - but might be pretty close.
|
||
new AlbToLambda(this, 'AlbToLambdaPattern', { | ||
lambdaFunctionProps: { | ||
runtime: lambda.Runtime.NODEJS_10_X, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit Pick - Nodejs 10 is no longer supported, should change to 12 or 14
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated to NODEJS_14_X
![Architecture Diagram](architecture.png) | ||
|
||
*** | ||
© Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2021
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
corrected
|:-------------|:----------------|-----------------| | ||
|existingLambdaObj?|[`lambda.Function`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-lambda.Function.html)|Existing instance of Lambda Function object, if this is set then the lambdaFunctionProps is ignored.| | ||
|lambdaFunctionProps?|[`lambda.FunctionProps`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-lambda.FunctionProps.html)|User provided props to override the default props of the newly created Lambda function.| | ||
|createDefaultListner?|`boolean`|Default value set to `true`. Creates a HTTP Listener on `port 80` and associates to the Application Load Balancer. If `certificates` property is specified, a HTTPS Listener on `port 443` is created and associated to Application Load Balancer.| |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo - Listener
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
my bad, will update it.
|lambdaFunctionProps?|[`lambda.FunctionProps`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-lambda.FunctionProps.html)|User provided props to override the default props of the newly created Lambda function.| | ||
|createDefaultListner?|`boolean`|Default value set to `true`. Creates a HTTP Listener on `port 80` and associates to the Application Load Balancer. If `certificates` property is specified, a HTTPS Listener on `port 443` is created and associated to Application Load Balancer.| | ||
|certificates?|[`elb.IListenerCertificate[]`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-elasticloadbalancingv2.IListenerCertificate.html)| List of ACM cert ARNs. Used to create a HTTPS Listener on `port 443` if `createDefaultListner` is set to `true`| | ||
|vpcProps?|[`ec2.VpcProps`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-ec2.VpcProps.html)|User provided VPC props that are used to override the default provide used for creating a new VPC. A new VPC is created if user doesn't provide existing VPC details [`elb.applicationLoadBalancerProps.vpc`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-elasticloadbalancingv2.ApplicationLoadBalancerProps.html).| |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Follow pattern of other constructs and attributes-
existingVpcObj
vpcProps
While some constructs have services that don't require a VPC have a deployVpc
attribute, this construct needs a VPC so that attribute should not be there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
point taken, elb.applicationLoadBalancerProps
has a mandatory vpc
parameter that user cannot skip. What should happen when existingVpcObj
and elb.applicationLoadBalancerProps.vpc
is passed to the construct? You are correct on the deployVpc
parameter, user cannot deploy this construct without vpc
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using Partial<> on the template will make the vpc parameter optional (we're looking at replacing | any with Partial - see a separate issue). We want clients to be able to not specify the vpc and we will create one for them like other constructs. Currently if someone sends vpcProps and existingVpcObject to a construct we toss an error and stop, we'll want to add the same type of check here.
|createDefaultListner?|`boolean`|Default value set to `true`. Creates a HTTP Listener on `port 80` and associates to the Application Load Balancer. If `certificates` property is specified, a HTTPS Listener on `port 443` is created and associated to Application Load Balancer.| | ||
|certificates?|[`elb.IListenerCertificate[]`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-elasticloadbalancingv2.IListenerCertificate.html)| List of ACM cert ARNs. Used to create a HTTPS Listener on `port 443` if `createDefaultListner` is set to `true`| | ||
|vpcProps?|[`ec2.VpcProps`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-ec2.VpcProps.html)|User provided VPC props that are used to override the default provide used for creating a new VPC. A new VPC is created if user doesn't provide existing VPC details [`elb.applicationLoadBalancerProps.vpc`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-elasticloadbalancingv2.ApplicationLoadBalancerProps.html).| | ||
|applicationLoadBalancerProps?|[`elb.ApplicationLoadBalancerProps`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-elasticloadbalancingv2.ApplicationLoadBalancerProps.html)|Optional user-provided props to override the default props for the Application Load Balancer.| |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like it should accept an existingApplicationLoadBalancerObj attribute. There will probably be times in the future where this is connected to an upstream service, such as aws-apigateway-applicationloadbalancer or aws-certificatemanager-applicationloadbalancer.
|existingLambdaObj?|[`lambda.Function`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-lambda.Function.html)|Existing instance of Lambda Function object, if this is set then the lambdaFunctionProps is ignored.| | ||
|lambdaFunctionProps?|[`lambda.FunctionProps`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-lambda.FunctionProps.html)|User provided props to override the default props of the newly created Lambda function.| | ||
|createDefaultListner?|`boolean`|Default value set to `true`. Creates a HTTP Listener on `port 80` and associates to the Application Load Balancer. If `certificates` property is specified, a HTTPS Listener on `port 443` is created and associated to Application Load Balancer.| | ||
|certificates?|[`elb.IListenerCertificate[]`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-elasticloadbalancingv2.IListenerCertificate.html)| List of ACM cert ARNs. Used to create a HTTPS Listener on `port 443` if `createDefaultListner` is set to `true`| |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We're going to need to figure out how to make it default to https. A) it's best practice, B) our internal tools will find unit tests on GitHub that use port 80 and flag them to be fixed.
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
This was covered by PR #467 |
Issue 65, if available:
Description of changes:
Architecture, Props & Properties of the construct submitted for review
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.