To get started with Amazon Bedrock in your AWS account, follow these steps to enable and access the service:
1. Enable Bedrock in the AWS Console First, log in to your AWS Management Console and navigate to the Amazon Bedrock service page. Bedrock is region-specific, so ensure you select the AWS Region where you want to use the service (e.g., us-east-1). From the Bedrock dashboard, you’ll need to request access to the foundation models (FMs) you plan to use. AWS requires explicit approval for some models due to usage policies. For example, models like Claude from Anthropic or Jurassic from AI21 Labs may require a brief access request form. Once approved (typically within minutes), you’ll see the models listed as available in your account.
2. Configure IAM Permissions and Security
Create an IAM policy to grant permissions for Bedrock API actions (e.g., bedrock:InvokeModel
) and attach it to IAM users, roles, or groups that need access. For example, a minimal policy might allow bedrock:ListFoundationModels
to discover available models and bedrock:InvokeModel
to execute inference requests. If your workload runs in a VPC, configure network policies (security groups, VPC endpoints) to allow traffic to Bedrock’s API endpoints. Avoid exposing model invocation permissions broadly—follow the principle of least privilege.
3. Start Using the Service via SDK or CLI
Install the AWS SDK (e.g., Python’s boto3
) or AWS CLI and use the Bedrock runtime client to invoke models. For example, in Python:
import boto3
client = boto3.client(service_name='bedrock-runtime')
response = client.invoke_model(
modelId='anthropic.claude-v2',
body=json.dumps({"prompt": "Hello, how are you?", "max_tokens_to_sample": 300})
)
Replace modelId
with the ID of the model you’ve enabled. For CLI access, use aws bedrock-runtime invoke-model
with similar parameters. Start with simple prompts to test integration, then expand to production use cases like text generation or embeddings.
Additional Considerations Check AWS service quotas for Bedrock to ensure your account has sufficient limits for API requests. Monitor usage and costs via CloudWatch metrics and Cost Explorer, as Bedrock charges per token processed. If you encounter access errors, verify IAM policies, model availability in your region, and whether the model requires additional terms of service acceptance.