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 serverless pattern - API Gateway - Lambda - Redshift Data API #2487

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

klmuthu
Copy link

@klmuthu klmuthu commented Oct 10, 2024

Issue #, if available:

Description of changes:

Patter to expose data from Redshift through API Gateway using Lambda and Redshift Data API.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@ellisms
Copy link
Contributor

ellisms commented Nov 4, 2024

Hi @klmuthu I think you are missing the cdk.json file. When deploying, I receive this error:
--app is required either in command-line, in cdk.json or in ~/.cdk.json

Also, please include a completed example-pattern.json file

@klmuthu
Copy link
Author

klmuthu commented Nov 4, 2024

Hi @ellisms I updated the readme to use --app with cdk deploy. Also, updated the readme to create python virtual environment to avoid version conflicts. I didnt create cdk.json just to keep the repo small. Let me know if this deploys now. Please note the Redshift cluster has to be created as a prerequisite and the .env should be updated with the arn. The instructions is in the readme.

@ellisms
Copy link
Contributor

ellisms commented Nov 22, 2024

Thanks @klmuthu . I'm able to deploy the solution, but when testing, I'm getting the following error in the Lambda function:
[ERROR] Runtime.ImportModuleError: Unable to import module 'redshiftapi': No module named 'redshiftapi'

@klmuthu
Copy link
Author

klmuthu commented Nov 24, 2024

Hi @ellisms, Thanks for testing. There was a copy/paste error. I fixed and tested it. Please try again.

@ellisms
Copy link
Contributor

ellisms commented Dec 2, 2024

Thanks. The function now executes, but returns this error:
"body": "{\"error\": \"FATAL: database \\\"sample-data-dev\\\" does not exist\"}"
The database does exist and I can connect via the Console.

@klmuthu
Copy link
Author

klmuthu commented Dec 9, 2024

Hey @ellisms, I believe it could be because the db name not correct. You used hyphen instead of underscore in the db name. The name should be sample_data_dev. Can you give this a try?

Copy link
Contributor

@ellisms ellisms left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Requesting a few minor changes.

apigw-lambda-redshiftdataapi/README.md Show resolved Hide resolved
apigw-lambda-redshiftdataapi/README.md Outdated Show resolved Hide resolved
apigw-lambda-redshiftdataapi/README.md Show resolved Hide resolved
apigw-lambda-redshiftdataapi/README.md Outdated Show resolved Hide resolved
@ellisms
Copy link
Contributor

ellisms commented Dec 10, 2024

Hey @ellisms, I believe it could be because the db name not correct. You used hyphen instead of underscore in the db name. The name should be sample_data_dev. Can you give this a try?

Good catch! Tested and it is working. Left a few feedback items for review/updates.

@klmuthu
Copy link
Author

klmuthu commented Dec 10, 2024

Hi @ellisms, made the changes you requested.

@ellisms
Copy link
Contributor

ellisms commented Dec 17, 2024

Thanks @klmuthu . I'll add this to the publishing queue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants