科技美学

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

1.0 前言

 玩startup項目,想快速建立靜態HTML網站。

 

2.0 S3架設靜態HTML網站

2.1 Create S3 bucket

 建立新的S3桶。

2.2 General S3 Config

填寫S3桶名。

剔除"禁止公開訪問",剔選"已知風險"。

2.3 S3 Permissions

 進入“my-s3-html-example”桶,再到Permissions頁面。

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "PublicReadGetObject",
            "Effect": "Allow",
            "Principal": "*",
            "Action": "s3:GetObject",
            "Resource": "arn:aws:s3:::my-s3-html-example/*"
        }
    ]
}

  在Bucket Policy里新增這段代碼。其中Resource是指向S3桶名,“my-s3-html-example”。

2.4 取得公眾訪問連接

 進入index-cn.html,尋找物件URL,就會獲得公開訪問URL。

 

3.0 自訂域名 (但没有HTTPS)

3.1 創建兩個buckets

abc.example.com
www.abc.example.com

  abc.example.com 是html/images/css/javascript檔案。 www.abc.example.com 是空的bucket。

3.2 進入 www.abc.example.com bucket

Hosting type: Redirect request

Bucket website endpoint: http://www.abc.example.com.s3-website-us-east-1.amazonaws.com 

3.3 Route53 Redirect

Record name: abc.example.com
Recrod type: A
Route traffic to: Alias to S3 website endpoint -> abc.example.com
Routing policy: Simple routing

3.4 完成

http://www.abc.example.com/

  這方法不支持HTTPS

 

posted on 2024-10-23 15:08  chankuang  阅读(24)  评论(0)    收藏  举报