Governing Amazon Bedrock inference from coding harnesses with IAM Identity Center and Verified Access
A leaked Bedrock API key can turn into a $400K bill over a weekend. This post shows two ways to secure agentic coding harnesses like Kiro and Codex: replace long-term keys with temporary IAM Identity Center sessions and standardize configuration with MDM, or put a self-hosted LLM gateway like LiteLLM behind AWS Verified Access so inference is denied unless both the user and the device pass a server-side posture check.
Imagine a CTO testing a coding harness from their laptop. They generate and export Amazon Bedrock API keys into a shell as they start playing with the service. Malware captures it on Friday and by Monday automated inference produces a $400,000 bill.
The scenario is hypothetical, but the failure is clear: long-term credentials create unnecessary risk and a valid credential only says what a principal may do, not whether the request came from a managed device.
- Replace long-term credentials with temporary workforce sessions and standardize client configuration.
- Where required, deny inference unless the user and device pass a server-side policy.
AWS IAM Identity Center , the AWS solution for connecting your workforce users to AWS managed applications and resources, plus Mobile Device Management (MDM) provides the first level with low implementation effort. The second level combines AWS Verified Access with a self-hosted LLM gateway: a middleware layer that connects your application to multiple AI model providers and services, such as Amazon Bedrock.
Choose the approach based on the requirement
AWS Verified Access is an AWS service that lets you provide secure access to your applications (in this case an LLM gateway) without requiring the use of a VPN. Verified Access evaluates each application request and helps ensure that users can access the application only when they meet the specified security requirements from an identity and device posture standpoint.
The two approaches have different effort and assurance levels:
Approach | Effort | Enforcement point | Appropriate when |
|---|---|---|---|
IAM Identity Center plus MDM | Low | IAM and the managed endpoint | Looking to simply long-term credentials such as API keys and standardizing approved harnesses configuration. |
Verified Access and self-hosted LLM gateway | Medium to high | A server-side application boundary that evaluates identity and device posture | Unmanaged devices must be denied |
Approach 1 - IAM Identity Center and MDM
This is the recommended starting point for most organizations. It requires little setup, uses native AWS authentication, and removes the highest-risk credential pattern: long-term keys stored in shell profiles and coding harness configurations.
Amazon Bedrock supports both short-term and long-term API keys. Long-term keys create an IAM user and are intended for exploration. For workforce use, prefer temporary role credentials obtained through IAM Identity Center and the AWS SDK credential chain.
Start by creating a permission set such as
GenAICodingAssistant , in AWS IAM Identity Center and assigning it to the appropriate developer group. Grant only the permissions required by the selected Bedrock APIs and models. Next, remove any existing Bedrock API keys from shell profiles, environment variables such as
AWS_BEARER_TOKEN_BEDROCK , and coding harness credential stores. Some clients prioritize a Bedrock bearer token over the AWS credential provider chain. If a token remains configured, the client may use it instead of the intended IAM Identity Center profile. Use the permission set and an AWS Organizations SCP, where appropriate, to deny long-term key creation and bearer-token invocation.
Example SCP:
{ "Version": "2012-10-17", "Statement": [ { "Sid": "DenyBedrockServiceSpecificCredentials", "Effect": "Deny", "Action": "iam:CreateServiceSpecificCredential", "Resource": "*", "Condition": { "StringEquals": { "iam:ServiceSpecificCredentialServiceName": "bedrock.amazonaws.com" } } }, { "Sid": "DenyBedrockBearerTokens", "Effect": "Deny", "Action": [ "bedrock:CallWithBearerToken", "bedrock-mantle:CallWithBearerToken" ], "Resource": "*" } ]}Once AWS IAM Identity Center is configured and users have been granted access, they can create a named profile using the AWS CLI :
aws configure sso The resulting shared AWS configuration might look like this:
[sso-session corp] sso_start_url = sso_region = eu-west-1 sso_registration_scopes = sso:account:access [profile genai-dev] sso_session = corp sso_account_id = 111122223333 sso_role_name = GenAICodingAssistant region = eu-west-1 Before starting the coding harness, the developer signs in so the harness can use their credentials to run inference on Amazon Bedrock:
aws sso login --profile genai-dev export AWS_PROFILE=genai-dev The AWS CLI and compatible AWS SDKs then automatically retrieve temporary role credentials.
Coding harnesses that support Amazon Bedrock as a provider can use this profile for authentication. For example, a Codex configuration could look like this:
model_provider = "amazon-bedrock" model = "APPROVED_BEDROCK_MODEL_ID" [model_providers.amazon-bedrock.aws] profile = "genai-dev" region = "eu-west-1" Use MDM to make the harness baseline repeatable
As an administrator, you can use an MDM platform from AWS Partners such as Jamf to apply the baseline harness configuration across your developer's laptops. Use policies and configuration profiles to install the AWS CLI and approved coding harnesses and distribute the supported managed harness settings. Developers still sign in individually through IAM Identity Center before starting their harness.
Those credentials can still be stolen though. Malware could copy them and use them from another device until they expire or access is blocked. IAM policies can restrict requests to approved VPC endpoints, but IAM itself cannot evaluate a laptop's MDM compliance when it calls the public Bedrock endpoint.
To check device posture before allowing inference, place an LLM gateway behind AWS Verified Access. Configure its access policy to check user identity and supported device trust signals. Give the gateway’s workload role permission to invoke Bedrock and remove direct invocation permissions from developer roles. Developers then reach Bedrock through the gateway, where access depends on those checks. We’ll cover this approach in the second half of the article.
Approach 2 – Enforce calls from managed devices only with Verified Access and a self-hosted LLM gateway
In this approach, an LLM gateway, such as LiteLLM, can be deployed and operated on Amazon ECS or Amazon EKS, with Verified Access acting as the server-side policy enforcement point that checks both workforce identity and device posture before the gateway connection is allowed. This design changes the trust model:
- The laptop doesn’t hold AWS credentials that can invoke Bedrock.
- Verified Access evaluates user identity and device posture before the gateway connection is established.
To start with, run your LLM gateway, such as LiteLLM, behind an internal Load Balancer. Such gateways can typically be deployed on EKS or ECS on EC2 or with Fargate if you're looking for a serverless compute engine. You then need to give the LiteLLM task/pod or instance role the permissions it needs to invoke Bedrock as such permissions will be removed from the developer permission sets once the gateway path is enforced.
Now you’ll need to create an Amazon Bedrock interface VPC endpoint. Depending on the models and features you’re looking for you might need to create 2, for bedrock-runtime and bedrock-mantle:
-
com.amazonaws.REGION.bedrock-runtime
-
com.amazonaws.REGION.bedrock-mantle
Make sure to attach a VPC endpoint policy that allows only the gateway role and approved Bedrock actions. Restrict the gateway security group to the VPC endpoint and required logging destinations.
Now Verified Access will be the service that makes the bridge between your developer endpoints and the LLM Gateway you just deployed.
When a user tries to access an application, Verified Access gets their data from the trust provider and evaluates it against the policies that you set for the application. Verified Access grants access to the requested application only if the user meets your specified security requirements.
Next, use the Connectivity Client for AWS Verified Access on your endpoints to authenticate users, supply identity and device context, and establish an encrypted tunnel to the TCP endpoint. Verified Access authorizes the connection and forwards it to the internal load balancer, while the gateway handles TLS termination and application authentication.
Configure identity and device posture
Configure IAM Identity Center as the Verified Access user trust provider and assign approved developers to a dedicated group. Then add CrowdStrike, Jamf, or JumpCloud as the device trust provider. Each exposes different claims, so observe the trust context before enforcing a threshold.
For instance, this Jamf example requires an approved group and an acceptable device risk:
permit(principal, action, resource) when { context.idc.groups has "IAM_IDENTITY_CENTER_GROUP_ID" && ["LOW", "SECURE"].contains(context.jamf.risk) };
Authenticate the harness to LiteLLM with a short-lived JWT
Verified Access and LiteLLM make separate authorization decisions:
- The Verified Access Connectivity Client authenticates the developer through IAM Identity Center and provides device posture to the Verified Access policy.
- The harness sends a short-lived JWT to LiteLLM. LiteLLM validates the token and applies user, group, model, rate, and budget policy.
- LiteLLM uses its ECS task role or EKS Pod Identity role to invoke Bedrock. No developer AWS credential or Bedrock API key is forwarded.
The Connectivity Client token is not passed to the harness or the LLM gateway. It authorizes the network tunnel and has a different audience from the LiteLLM token.
In the case of Codex, configure it to call the customer-facing endpoint and obtain its LiteLLM token from a local authentication helper:
model = "codex-bedrock" model_provider = "corporate-gateway" [model_providers.corporate-gateway] name = "Corporate Bedrock Gateway" base_url = "" wire_api = "responses" supports_websockets = false [model_providers.corporate-gateway.auth] command = "/usr/local/bin/get-corporate-ai-token" args = ["--audience", "litellm-proxy"] timeout_ms = 5000 refresh_interval_ms = 300000 The helper should use an approved OAuth 2.0 flow, request a token for the litellm-proxy audience, store any refresh token in the operating system credential store, and print only the short-lived access token to standard output. Codex adds it to the request as an Authorization: Bearer header.
The user may not need to enter credentials twice. When the helper and IAM Identity Center use the same corporate identity provider, an existing browser SSO session can complete the second authorization without another password prompt. The two tokens remain separate because they protect different resources.
Configure LiteLLM to validate the JWT signature, issuer, audience, expiration, and relevant identity claims. The following example maps users and groups from one approved issuer:
general_settings: enable_jwt_auth: true litellm_jwtauth: issuers: - issuer: "" jwks_url: "" audience: "litellm-proxy" user_id_jwt_field: "sub" user_email_jwt_field: "email" team_ids_jwt_field: "groups" enforce_team_based_model_access: true team_allowed_routes: - openai_routes Replace the issuer, key set URL, audience, and claim names with values from the corporate identity provider. Restrict accepted algorithms and issuers, require token expiration, and deny tokens without the expected audience.
Verified Access doesn’t convert a TCP stream into an HTTP identity header. LiteLLM therefore uses the JWT to identify the developer, enforce per-user or per-team policy, and produce request-level audit records.
Conclusion
The first approach is a completely valid target state for customers whose risk assessment doesn’t require a server-side device posture check. It is a low-effort improvement that removes long-term credentials, standardizes coding assistant configuration, and applies least-privilege Bedrock access without introducing a new application tier.
For customers with a requirement to deny unmanaged devices can add a self-hosted inference gateway on Amazon ECS or Amazon EKS with Verified Access in front. Verified Access then answers whether the user and device are trusted before the inference request reaches that gateway.
To recap, use IAM Identity Center and MDM when:
- The primary requirement is to remove long-term credentials.
- MDM already provides effective endpoint configuration and compliance controls.
- Low implementation and operational effort are important.
Use Verified Access with a self-hosted LLM gateway when:
- Personal and unmanaged devices requests must be denied.
- Developer laptops should hold no Bedrock-capable AWS credentials.
- The security team needs one place to observe and stop inference traffic.
Enjoyed reading this content? Let the author know!
Your likes, comments, shares, and saves help creators reach more builders.
Loading recommendations
Loading article