Amazon Bedrock: API key
Amazon Bedrock is a fully managed AWS service that gives you access to leading generative models such as Anthropic Claude and Amazon Nova. This page is for individual developers who want a quick setup with a Bedrock API key.
For other authentication methods, see IAM credentials and AWS CLI profile.
Step 1: Create a Bedrock API key
Section titled “Step 1: Create a Bedrock API key”See the AWS documentation for details.
-
Sign in to the AWS Management Console.
-
Open the Bedrock console and create a long-lived API key. By default the key carries the
AmazonBedrockLimitedAccessIAM policy.
Optional: use a least-privilege policy
Section titled “Optional: use a least-privilege policy”AmazonBedrockLimitedAccess is broad. To follow the principle of least privilege, Dline only needs these permissions to invoke models:
bedrock:InvokeModelbedrock:InvokeModelWithResponseStreambedrock:CallWithBearerToken
-
Create a new policy in the AWS IAM console.
-
Paste this policy into the JSON editor:
{"Version": "2012-10-17","Statement": [{"Effect": "Allow","Action": ["bedrock:InvokeModel", "bedrock:InvokeModelWithResponseStream", "bedrock:CallWithBearerToken"],"Resource": "*"}]}For better security, scope
Resourceto specific model ARNs. -
Name the policy (for example
DlineBedrockInvokeAccess) and attach it to the IAM user behind the API key. The IAM user name and the API key share the same prefix.
Step 2: Confirm the region
Section titled “Step 2: Confirm the region”- Bedrock is available in many regions. Choose one that meets your latency and compliance needs; see AWS Global Infrastructure.
- Some models are only reachable through an inference profile. In that case, check Use cross-region inference in Dline.
Step 3: Configure Dline
Section titled “Step 3: Configure Dline”If Dline is not installed yet, see Installing Dline first.
-
Click the Settings button in the Dline panel title bar.
-
Set Provider to Amazon Bedrock.
-
Choose API Key as the authentication method and paste the key into the AWS Bedrock Api Key field.
-
Select or type a region under AWS Region, for example
us-east-1. -
Select a model under Model. If the model is not listed, choose Custom and enter the model ID.
-
Send a simple prompt to test the connection, for example “Write a Python function that checks whether a number is prime.”
Step 4: Security and operations
Section titled “Step 4: Security and operations”- Access: Prefer AWS SSO or federated roles over long-lived API keys; see IAM best practices.
- Network: Consider AWS PrivateLink, then check Use custom VPC endpoint in Dline and enter the endpoint address.
- Monitoring: Enable CloudTrail to log Bedrock API calls, use CloudWatch to track invocation count, latency, and token usage, and set alerts for abnormal activity.
- Cost: Use AWS Cost Explorer and set billing alerts; see AWS Cost Management.
- Audits: Review IAM roles and CloudTrail logs regularly and follow your organization’s data privacy and governance policies.