Open eddiesarevalo opened 10 months ago
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 || []));
@tloubrieu-jpl These are the steps from @ramesh-maddegoda
We have to do the following things.
This will take time.
@eddiesarevalo is at the 3rd step and is going to write a ticket for MCP for that to happen.
@viviant100 will send the link to the ticketing system of MCP.
Status: Work ongoing.
@eddiesarevalo cannot see the cognito identity pool which is blocking him but SAs are helping.
@eddiesarevalo is learning on cognito and s3 so to make the SDK work, but he is also exploring other methods.
@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...)
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.
To be closed and create a new ticket for the remaining work --> @tloubrieu-jpl
Putting this "on hold" for now until we get a second ticket on the component library
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.