Skip to content
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

New Construct: aws-lambda-redshift #143

Open
salunkhesl opened this issue Mar 14, 2021 · 13 comments
Open

New Construct: aws-lambda-redshift #143

salunkhesl opened this issue Mar 14, 2021 · 13 comments
Assignees
Labels
Backlog We don't have the bandwidth to support this task right now, but will consider it in the future. feature-request A feature should be added or improved

Comments

@salunkhesl
Copy link

salunkhesl commented Mar 14, 2021

Use Case

When you have Redshift Cluster provisioned in Private Subnet, you cannot load the data from S3 directly.

Proposed Solution

I propose to use Lambda Function provisioned inside private subnet to load data from S3 Bucket using S3 Event mechanism.

Please find attached Architecture diagram as well as proposed Lambda Function package.

KFS_Private_Redshift

@salunkhesl salunkhesl added feature-request A feature should be added or improved needs-triage The issue or PR still needs to be triaged labels Mar 14, 2021
@salunkhesl salunkhesl changed the title Inserting into Redshift Cluster in Private Subnet Loading from S3 into Redshift Cluster in Private Subnet Mar 14, 2021
@biffgaut
Copy link
Contributor

I believe this can be accomplished with current with the current aws-s3-lambda construct. When you specify lambdaFunctionProps for the s3-lambda construct, specify a vpc:

import { S3ToLambdaProps, S3ToLambda } from '@aws-solutions-constructs/aws-s3-lambda';

const existingVpc = Vpc.fromVpcAttributes( /* enough info to find VPC */);

new S3ToLambda(this, 'test-s3-lambda', {
    lambdaFunctionProps: {
        code: lambda.Code.fromAsset(`${__dirname}/lambda`),
        runtime: lambda.Runtime.NODEJS_12_X,
        handler: 'index.handler',
        vpc: existingVpc
    },
});

(did this off the top of my head, please excuse syntax issues) This will allow your Lambda function to access resources in the VPC.

@salunkhesl
Copy link
Author

Not sure I understand your comment. The solution I am proposing is end-to-end to allow users to load s3 data into Redshift Cluster provisioned in private subnet. Are you saying, we have this lambda construct already? I don't see that in the list.

@hnishar
Copy link
Contributor

hnishar commented Mar 15, 2021

salunkhesl@ Are you proposing the constructs will provision the Redshift resources/permissions in addition to lambda ? If so, we don't have aws-lambda-redshift construct in the library. We could then plug that with the existing aws-kinesisfirehose-s3 and aws-s3-lambda constructs to create the expected architecture you proposed.

@salunkhesl
Copy link
Author

salunkhesl@ Are you proposing the constructs will provision the Redshift resources/permissions in addition to lambda ? If so, we don't have aws-lambda-redshift construct in the library. We could then plug that with the existing aws-kinesisfirehose-s3 and aws-s3-lambda constructs to create the expected architecture you proposed.

Yes, I intend to provide E2E solution to load into RD cluster in Private subnet. We could use existing constructs or I will simply create CFN including all the components.

@biffgaut
Copy link
Contributor

An end to end solution built on other constructs or including CFN doesn't sound like a Solutions Construct. Our goal would be to publish small reusable blocks that you could use to create the end to end solution in the CDK.

Right now we have constructs to cover all of the use case except a Lambda function accessing a Redshift database - that's what Hitendra was recommending.

Check out our Design Guidelines for what makes a good Solutions Construct.

@salunkhesl
Copy link
Author

Sure, I understand now. So, it would be a aws-lambda-redshift construct to accept RS Clusters parameters and S3 URL. I have already got the Lambda function which does the job. However, it needs to be modeled to follow the Solution Constructs standards.

@biffgaut
Copy link
Contributor

Close - it would define a new Lambda function or accept an existing Lambda function, there would be no S3 aspect to it at all. Data would be read from S3 with an aws-s3-lambda pattern or perhaps an aws-lambda-s3 pattern, depending on what is triggering that activity.

This will be our first Amazon Redshift pattern - you will notice there is no discussion of common interface elements in DESIGN_GUIDELINES.md - so it will be defining how patterns interact with Amazon Redshift, which is a pretty big deal (how we interact with Lambda is pretty well defined at this point). As a first step, please write the README.md document that defines how the construct will work for us to review and collaborate on.

@biffgaut
Copy link
Contributor

Also - we don't include any business logic in constructs, so the code for the Lambda function will not be included.

@salunkhesl
Copy link
Author

Sure, I will put together README doc and share it with you for review.

@biffgaut biffgaut changed the title Loading from S3 into Redshift Cluster in Private Subnet New Construct: aws-lambda-redshift Mar 18, 2021
@salunkhesl
Copy link
Author

@hnishar , I wish to progress this however, I am not a JAVA expert to write this construct. Will I get any support for this development?

@biffgaut
Copy link
Contributor

Solutions Constructs are written in Javascript, not Java - does that change your concerns?

@salunkhesl
Copy link
Author

Am not a Java or javascript expert. Never worked with these languages.

@biffgaut
Copy link
Contributor

If you've never used Typescript, it would be very difficult to write a new Solutions Construct.

@biffgaut biffgaut removed the needs-triage The issue or PR still needs to be triaged label Nov 22, 2021
@biffgaut biffgaut reopened this Nov 22, 2021
@biffgaut biffgaut added the Backlog We don't have the bandwidth to support this task right now, but will consider it in the future. label Nov 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Backlog We don't have the bandwidth to support this task right now, but will consider it in the future. feature-request A feature should be added or improved
Projects
None yet
Development

No branches or pull requests

3 participants