Jump to Content

This API Documentation is now deprecated

We are excited to announce our new API Documentation.

Class CreateOpenIDConnectProviderCommandProtected

Creates an IAM entity to describe an identity provider (IdP) that supports OpenID Connect (OIDC).

The OIDC provider that you create with this operation can be used as a principal in a role's trust policy. Such a policy establishes a trust relationship between Amazon Web Services and the OIDC provider.

If you are using an OIDC identity provider from Google, Facebook, or Amazon Cognito, you don't need to create a separate IAM identity provider. These OIDC identity providers are already built-in to Amazon Web Services and are available for your use. Instead, you can move directly to creating new roles using your identity provider. To learn more, see Creating a role for web identity or OpenID connect federation in the IAM User Guide.

When you create the IAM OIDC provider, you specify the following:

  • The URL of the OIDC identity provider (IdP) to trust

  • A list of client IDs (also known as audiences) that identify the application or applications allowed to authenticate using the OIDC provider

  • A list of tags that are attached to the specified IAM OIDC provider

  • A list of thumbprints of one or more server certificates that the IdP uses

You get all of this information from the OIDC IdP you want to use to access Amazon Web Services.

Amazon Web Services secures communication with some OIDC identity providers (IdPs) through our library of trusted root certificate authorities (CAs) instead of using a certificate thumbprint to verify your IdP server certificate. These OIDC IdPs include Auth0, GitHub, Google, and those that use an Amazon S3 bucket to host a JSON Web Key Set (JWKS) endpoint. In these cases, your legacy thumbprint remains in your configuration, but is no longer used for validation.

The trust for the OIDC provider is derived from the IAM provider that this operation creates. Therefore, it is best to limit access to the CreateOpenIDConnectProvider operation to highly privileged users.

Example

Use a bare-bones client and the command you need to make an API call.

import { IAMClient, CreateOpenIDConnectProviderCommand } from "@aws-sdk/client-iam"; // ES Modules import
// const { IAMClient, CreateOpenIDConnectProviderCommand } = require("@aws-sdk/client-iam"); // CommonJS import
const client = new IAMClient(config);
const input = { // CreateOpenIDConnectProviderRequest
Url: "STRING_VALUE", // required
ClientIDList: [ // clientIDListType
"STRING_VALUE",
],
ThumbprintList: [ // thumbprintListType // required
"STRING_VALUE",
],
Tags: [ // tagListType
{ // Tag
Key: "STRING_VALUE", // required
Value: "STRING_VALUE", // required
},
],
};
const command = new CreateOpenIDConnectProviderCommand(input);
const response = await client.send(command);
// { // CreateOpenIDConnectProviderResponse
// OpenIDConnectProviderArn: "STRING_VALUE",
// Tags: [ // tagListType
// { // Tag
// Key: "STRING_VALUE", // required
// Value: "STRING_VALUE", // required
// },
// ],
// };

Param

CreateOpenIDConnectProviderCommandInput

Returns

CreateOpenIDConnectProviderCommandOutput

See

Throws

ConcurrentModificationException (client fault)

The request was rejected because multiple requests to change this object were submitted simultaneously. Wait a few minutes and submit your request again.

Throws

EntityAlreadyExistsException (client fault)

The request was rejected because it attempted to create a resource that already exists.

Throws

InvalidInputException (client fault)

The request was rejected because an invalid or out-of-range value was supplied for an input parameter.

Throws

LimitExceededException (client fault)

The request was rejected because it attempted to create resources beyond the current Amazon Web Services account limits. The error message describes the limit exceeded.

Throws

ServiceFailureException (server fault)

The request processing has failed because of an unknown error, exception or failure.

Throws

IAMServiceException

Base exception class for all service exceptions from IAM service.

Example

To create an instance profile

// The following example defines a new OIDC provider in IAM with a client ID of my-application-id and pointing at the server with a URL of https://server.example.com.
const input = {
"ClientIDList": [
"my-application-id"
],
"ThumbprintList": [
"3768084dfb3d2b68b7897bf5f565da8efEXAMPLE"
],
"Url": "https://server.example.com"
};
const command = new CreateOpenIDConnectProviderCommand(input);
const response = await client.send(command);
/* response ==
{
"OpenIDConnectProviderArn": "arn:aws:iam::123456789012:oidc-provider/server.example.com"
}
*/
// example id: 4e4a6bff-cc97-4406-922e-0ab4a82cdb63

Hierarchy

Constructors

Properties

Methods

Constructors

Properties

Methods