Skip to content

An Access Policy can hold multiple AWS STS Federation Credential Providers, each with its own Access Key ID selector. For how Aembit uses the selector, see Using multiple AWS STS Credential Providers. Pass the selector as connection metadata when you request the credential, and Aembit returns temporary AWS credentials for the IAM role of the matching Credential Provider. Connection metadata requires Edge SDK 1.34.0 or later.

select-provider.ts
const credential = await client.getCredential({
server: { host: "s3.amazonaws.com", port: 443 },
credentialType: "AwsStsFederation",
connectionMetadata: { accessKeyId: "AKIADUMMYFORROLEA" },
});
const { awsAccessKeyId, awsSecretAccessKey, awsSessionToken } = credential.data;

Selector values use uppercase characters only. Omit the connection metadata when the Access Policy has a single AWS STS Credential Provider. A selector that matches no Credential Provider in the Access Policy fails the request.

Connection metadata also carries the selectors for multiple JSON Web Token (JWT) Credential Providers. The Edge API credentials endpoint lists every field.