Error: User: *** is not authorized to perform: sts:AssumeRole on resource: *** Github

257 views Asked by At

I think this is a silly question but I can not find its answer on the internet. I have tried many things but nothing works.

I get the below error. enter image description here

And is my deploy.yml file.

name: Deploy to production

on:
  push:
    branches: [ "main" ]

jobs:

  build:
    name: Build image
    runs-on: ubuntu-latest

    steps:
      - name: Checkout code
        uses: actions/checkout@v3

      - name: Configure AWS credentials
        uses: aws-actions/configure-aws-credentials@v2
        with:
          role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}
          aws-region: ap-south-1
          aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
          aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}

      
      - name: Login to Amazon ECR
        id: login-ecr
        uses: aws-actions/amazon-ecr-login@v1

      - name: Build, tag, and push docker image to Amazon ECR
        env:
          REGISTRY: ${{ steps.login-ecr.outputs.registry }}
          REPOSITORY: simplebank
          IMAGE_TAG: ${{ github.sha }}
        run: |
          docker build -t $REGISTRY/$REPOSITORY:$IMAGE_TAG .
          docker push $REGISTRY/$REPOSITORY:$IMAGE_TAG

Thanks

Edit

on Amazon Elastic Container Registry Permission, I have added below policy but still not working.

enter image description here

Answer

I have removed role-to-assume from deploy.yml file and used v1 with secret keys and it works fine. but I still get answer with role-to-assume .

0

There are 0 answers