- Hands-On Artificial Intelligence on Amazon Web Services
- Subhashini Tripuraneni Charles Song
- 450字
- 2021-06-24 12:48:48
Deploying a static website via AWS S3
Next, let's deploy the frontend web user interface to AWS S3.
One of the buckets we created in the previous chapter was for the purpose of website hosting. Let's configure it via the AWS Management Console for static website hosting:
- Navigate to the Amazon S3 service in the management console and click on your bucket.
- In the Properties tab, as shown in the following screenshot, click on the Static website hosting card:

- When you click on the Static website hosting card, a configuration card will pop up.
- Select Use this bucket to host a website and enter index.html and error.html for the Index document and Error document fields, respectively.
- Copy the Endpoint URL on your configuration page and then click Save. This endpoint URL will be the public address of your static website:

- Next, we can upload the index.html and scripts.js files to this S3 bucket. Before we do that, we need to make a change in scripts.js. Remember, the website will be running in the cloud now, and won't have access to our local HTTP server.
- Replace the local server URL in the scripts.js file with the one from our backend deployment, as follows:
"use strict";
const serverUrl = "https://<UID>.execute-api.us-east-1.amazonaws.com/api";
...
- Finally, set the permissions of the index.html and scripts.js files to publicly readable. To do that, we need to modify the S3 bucket permissions under the Permissions tab.
- Click on the Public access settings button, uncheck all four checkboxes, and then type confirm to confirm these changes. This will allow the contents of this S3 bucket to be made publicly accessible, as follows:

- Now, we are able to make the files public by selecting both files, clicking on Actions, and clicking on Make public, as shown in the following screenshot:

Open the S3 endpoint URL in your browser. The URL should look something like http://<BUCKET>.s3-website-us-east-1.amazonaws.com/.
Your ObjectDetector website is now running in your browser and it's communicating with the backend running on AWS to demo your intelligent-enabled application's capability. Both the frontend and the backend are serverless and both are running on the AWS cloud infrastructure, which scales automatically with demand.
Congratulations! You've just developed an end-to-end AI application to AWS! You can now share this AI application with anyone in the world with a browser.
- 我的J2EE成功之路
- 協(xié)作機(jī)器人技術(shù)及應(yīng)用
- 極簡(jiǎn)AI入門(mén):一本書(shū)讀懂人工智能思維與應(yīng)用
- Getting Started with Containerization
- CSS全程指南
- 返璞歸真:UNIX技術(shù)內(nèi)幕
- 80x86/Pentium微型計(jì)算機(jī)原理及應(yīng)用
- 四向穿梭式自動(dòng)化密集倉(cāng)儲(chǔ)系統(tǒng)的設(shè)計(jì)與控制
- 數(shù)據(jù)掘金
- 聊天機(jī)器人:入門(mén)、進(jìn)階與實(shí)戰(zhàn)
- Windows Server 2003系統(tǒng)安全管理
- Excel 2007常見(jiàn)技法與行業(yè)應(yīng)用實(shí)例精講
- LMMS:A Complete Guide to Dance Music Production Beginner's Guide
- Excel 2010函數(shù)與公式速查手冊(cè)
- 基于Proteus的單片機(jī)應(yīng)用技術(shù)