TDTech Digest

034. AWS CLI로 예제 실행 (Run examples with the AWS CLI)

  • 원문: English
  • 위치: References/Advanced › Detailed getting started guide › Get started with the API › Run examples with the AWS CLI

한 줄 요약

AWS CLI로 모델 목록 조회 → InvokeModel → Converse를 실행해 권한·인증이 제대로 설정됐는지 확인하는 실습입니다.

핵심 내용

  • 사전 조건: Bedrock 권한이 있는 사용자/역할(032), AWS CLI 설치·인증 완료
예제명령결과 위치
모델 목록aws bedrock list-foundation-models현재 리전에서 쓸 수 있는 FM 목록
InvokeModelaws bedrock-runtime invoke-model지정한 출력 파일. 텍스트는 output.message.content
Converseaws bedrock-runtime converse응답의 text 필드
aws bedrock-runtime converse \
  --model-id amazon.nova-lite-v1:0 \
  --messages '[{"role":"user","content":[{"text":"Describe the purpose of a \"hello world\" program in one line."}]}]' \
  --inference-config '{"maxTokens":512,"temperature":0.5,"topP":0.9}'
  • ⚠️ invoke-model은 --body에 모델 고유 JSON을 넣고, --cli-binary-format raw-in-base64-out 옵션과 출력 파일 이름을 함께 지정합니다.
  • 💡 지원되는 경우 InvokeModel보다 Converse를 권장합니다. 모델 간 요청 형식이 통일되고 멀티턴 대화 관리가 쉬워집니다.
  • 목록 조회는 bedrock(컨트롤 플레인), 추론은 bedrock-runtime(데이터 플레인) 명령 그룹입니다. → 003

SA 관점

  • 고객 환경에서 “권한은 줬는데 안 된다"는 문의가 오면, 이 세 명령을 순서대로 돌려 컨트롤 플레인 권한 / 런타임 권한 / 모델 접근 중 어디서 막히는지 빠르게 나눌 수 있습니다.