Modify permissions for long-term and short-term Amazon Bedrock API keys - Amazon Bedrock

Modify permissions for long-term and short-term Amazon Bedrock API keys

When you generate a long-term Amazon Bedrock API key, the AmazonBedrockLimitedAccess AWS-managed policy, which grants access to core Amazon Bedrock API operations, and any other policies that you selected, are attached to the IAM user associated with the key. To allow the user of the Amazon Bedrock API key to perform more Amazon Bedrock API operations or to remove permissions from API operations, modify permissions for the IAM user through the IAM service. For more information, see Adding and removing IAM identity permissions in the IAM User Guide.

For example, you could replace the policies attached to the IAM user associated with the key with the following policy to only allow the user to run inference with the US Anthropic Claude 3 Haiku inference profile in US West (Oregon), using the Amazon Bedrock API key that you generated:

JSON
{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "bedrock:CallWithBearerToken" ], "Resource": "*" }, { "Effect": "Allow", "Action": [ "bedrock:InvokeModel*" ], "Resource": [ "arn:aws:bedrock:us-west-2:111122223333:inference-profile/us.anthropic.claude-3-haiku-20240307-v1:0" ] }, { "Effect": "Allow", "Action": [ "bedrock:InvokeModel*" ], "Resource": [ "arn:aws:bedrock:us-east-1::foundation-model/anthropic.claude-3-haiku-20240307-v1:0", "arn:aws:bedrock:us-west-2::foundation-model/anthropic.claude-3-haiku-20240307-v1:0" ], "Condition": { "StringLike": { "bedrock:InferenceProfileArn": "arn:aws:bedrock:us-west-2:111122223333:inference-profile/us.anthropic.claude-3-haiku-20240307-v1:0" } } } ] }