Best way to publicly host a website of HTML/JS files and connect them to a RDS database?

0

I already have a working public domain and a S3 bucket for the HTML files. I also have a RDS database that is connected to a MySQL database. I would like to be able to run queries on the RDS database and dynamically display, sort, add, remove, and update records based on site user inputs. For example, I have a basic search function, and I would like that search function to run a query to select the relevant records from the database and display them on the site. Is there a way I can accomplish this within S3, or is there another platform I should use within AWS?

1개 답변
4

You're about half way there, now you need to create the dynamic part of your site.

You will want to create an API Gateway with endpoints backed by Lambda functions. You can then call the API Gateway endpoints from the HTML/JS hosted in your S3 bucket to retrieve information from your MySQL database. I would also recommend putting CloudFront in front of your S3 hosted website to provide caching of your HTML/JS/CSS files as well as saving some potential cost on S3 data transfer.

Here's some great information about getting started with API Gateway and Lambda functions: https://docs.aws.amazon.com/apigateway/latest/developerguide/getting-started-with-lambda-integration.html

Also here's some great documentation about how to connect Lambda to RDS: https://docs.aws.amazon.com/lambda/latest/dg/services-rds-tutorial.html

profile pictureAWS
전문가
Chris_G
답변함 2년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠