C.W.K.
Stream
Lesson 04 of 13 · published

Cloud deploy — AWS

~12 min · aws, oidc, ecs, lambda

Level 0Apprentice
0 XP0/101 lessons0/10 achievements
0/120 XP to next level120 XP to go0% complete

OIDC + deploy action

AWS deploy 패턴은 인증에 OIDC, 그 다음 하나:

  • ECS rolling deployaws-actions/amazon-ecs-deploy-task-definition
  • EKS via kubectlaws-actions/configure-aws-credentials + aws eks update-kubeconfig + kubectl apply.
  • Lambdaaws-actions/aws-lambda-deploy 또는 aws lambda update-function-code.
  • S3 / CloudFront 정적aws s3 sync + aws cloudfront create-invalidation.
  • App Runneraws-actions/amazon-app-runner-deploy.

AWS 측 일회성 설정

  1. token.actions.githubusercontent.com 용 IAM Identity Provider.
  2. repo:my-org/my-repo:ref:refs/heads/main 키로 trust policy 가진 IAM Role.
  3. Role 의 permissions policy 가 특정 deploy action 허용 (예: 특정 service ARN 에 ecs:UpdateService).

설정 후, 모든 workflow run 은 새로운 scope 된 ~1 시간 credential 받음. 정적 key 없음.

Code

S3 + CloudFront 에 정적 사이트 deploy·yaml
  deploy:
    needs: build
    runs-on: ubuntu-latest
    permissions:
      id-token: write
      contents: read
    environment:
      name: production
      url: https://www.example.com
    steps:
      - uses: actions/checkout@v4
      - uses: actions/download-artifact@v4
        with: { name: dist, path: dist }
      - uses: aws-actions/configure-aws-credentials@v4
        with:
          role-to-assume: arn:aws:iam::111222333444:role/gha-deploy-prod
          aws-region: us-east-1
      - run: |
          aws s3 sync dist/ s3://www-example-com/ --delete
          aws cloudfront create-invalidation \
            --distribution-id ${{ vars.CLOUDFRONT_ID }} \
            --paths '/*'

External links

Exercise

AWS 워크로드 있으면 IAM Identity Provider + role 설정하고 deploy 하나를 정적 key 에서 OIDC 로 마이그레이션. Trust Relationship JSON 이 까다로운 부분 — 단일 repo + branch 로 scope.

Progress

Progress is local-only — sign in to sync across devices.
이 페이지에서 버그를 발견하셨거나 피드백이 있으세요?문제 신고

댓글 0

🔔 답글 알림 (로그인 필요)
로그인댓글을 남기려면 로그인해 주세요.

아직 댓글이 없어요. 첫 댓글을 남겨보세요.