Claude Code Action + AWS Bedrock

TMT

https://docs.anthropic.com/ko/docs/claude-code/github-actions#aws-bedrock%EC%9D%98-%EA%B2%BD%EC%9A%B0%3A

1. aws assume role 생성

OIDC (OpenID Connect)

AWS 로그인 후 IAM 서비스 진입

1-1. Add Provider

IAM > Identity providers > Add provider

Image Image

1-2. Role 생성

Image Image
  • 신뢰할 수 있는 엔터티 유형: Web identity
  • Identity provider: 1-1.에서 생성한 token.actions.githubusercontent.com 선택
  • 특정 저장소에 대한 신뢰 정책 구성(대소문자 반드시 고려)
    • github organization: owner
    • github repository(optional)
    • github branch(optional)

1-3. Permission

Image
  • 권한: AmazonBedrockFullAccess 정책 선택

1-4. 등록

Image
  • 이름과 설명을 작성하고 등록
  • ARN 확인 가능

1-5. ARN 확인

Image
  • ARN 확인

2. Github APP 생성

2-1. Github APP 신규 생성

2-2. 기본 정보 입력

Image
  • Github App name
  • Hompage URL: 조직 웹사이트 및 저장소 URL

2-3. Webhook 해제

Image
  • 여기서는 필요하지 않음

2-4. 권한 추가

Image Image
  • Repository permissions:
    • Contents: Read & Write
    • Issues: Read & Write
    • Pull requests: Read & Write

2-5. Create Github App 클릭

Image
  • App ID 기록

2-6. Generate a private key

Image
  • 생성하면 .pem 파일이 다운로드 됨

3. 방금 생성한 Github App 설치

Image Image
  • "Install App" 클릭
  • 설치할 "Repositories" 선택

4. Claude Code APP 설치

Image
  • https://github.com/apps/claude
  • 사용자 생성 APP과 Cluade Code APP 둘 다 설치 필요
  • 설치할 "Repositores" 선택(3.에서 선택한 Repositores와 동일하게 해야 동작함)

5. Repository Secret 추가

5-1. 저장소 Settings 이동

Image Image
  • 저장소 Settings > Secrets and variables > Actions로 이동

5-2. Repository Secret으로 아래 3개 secret 추가

Image
  • AWS_ROLE_TO_ASSUME: (AWS IAM 등록한 ARN)
  • APP_ID: (자체적으로 생성한 Github APP ID)
  • APP_PRIVATE_KEY: (자체적으로 생성한 Github APP Private Key(.pem) 내용)

6. claude code action + workflow 추가

Image
  • example: claude-auto-review
  • AWS Bedrock 모델 사용을 위해 설정을 적절하게 변경해서 사용
  • 사용되어야 하는 기본 action
    • actions/checkout@v4
    • actions/create-github-app-token@v2
    • aws-actions/configure-aws-credentials@v4
    • anthropics/claude-code-action@beta
example: Claude PR Action
name: Auto review PRs

on:
  pull_request:
    types: [opened]

jobs:
  auto-review:
    permissions:
      contents: read
      pull-requests: read
      id-token: write
    runs-on: ubuntu-latest

    steps:
      - name: Checkout repository
        uses: actions/checkout@v4
        with:
          fetch-depth: 1

      - name: Generate GitHub App token
        id: app-token
        uses: actions/create-github-app-token@v2
        with:
          app-id: ${{ secrets.APP_ID }}
          private-key: ${{ secrets.APP_PRIVATE_KEY }}

      - name: Configure AWS Credentials (OIDC)
        uses: aws-actions/configure-aws-credentials@v4
        with:
          role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}
          aws-region: us-east-1

      - name: Auto review PR
        uses: anthropics/claude-code-action@v1
        timeout-minutes: 60
        with:
          use_bedrock: "true"
          prompt: |
            Please review this PR. Look at the changes and provide thoughtful feedback on:
            - Code quality and best practices
            - Potential bugs or issues
            - Suggestions for improvements
            - Overall architecture and design decisions
            - Documentation consistency: Verify that README.md and other documentation files are updated to reflect any code changes (especially new inputs, features, or configuration options)

            Be constructive and specific in your feedback. Give inline comments where applicable.

            **Important**:
            - You MUST respond in the **Korean**.
          claude_args: |
            --model us.anthropic.claude-sonnet-4-20250514-v1:0
            --allowedTools "mcp__github__create_pending_pull_request_review,mcp__github__add_pull_request_review_comment_to_pending_review,mcp__github__submit_pending_pull_request_review,mcp__github__get_pull_request_diff"
Edit this page