Reputation:
So I have setup up an AWS API Gateway in front of my RESTFUL Flask API hosted on an EC2 instance and served with gunicorn but it gave me a really ugly endpoint to hit, is there a way I could get it on to a custom url?
I've been given this url https://123x123x.execute-api.eu-west-2.amazonaws.com/myendpoint/
I'd like to have one like https://myurl.net/myendpoint
Upvotes: 1
Views: 485
Reputation: 174
The short answer is:
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "AllowCloudFrontUpdateDistribution",
"Effect": "Allow",
"Action": [
"cloudfront:updateDistribution"
],
"Resource": [
"*"
]
}
]
}
https://123x123x.execute-api.eu-west-2.amazonaws.com/myendpoint/
myurl.net
domaina1b2c3d4e5f6.cloudfront.net
The longer answer from AWS is detailed here: https://docs.aws.amazon.com/apigateway/latest/developerguide/how-to-custom-domains.html
Note: This can also be managed to a great extent with the AWS API Gateway REST API: https://docs.aws.amazon.com/apigateway/api-reference/link-relation/domainname-create/
Upvotes: 1