From 5fbd87a13980a5210e10fe3d179d8fa35dedcdaf Mon Sep 17 00:00:00 2001 From: Rohan Weeden Date: Wed, 26 Oct 2022 10:04:21 -0800 Subject: [PATCH] FIXUP: Improve s3access documentation --- docs/s3access.md | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/docs/s3access.md b/docs/s3access.md index cf787c0a4..ad5d6d425 100644 --- a/docs/s3access.md +++ b/docs/s3access.md @@ -69,8 +69,9 @@ for more information on how to use your temporary credentials. This example lambda function uses [EDL Bearer Tokens](https://urs.earthdata.nasa.gov/documentation/for_users/user_token) -to obtain s3 credentials and stream an object from one bucket to another. The lambda -execution role will need permissions to upload to the destination bucket. +to obtain s3 credentials and stream an object from one bucket to another. The +lambda execution role will need `s3:PutObject` permissions on the destination +bucket. ```python @@ -81,10 +82,10 @@ import urllib.request def lambda_handler(event, context): # Get temporary download credentials - tea_url = event["TeaUrl"] + tea_url = event["CredentialsEndpoint"] bearer_token = event["BearerToken"] req = urllib.request.Request( - url=f"https://{tea_url}/s3credentials", + url=tea_url, headers={"Authorization": f"Bearer {bearer_token}"} ) with urllib.request.urlopen(req) as f: @@ -116,7 +117,7 @@ The example can be invoked with an event payload as follows: ```json { - "TeaUrl": "https://your-tea-host/", + "CredentialsEndpoint": "https://your-tea-host/s3credentials", "BearerToken": "your bearer token", "Source": { "Bucket": "S3 bucket name from CMR link",