In a post published by Aastha Paul on the AWS blog, a new capability is introduced in AgentCore Identity, a component of Amazon Bedrock AgentCore, that enables agents to connect to private identity providers (IdPs) while trusting a private certificate authority (Private CA). Many application development teams self-host their identity provider, such as Keycloak or PingFederate, inside a private network, and these providers typically present a TLS server certificate from a private CA. With this new support, agents can connect to these identity providers while trusting the Private CA that the organization already uses.
According to the post, the PEM-encoded CA certificate is stored in AWS Secrets Manager or Amazon S3, and the credential provider references it. The certificate contains only the public certificate and not the private key, and AgentCore Identity uses it to validate the server certificates of the discovery, JWKS key set, and token endpoints of the identity provider. The certificate must be a root or intermediate certificate. While AgentCore Identity supports any private certificate authority—including enterprise, third-party, and self-signed root CAs—the demonstration in the post is based on AWS Private CA and Keycloak as the identity provider.
Solution Architecture and Data Flow
The scenario described in the post involves an agent that needs to call an internal wiki API protected by Keycloak. The agent runs on AgentCore Runtime, which hosts the agent code. To obtain an OAuth 2.0 access token from Keycloak, the agent contacts a credential provider in AgentCore Identity, which holds the connection details and client credentials. The Keycloak identity provider runs inside a virtual private cloud (VPC) behind an internal Application Load Balancer that presents an AWS Certificate Manager (ACM) private certificate signed by AWS Private CA.
The connection between AgentCore Identity and the identity provider is established privately through Amazon VPC Lattice, which connects to the VPC via a resource gateway. Using VPC Lattice is required for Private CA support. If the user selects the managed option, the system creates and manages the VPC Lattice resources on their behalf.
The process flow proceeds in the following order:
- The user stores the CA certificate in Secrets Manager or Amazon S3.
- The user creates a credential provider pointing to the identity provider and the CA certificate.
- AgentCore Identity reads the CA certificate and verifies that it is a valid CA certificate.
- The agent requests an access token from AgentCore Identity.
- AgentCore Identity connects to the identity provider via VPC Lattice and checks the load balancer certificate against the configured CA certificate.
- The identity provider issues the token, and AgentCore Identity returns it to the agent.
According to the post, agents using machine-to-machine, on-behalf-of, and user-delegated flows can utilize the Private CA without any code changes.
Prerequisites and Design Considerations
Implementing the process requires an AWS account with access to the AgentCore console in a supported AWS Region where private IdPs are supported, a self-hosted OIDC-compliant IdP inside the VPC with a registered OAuth client, as well as the latest version of the AWS CLI and OpenSSL. In addition, permissions to create credential providers and read permissions for the CA certificate are required: the principal making the call to CreateOauth2CredentialProvider requires the secretsmanager:GetSecretValue permission on the secret or s3:GetObject on the object, and if encrypted with a customer managed key in AWS KMS, the kms:Decrypt permission is also required.
The post outlines several technical considerations:
- Private IdPs only: The credential provider or authorizer must include a
privateEndpointto use a Private CA. Without this configuration, the request fails. - Format and file limits: The file must be PEM-encoded, no larger than 16 kilobytes (KB), and contain only root or intermediate certificates that are within their validity period.
- Single certificate source: Each credential provider references a single secret or a single S3 object. To trust more than one CA, the certificates must be combined in the same PEM file.
- Storage location: The secret or S3 object must reside in the same AWS Region as the credential provider. A secret in Secrets Manager must also be in the same AWS account, whereas an S3 object can reside in another account provided that
bucketOwnerAccountIdis supplied and the bucket policy allows access. - Supported regions: Support depends on VPC Lattice and is available in AWS Regions where AgentCore Identity supports private IdPs.
Setup Steps: Certificate Issuance, Storage, and Provider Configuration
The guide details four main steps for implementation:
In the first step, a server certificate is issued for the identity provider by creating a root CA in AWS Private CA in general-purpose mode, authorizing ACM to renew certificates so that ACM can renew the IdP's server certificate before it expires. When requesting the certificate in ACM, every hostname appearing in the IdP's discovery document must be included as a Subject Alternative Name (SAN), as AgentCore Identity verifies that the certificate matches the IdP hostname. The certificate is then attached to the HTTPS listener of the internal load balancer.
In the second step, the CA certificate is exported in PEM format using the aws acm-pca get-certificate-authority-certificate command. Prior to uploading, it is recommended to verify the CA flag, expiration date, file size, and certificate chain validity (returning Verify return code: 0) using openssl commands. The file is then stored as a string secret in Secrets Manager in the same account or uploaded to Amazon S3.
In the third step, the credential provider is created in the console or via the aws bedrock-agentcore-control create-oauth2-credential-provider command. Under VPC security settings, the Managed option is selected (or Self-managed if managing VPC Lattice resources independently), and under certificateConfigurations, the secret ARN in Secrets Manager or the S3 path—along with the bucket owner account ID for cross-account setups—is added.
In the fourth step, resource status is verified using aws bedrock-agentcore-control get-oauth2-credential-provider. The component starts in CREATING status. If the status is CREATE_FAILED, the failureReason field provides the cause of failure (for example, uploading a standard leaf server certificate instead of a CA certificate, or an object access error).
Monitoring, Rotation, and CA Certificate Security
The post notes that AgentCore Identity publishes the EarliestCertificateDaysToExpiry metric to Amazon CloudWatch under the AWS/Bedrock-AgentCore namespace, reporting the number of days remaining until the earliest certificate in the PEM file expires. The metric is published when agents request tokens and includes dimensions for ProviderName, ProviderArn, and TokenVault. It is recommended to configure a CloudWatch alarm well before the value reaches zero, as token requests will fail once the CA certificate expires.
According to the post, AgentCore Identity reads the certificate solely when creating or updating the credential provider. If a change is made to the secret or S3 object, the UpdateOauth2CredentialProvider action must be invoked for the system to read the new content, and certificateConfigurations must be included in the update request to avoid losing trust in the CA. A process for rotating certificates while minimizing downtime involves combining the existing and new CA certificates into a single PEM file, updating the credential provider, replacing the server certificate on the IdP, and after verifying successful requests, uploading a file containing only the new certificate and updating the system once more. The post notes that AgentCore Identity does not check certificate revocation lists (CRLs) and does not use OCSP, meaning that if an unauthorized party obtains the private key of a server certificate, trust persists until the certificate expires or until the CA is removed from the PEM file and the credential provider is updated.
To protect the CA certificate, the post recommends restricting write permissions so that only the team operating the IdP can update the secret or S3 file, while principals configuring the credential provider are granted read-only access. The post provides an example of an S3 bucket policy that allows read access only to a specific role in a workload account belonging to an organization in AWS Organizations and denies writes from principals other than the IdP administrator, and an example of a resource-based policy for Secrets Manager that denies changes from any principal except the IdP administrator while read access can be granted through IAM policies, alongside recommendations to enable S3 Versioning and CloudTrail data events.
Using Private CA for Inbound Authorization and Resource Cleanup
In addition to outbound credentials, the post states that a Private CA can also be used for inbound authorization. When AgentCore Runtime or AgentCore Gateway validates JWT tokens issued by a private IdP, the system pulls the discovery document and signing keys from the JWKS endpoint. If the CA certificate is missing or does not match, the Gateway transitions to FAILED status. To support this, certificateConfigurations can be added to the customJWTAuthorizer configuration alongside privateEndpoint.
Upon completing the workflow, deleting resources is recommended to prevent ongoing charges: deleting the credential provider in the console or CLI, deleting the secret or S3 object, removing the certificate from the load balancer listener and deleting it in ACM, and disabling and deleting the Private CA in the AWS Private CA console, which charges a monthly fee for each CA until it is deleted.