Skip to content

Commit

Permalink
FIXUP: Improve s3access documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
reweeden committed Oct 26, 2022
1 parent a0e0a89 commit 5fbd87a
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions docs/s3access.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand Down Expand Up @@ -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",
Expand Down

0 comments on commit 5fbd87a

Please sign in to comment.