Interview Prep/CI/CD/GitHub Actions and GitLab CI in Production

How do you deploy to AWS EKS from GitHub Actions securely?

IntermediateProductionGitHub Actions and GitLab CI in Production
Answer

Assume an IAM role via OIDC, update kubeconfig, and deploy with Helm, or better, commit the new image tag to a GitOps repo so Argo CD deploys it and the workflow never needs cluster access. If you do push directly, map the IAM role to a Kubernetes RBAC role with access to only the target namespace via EKS access entries.

- uses: aws-actions/configure-aws-credentials@v4
  with:
    role-to-assume: arn:aws:iam::123456789012:role/gha-eks-deploy
    aws-region: ap-south-1
- run: |
    aws eks update-kubeconfig --name prod-cluster --region ap-south-1
    helm upgrade --install shop-api ./chart -n shop --atomic --set image.tag=${{ github.sha }}
All CI/CD questions Roadmap: GitLab CI/CD

More on GitHub Actions and GitLab CI in Production