cesium Ion REST API upload to S3 access denied

Viewed 33

I’m using the cesium ion rest api to upload las file to cesium. It's a 3 part process. First you have to make a call to create the asset in ion, then it respond with the upload location access infos. Then you have to use those infos to upload the file to S3. My problem is that I get AccessDenied: Access Denied at S3ServiceException.ServiceException [as constructor]

If I use my own bucket, with my own credential, it’s working, but that’s not what I want for now. When I console log uploadLocation, I have an accessKey, a sessionToken etc. Every thing is in order, that’s why I don’t understand why I get an AccessDenied. What am I missing ? Thanks for the help.

const S3ClientCred = {
  accessKeyId: uploadLocation.accessKey,
  secretAccessKey: uploadLocation.secretAccessKey,
  sessionToken: uploadLocation.sessionToken
}
const params = {
  Bucket: uploadLocation.bucket,
  Prefix: uploadLocation.prefix,
  Key: selectedFile.name,
  Body: selectedFile
};
try {
  const parallelUploads3 = new Upload({
    client: new S3Client({apiVersion: '2006-03-01', region: 'us-east-1',signatureVersion: 'v4',endpoint: uploadLocation.endpoint,  credentials: S3ClientCred}),
    params: params,
  });
  parallelUploads3.on("httpUploadProgress", (progress) => {
    console.log(progress);
  });
  await parallelUploads3.done();
  console.log('parallelUploads3.done()');
} catch (e) {
  console.log(e);
}
0 Answers
Related