Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
431 views
in Technique[技术] by (71.8m points)

amazon web services - Setting up a custom domain with AWS Api Gateway

I'm trying to setup an API Gateway integration using a custom domain that points to an Lambda function but I'm running into some issues. A lot of the docs seem show different screens to what I now see in the console.

I've created a Lambda function and setup an API Gateway trigger. I can see the API created correctly in API Gateway with an invoke url like:

https://foo.execute-api.eu-west-1.amazonaws.com

I've then tried to add my own custom domain e.g api.example.com which, when I click on for more details, has generated an API Gateway Domain Name similar to :

https://bar.execute-api.eu-west-1.amazonaws.com

I've then setup a mapping that maps this domain name to the API with the foo invoke url above.

API                    Stage        Path         Default endpoint
MY-API                 $default     (none)       Enabled

I've then tried to setup a geolocation redirect in Route53. When I choose to route traffic to 'an alias to API gateway API' the console only lets me choose the bar domain name rather than the foo invoke url.

I've tried manually setting this to the foo domain which is accepted (it sets this up as an A record using the wizard whereas I expected it to be a CNAME). This record looks like so when using the suggested domain:

api.example.com A   Geolocation Europe  bar.execute-api.eu-west-1.amazonaws.com.

Either way, when I try to visit my custom domain I receive an ERR_CONNECTION_REFUSED message. If I visit the BAR domain (the one API gateway created for my custom domain) I receive the same error.

If I visit my invoke URL this loads an actual error page (testing my lambda within the lambda console works however). I'm not sure if this is a just a red herring on the above but I thought I would add in that this is also erroring but in a different way.

I should also point out that SSL cert is created by AWS certificate manager and everything is in the same region

I appreciate there's a lot of parts of this and I've hopefully made the setup clear, but can anyone point me to how I should get my custom domain working here? I don't seem to have any logs that makes pinpointing an error clear

thanks

question from:https://stackoverflow.com/questions/65902829/setting-up-a-custom-domain-with-aws-api-gateway

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...