Amazon Bedrock 온디맨드 모델을 간접 호출할 때 비용 할당 태그를 추가하고 싶습니다.
해결 방법
애플리케이션 추론 프로파일에 태그를 할당한 다음 프로파일을 온디맨드 모델에 연결합니다.
참고: 온디맨드 모델에는 태그를 할당할 수 없습니다.
애플리케이션 추론 프로파일 생성
CreateInferenceProfile을 사용합니다. 다음 예제는 amazon.nova-pro-v1:0에 연결된 애플리케이션 추론 프로파일을 생성합니다. 함께 사용되는 태그는 다음과 같습니다. "key": "CostAllocateTag","value": "project123".
예를 들어 다음과 같습니다.
aws bedrock create-inference-profile --region 'us-east-1' \
--inference-profile-name 'profile-project123' \
--description 'profile-project123' \
--model-source '{"copyFrom": "arn:aws:bedrock:us-east-1::foundation-model/amazon.nova-pro-v1:0"}' \
--tags '[{"key": "CostAllocateTag","value": "project123"}]'
출력 예시:
{
"inferenceProfileArn": "arn:aws:bedrock:us-east-1:AccountId:application-inference-profile/y1pcpudi2mb7",
"status": "ACTIVE"
}
비용 할당 태그 활성화
비용 할당 태그를 활성화하려면 AWS Billing and Cost Management 콘솔을 사용합니다.
참고: 태그는 24시간 이내에 비용 할당 태그 페이지에 표시됩니다.
모델 간접 호출
모델을 간접 호출하려면 애플리케이션 추론 프로파일을 사용합니다. 모델 ID의 경우 온디맨드 모델 ID 대신 애플리케이션 추론 프로파일의 ARN을 지정합니다.
예를 들어 다음과 같습니다.
aws bedrock-runtime converse --region 'us-east-1' \
--model-id 'arn:aws:bedrock:us-east-1:AccountId:application-inference-profile/y1pcpudi2mb7' \
--messages '[{"role": "user", "content": [{"text": "Hello"}]}]'
출력 예시:
{
"output": {
"message": {
"role": "assistant",
"content": [
{
"text": "Hello! It's nice to have you here. I'm here to help with whatever you might need. Whether you have a question, need assistance with a topic, or just want to chat, feel free to ask. What can I assist you with today?"
}
]
}
},
"stopReason": "end_turn",
"usage": {
"inputTokens": 1,
"outputTokens": 54,
"totalTokens": 55
},
"metrics": {
"latencyMs": 889
}
}