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

Ability to use sso named profiles through aws-sdk-java version 2 #169

Open
joshhamann opened this issue Jan 3, 2023 · 8 comments
Open

Comments

@joshhamann
Copy link

I currently have a work around set up to set env variables based on SSO's current (and expire-able) credentials. It would be nice to be able to utilize this repo with SSO named profiles. I believe it is tracked back to this issue (aws/aws-sdk-java-v2#1970) which shows it looks like we need aws-sdk-java version >= 2.15.33 to be able to utilize.

I believe this is the pom.xml that is utilized (for glue-3.0) for instance:

I also think this is the pom that is referenced within that dependency:

Which shows:
<aws.sdk.version>1.12.128</aws.sdk.version>

Is it possible to upgrade to aws-sdk-java version to something >= 2.15.33? Or even better, is there a way to adjust that value within the pom.xml which is on the s3 backed maven repository, so I can handle additional dependency issues as they come up (apache iceberg, for instance).

@david-wb
Copy link

I am facing the same problem. Did you resolve it?

@joshhamann
Copy link
Author

joshhamann commented Jan 18, 2023

No - I don't believe it can be resolved outside of this repo given the s3 backed pom.xml that needs editing. My solution was a workaround that sets AWS variables for the scope of the command I am firing based on SSO. So something like:

{script that sets AWS variables based on your named profile for the scope of this command} {your script} in the terminal worked for me. Hopefully that helps!

@selfisch
Copy link

selfisch commented Feb 2, 2023

Any update on this? We are facing the same issue.

@barryoneill
Copy link

barryoneill commented Mar 9, 2023

A less awful way is to do this is to set this in ~/.aws/config:

[profile foo]
credential_process=aws configure export-credentials --profile=your-sso-profile

Then you should be able to use profile foo without the need for wrapping calls in scripts. It's not ideal but 🤷🏻‍♂️

@rokity
Copy link

rokity commented Dec 7, 2023

The solutions of @barryoneill maybe it works. But I suggest to create a PR to use AWS_PROFILE_SSO variable as parameter to identify the SSO profile.

@jerdoe
Copy link

jerdoe commented Sep 17, 2024

As mentioned in this reference, it's possible to build an adapter to use the AWS SDK Java v2 SSO libraries alongside the AWS SDK Java v1.

I've created a GitHub project that builds and integrates such an adapter within the AWS Glue Docker image. However, you can also use it with aws-glue-libs.

Below are the steps to help you get it working with aws-glue-libs:

git clone https://github.com/jerdoe/glue_libs_sso.git 
cd glue_libs_sso/sso-support
mvn package
export MY_GLUE_LIBS_DIR=<path/to/your/aws-glue-libs>
export MY_GLUE_REGION=<your_glue_region> #e.g: ap-south-1
cp target/sso*.jar ${MY_GLUE_LIBS_DIR}/jarsv1
python3 ../configure-glue-region.py ${MY_GLUE_REGION} -o ${MY_GLUE_LIBS_DIR}/jarsv1/glue-conf.jar
python3 ../edit-hadoop-config-sso.py -j ${MY_GLUE_LIBS_DIR}/jarsv1/core-site-xml.jar

@joshhamann
Copy link
Author

A less awful way is to do this is to set this in ~/.aws/config:

[profile foo]
credential_process=aws configure export-credentials --profile=your-sso-profile

Then you should be able to use profile foo without the need for wrapping calls in scripts. It's not ideal but 🤷🏻‍♂️

Thanks for this, it feels like a pretty non-invasive solution that worked for me!

@barryoneill
Copy link

np - be mindful though that it can be slower than a regular profile

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

6 participants