Home > Blockchain >  API Gateway does not have permission to assume the provided role for EC2 instance
API Gateway does not have permission to assume the provided role for EC2 instance

Time:04-01

I am using AWS API gateway for an API deployed in ec2 instance. I have already created role for it using IAM in AWS and added all the permissions as shown in the below. but while testing api i am getting this error API Gateway does not have permission to assume the provided role.

Trust Entities

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Principal": {
                "Service": "ec2.amazonaws.com"
            },
            "Action": "sts:AssumeRole"
        }
    ]
}

enter image description here

CodePudding user response:

Based on the comments.

For the role to be assumable by an API gateway, apigateway.amazonaws.com principal needs to be used:

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Principal": {
                "Service": "apigateway.amazonaws.com"
            },
            "Action": "sts:AssumeRole"
        }
    ]
}
  • Related