pishen / sbt-lighter

SBT plugin for Apache Spark on AWS EMR
Apache License 2.0
57 stars 15 forks source link

adding sts jar for supporting assumed roles (ARN). #19

Closed alvinhenrick closed 6 years ago

alvinhenrick commented 6 years ago

Not sure how to provide role / ARN amazon s3 client

alvinhenrick commented 6 years ago
  `ProfileCredentialsProvider awsCredentialsProvider = new ProfileCredentialsProvider("prod");
AWSSecurityTokenService stsClient = 
AWSSecurityTokenServiceClientBuilder.standard()
    .withCredentials(awsCredentialsProvider).build();

AssumeRoleRequest assumeRequest = new AssumeRoleRequest()
    .withRoleArn("arn:aws:iam::962373596474:role/Nucleus-Developer")
    .withDurationSeconds(3600)
    .withRoleSessionName("test-upload-session");

AssumeRoleResult assumeResult = stsClient.assumeRole(assumeRequest);

BasicSessionCredentials temporaryCredentials = new BasicSessionCredentials(
    assumeResult.getCredentials().getAccessKeyId(),
    assumeResult.getCredentials().getSecretAccessKey(),
    assumeResult.getCredentials().getSessionToken());

AmazonS3 s3client = AmazonS3ClientBuilder.standard().withCredentials(new 
AWSStaticCredentialsProvider(temporaryCredentials)).withRegion("us-east-1").build();`

I want to supply my own AmazonS3ClientBuilder with assume Role I need that jar to be added to the classpath. It will be great if it is part of plugin. Let me know if you can add it. Thnx

pishen commented 6 years ago

@alvinhenrick Sorry I haven't try AWS STS yet. But maybe you can try to add it from your side directly:

alvinhenrick commented 6 years ago

Add the dependency to plugins.sbt works perfectly.I will update the README on how to use it.