Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

260
Views
Error al llamar a AWS Athena usando código javascript usando Cognito UnauthRole con Full S3 y Athena Access

Estoy tratando de consultar a Athena asumiendo un rol usando Cognito_IdedtityPool para obtener accessKey temporal, secretKey y sessionToken que tiene permiso completo de Athena y S3. Pero cuando lo llamo desde mi archivo .js arroja un error Usuario:

 Error : arn:aws:sts::<acc_no>:assumed-role/... is not authorized to perform: athena:StartQueryExecution on resource: arn:aws:athena:us-east-1:... because no session policy allows the athena:StartQueryExecution action

Pero una vez que creo un usuario de IAM y codifico las claves con permiso completo de Athena y S3. entonces soy capaz de obtener datos. ¿Alguien puede ayudar en esto?

¿Cómo puedo consultar usando el rol asumido?

Mi código js está a continuación:

 AWS.config.credentials = new AWS.CognitoIdentityCredentials({ IdentityPoolId: 'us-east-1:<pool-id>', }); var config = { accessKey: credentials.accessKeyId, // REQUIRED secretKey: credentials.secretAccessKey, //REQUIRED sessionToken: credentials.sessionToken,// REQUIRED region: 'us-east-1', apiVersion: '2017-05-18', } AWS.config.update(config); const AthenaExpress = require("athena-express"), const athenaExpressConfig = { aws: AWS, s3: "s3://athena-output-destination/Test", getStats: true, workgroup: 'primary', catalog: ATHENA_CATALOG, retry: 4, formatJson: true, }; const athenaExpress = new AthenaExpress(athenaExpressConfig); (async () => { let myQuery = { sql: query_string, db: ATHENA_DB }; try { let results = await athenaExpress.query(myQuery); console.log(results); } catch (error) { console.log(error); } })();

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!