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

Arn Role #68

Open
douglastehling opened this issue Oct 18, 2021 · 3 comments
Open

Arn Role #68

douglastehling opened this issue Oct 18, 2021 · 3 comments

Comments

@douglastehling
Copy link

Hi, i have a problem because i need to access Athena but to access i would have to pass an arn role and in the examples i'm not finding how to do it.. does anyone have any idea how to do it?

@ghdna
Copy link
Owner

ghdna commented Oct 18, 2021

The role is assumed from the underlying EC2 or Lambda that is hosting Athena-express, in which case, you just pass the AWS sdk object. If not using those 2 hosting options, then you need to explicitly instantiate AWS sdk with your access key and secret key and pass the AWS sdk object instead. In both cases, you don't pass the arn and only pass the AWS sdk.

@pwmcintyre
Copy link

i have a similar problem — because my personal IAM Role doesn't have athena access, so I need to assume a pre-provisioned "query" role ... but the interface to AthenaExpress doesn't take a credential provide, it takes the whole 'aws' object (which i don't understand - isn't this global?)

i think this might work

import { ChainableTemporaryCredentials, Credentials, S3 } from "aws-sdk"

// configure creds
const credentials: Credentials = new ChainableTemporaryCredentials({
  params: {
    RoleArn: "arn:aws:iam::xxxxxx:role/foo",
    RoleSessionName: "foo"
  }
})

// set global creds 🔥
AWS.config.credentials = credentials

// construct athena express
athena = new AthenaExpress({
      aws: AWS,
      ...
})

hoping one day to instead supply either credentials or a client — example:

import { ChainableTemporaryCredentials, Credentials, S3 } from "aws-sdk"

// configure creds
const credentials: Credentials = new ChainableTemporaryCredentials({
  params: {
    RoleArn: "arn:aws:iam::453719517077:role/pmcintyre-tmp",
    RoleSessionName: "foo"
  }
})

// construct athena express with AWS.Credential
athena = new AthenaExpress({
      credentials,
      ...
})

// or; construct athena express with custom clients
const athena = new S3({ credentials })
const s3 = new S3({ credentials })
athena = new AthenaExpress({
      athena, s3,
      ...
})

@ghdna
Copy link
Owner

ghdna commented Jan 17, 2022

Yes, this will become part of the v3 support for aws-sdk.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants