How to authenticate with AWS IAM Roles Anywhere in code

0

We can't run an external binary (i.e. aws_signing_helper) from within our code, but would like to be able to use AWS IAM Roles Anywhere.

Are there any examples of code (Java and C#, preferably, and/or Python) that can be used to authenticate using the private key to assume the Role and obtain the AWS access key, secret access key, and session token?

Thanks

1回答
1
承認された回答

Hello,

Greetings from AWS !

I understand that you want to use IAM Roles Anywhere service to get temporary IAM credentials, but it is not possible to use aws_signing_helper from your code. You want to know if there is any example code which can be used to authenticate using the private key and get access key, secret key, and session token in return. Please feel free to correct me in case I have misunderstood your concern.

The aws_signing_helper executable file is basically a way to call the CreateSession API of IAM Roles Anywhere service. The authentication sign process is explained here [1]. You can implement your own code following the process explained in this document [1] to call the CreateSession API of Roles Anywhere. Though there is no sample code from AWS side, I would like to share this third-party document [2] which contains sample code in Python making request to CreateSession API following the signing process explained in [1].

Note: AWS would not be able to vouch for the integrity of the content being provided in third-party links. Kindly ensure to implement in your test environment first and then to use in your production environment.

I believe the information is helpful to you. In case you have any further queries/concerns then please let us know. We will be more than happy to assist you further.

Wish you an AWeSome day ahead and stay safe ! 🙂

--References--

[1] https://docs.aws.amazon.com/rolesanywhere/latest/userguide/authentication-sign-process.html

[2] https://nerdydrunk.info/aws:roles_anywhere

AWS
サポートエンジニア
Tarit_G
回答済み 2年前
  • That Python code is exactly what I was looking for. (and it works perfectly). Thank you!

  • That Python code is exactly what I was looking for. (and it works perfectly). Thank you!

ログインしていません。 ログイン 回答を投稿する。

優れた回答とは、質問に明確に答え、建設的なフィードバックを提供し、質問者の専門分野におけるスキルの向上を促すものです。

質問に答えるためのガイドライン

関連するコンテンツ