Skip to content

Generating temporay credentials using X.509 certificates created by AWS private CA and IAMRolesAnywhere

0

I am looking for nodejs code/apis to generate temporay credentials using X.509 certificates which are created by AWS private CA and IAMRolesAnywhere.

2 Answers
0

AWS Identity and Access Management Roles Anywhere provides a secure way for your workloads such as servers, containers, and applications running outside of AWS to obtain Temporary AWS credentials. To use IAM Roles Anywhere customer workloads will need to use X.509 certificates issued by their Certificate Authority (CA) . The Certificate Authority (CA) needs to be registered with IAM Roles Anywhere as a trust anchor to establish trust between customer PKI and IAM Roles Anywhere. Customers who do not manage their own PKI system can use AWS Certificate Manager Private Certificate Authority (ACM PCA) to create a Certificate Authority and use that to establish trust with IAM Roles Anywhere.

Please find nodejs code/apis to generate temporay credentials using X.509 certificates which are created by AWS private CA and IAMRolesAnywhere below :

To install the this package, simply type add or install @aws-sdk/client-rolesanywhere using your favorite package manager: * npm install @aws-sdk/client-rolesanywhere * yarn add @aws-sdk/client-rolesanywhere * pnpm add @aws-sdk/client-rolesanywhere

Sample code :

import * as AWS from "@aws-sdk/client-rolesanywhere";
const client = new RolesAnywhereClient({ region: "REGION" });

const params = {
  /** input parameters */
};
const command = new CreateProfileCommand(params);
// async/await.
try {
  const data = await client.send(command);
  // process data.
} catch (error) {
  // error handling.
 } finally {
  // finally.
}

The whole code and explanation can be found in this doc : https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-rolesanywhere/

Here, we are using the API call CreateProfileCommand, for which details for required parameters can be found in : https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-rolesanywhere/classes/createprofilecommand.html

AWS
SUPPORT ENGINEER

answered 3 years ago

0

I already have the basic infrastructure ready. I have created AWS private CA and have a X.509 certificate created by ACM. I also have trust anchor, profile and role created on AWS side using console.

My question is: I want to generate temporary credentials at client side using nodejs. I see that there is a credential process that can be used for thar aws_signing_helper. I would like to know if there is any equivalent nodejs code or any other api?

answered 3 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.