I created two APIs, https://test.execute-api.us-east-1.amazonaws.com/api/dev
and https://test.execute-api.us-east-1.amazonaws.com/api/prod
, both have GET method enabled but when I attach a resource policy to allow access to the /prod api from a IP, it is denying access to /dev apis as well from all other IPs. I am not sure what I am doing wrong here. There is no type of authorization that I am using for these APIs.
The policy that I used:
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": "*",
"Action": "execute-api:Invoke",
"Resource": [
"arn:aws:execute-api:us-east-1:{accountid}:{api-id}/*/api/prod"
],
"Condition": {
"IpAddress": {
"aws:SourceIp": "10.0.0.1"
}
}
}
]
}```
The error I am getting is
`{"Message":"User: anonymous is not authorized to perform: execute-api:Invoke on resource: arn:aws:execute-api:us-east-1:********:{api-id}/api/GET/dev"}`
I tried changing some resource policy settings but nothing helped.