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

Use AWS SDK To Browse Archive #17

Open
eddiesarevalo opened this issue Nov 15, 2023 · 11 comments
Open

Use AWS SDK To Browse Archive #17

eddiesarevalo opened this issue Nov 15, 2023 · 11 comments
Assignees
Labels
i&t.skip Skip I&T of this task/ticket icebox task

Comments

@eddiesarevalo
Copy link
Member

Use the AWS SDK to create a vite project that can browse our s3 bucket.

Amazon example:
https://docs.aws.amazon.com/sdk-for-javascript/v3/developer-guide/javascript_s3_code_examples.html
https://github.com/awsdocs/aws-doc-sdk-examples/tree/main/javascriptv3/example_code/web/s3/list-objects

S3 client API
https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/s3/

Cognito set up is required. Need SA support for this.

@eddiesarevalo eddiesarevalo self-assigned this Nov 15, 2023
@eddiesarevalo
Copy link
Member Author

eddiesarevalo commented Nov 15, 2023

To make a request to aws using the sdk there is this sample code. Need cognito:

const client = new S3Client({
      region: "us-east-1",
      // Unless you have a public bucket, you'll need access to a private bucket.
      // One way to do this is to create an Amazon Cognito identity pool, attach a role to the pool,
      // and grant the role access to the 's3:GetObject' action.
      //
      // You'll also need to configure the CORS settings on the bucket to allow traffic from
      // this example site. Here's an example configuration that allows all origins. Don't
      // do this in production.
      //[
      //  {
      //    "AllowedHeaders": ["*"],
      //    "AllowedMethods": ["GET"],
      //    "AllowedOrigins": ["*"],
      //    "ExposeHeaders": [],
      //  },
      //]
      //
      //credentials: fromCognitoIdentityPool({
        //clientConfig: { region: "us-east-1" },
        //identityPoolId: "<YOUR_IDENTITY_POOL_ID>",
      //}),
    });
    const command = new ListObjectsCommand({ Bucket: "<our_bucket>.cloudfront.net" });
    client.send(command).then(({ Contents }) => setObjects(Contents || []));

@eddiesarevalo
Copy link
Member Author

eddiesarevalo commented Nov 16, 2023

@tloubrieu-jpl These are the steps from @ramesh-maddegoda

We have to do the following things.

  1. Create a Cognito User pool (we have permissions to create this)
  2. Create a Cognito client (we have permissions to create this)
  3. Create an IAM role (we have permissions to create this)
  4. Create a Identity pool (MCP Admins have to create this)
  5. Associate the Identity pool with the Cognito client and IAM role created above (MCP Admins have to create this)
  6. Create a Cognito user group in Cognito User and associate the IAM role created above with the User Group (MCP Admins have to create this)

This will take time.

@tloubrieu-jpl
Copy link
Member

@eddiesarevalo is at the 3rd step and is going to write a ticket for MCP for that to happen.

@tloubrieu-jpl
Copy link
Member

@viviant100 will send the link to the ticketing system of MCP.

@jordanpadams
Copy link
Member

Status: Work ongoing.

@tloubrieu-jpl
Copy link
Member

@eddiesarevalo cannot see the cognito identity pool which is blocking him but SAs are helping.

@tloubrieu-jpl
Copy link
Member

@eddiesarevalo is learning on cognito and s3 so to make the SDK work, but he is also exploring other methods.

@tloubrieu-jpl
Copy link
Member

tloubrieu-jpl commented Jan 23, 2024

@eddiesarevalo made the s3 access work with Cognito.

Now he's going to develop the ticket into an EPIC with subtasks for each component of the application (e.g. footer, header...)

@eddiesarevalo
Copy link
Member Author

Created a repo for this project https://github.com/NASA-PDS/s3-browser

Since this is at stopping point now, will switch over to react library now.

@tloubrieu-jpl
Copy link
Member

To be closed and create a new ticket for the remaining work --> @tloubrieu-jpl

@nutjob4life
Copy link
Member

nutjob4life commented Feb 1, 2024

Putting this "on hold" for now until we get a second ticket on the component library

@jordanpadams jordanpadams transferred this issue from NASA-PDS/planetary-data-cloud Mar 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
i&t.skip Skip I&T of this task/ticket icebox task
Projects
Status: ToDo
Development

No branches or pull requests

4 participants