-
Notifications
You must be signed in to change notification settings - Fork 6
Add a function URL enabling public access to Lambda function #209
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
base: master
Are you sure you want to change the base?
Changes from all commits
c975888
70d0c55
d925dd9
8674411
66d1f86
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -83,6 +83,14 @@ There are two options to do this: | |
|
|
||
| Accessing the SnowEx data | ||
| ----------------- | ||
|
|
||
| There are two ways to access SnowEx data through this library: | ||
|
|
||
| 1. **Direct Database Access** (requires database credentials) | ||
| 2. **Lambda Client** (requires AWS credentials for serverless access) | ||
|
|
||
| Direct Database Access | ||
| ======================= | ||
| A programmatic API has been created for fast and standard | ||
| access to Point and Layer data. There are two examples_ covering the | ||
| features and usage of the api. See the specific api_ documentation for | ||
|
|
@@ -99,6 +107,49 @@ detailed description. | |
| ) | ||
| print(df.head()) | ||
|
|
||
| Lambda Client (Serverless Access) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we help the user out here and indicate this as the preferred one? |
||
| ================================== | ||
| For users who prefer serverless access or don't want to manage database | ||
| connections, we provide an AWS Lambda-based client with a public Function URL. | ||
|
|
||
| **No credentials required!** The Lambda function handles all database | ||
| credentials internally via AWS Secrets Manager. | ||
|
|
||
| **Requirements:** | ||
|
|
||
| * No AWS credentials needed - public HTTP endpoint | ||
| * No database credentials needed - handled by Lambda | ||
| * requests library installed (included with snowexsql) | ||
|
|
||
| **Usage:** | ||
|
|
||
| .. code-block:: python | ||
|
|
||
| from snowexsql.lambda_client import SnowExLambdaClient | ||
| from datetime import date | ||
|
|
||
| # Initialize client - no credentials needed! | ||
| client = SnowExLambdaClient() | ||
|
|
||
| # Get measurement classes | ||
| classes = client.get_measurement_classes() | ||
| PointMeasurements = classes['PointMeasurements'] | ||
|
|
||
| # Query data (same API as direct access) | ||
| df = PointMeasurements.from_filter( | ||
| date=date(2020, 5, 28), instrument='camera' | ||
| ) | ||
|
|
||
| See the `lambda_example notebook <https://snowexsql.readthedocs.io/en/latest/gallery/lambda_example.html>`_ | ||
| for complete examples. | ||
|
|
||
| **How It Works:** | ||
|
|
||
| - Public Lambda Function URL allows anyone to query the database | ||
| - Database credentials stored securely in AWS Secrets Manager (never exposed) | ||
| - Database only accepts connections from Lambda (not public internet) | ||
| - All queries go through Lambda for security and monitoring | ||
|
|
||
|
|
||
| Getting help | ||
| ------------ | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -28,6 +28,8 @@ dependencies = [ | |
| "rasterio <2.0", | ||
| "SQLAlchemy <3.0", | ||
| "boto3 <2.0", | ||
| "requests >=2.31.0", | ||
| "urllib3 >=2.0", | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do these also need to be restricted to |
||
| ] | ||
|
|
||
|
|
||
|
|
||
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.
Should this now say “no credentials” with the function URL?