I have configured an API Gateway endpoint in AWS, and am trying to secure it using its access policy.
I am aware that it's possible to limit the access of the endpoint to specific IP addresses, but is it also possible to restrict access based on the host that is calling the API? AWS has docs on examples of these access policies, as shown below:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": "*",
"Action": "execute-api:Invoke",
"Resource": [
"arn:aws:execute-api:region:account-id:api-id/*"
]
},
{
"Effect": "Deny",
"Principal": "*",
"Action": "execute-api:Invoke",
"Resource": [
"arn:aws:execute-api:region:account-id:api-id/*"
],
"Condition" : {
"IpAddress": {
"aws:SourceIp": ["192.0.2.0/24", "198.51.100.0/24" ]
}
}
}
]
}
For example, I have an application www.example.com. I want to add something in the access policy to only allow www.example.com to successfully submit a request to the API.