简体   繁体   English

如何使用 S3 在 aws 中设置静态站点 - 是否有视觉指南?

[英]How to set up static site in aws using S3 - is there a visual guide?

There are a bunch of tutorials that go over:有一堆教程可以参考:

  • creating the public bucket创建公共存储桶
  • updating DNS in Route 53在 Route 53 中更新 DNS
  • Setting permissions and policies设置权限和策略

But they all seem incomplete and there seem to be a large number of gotchas to know.但它们似乎都不完整,而且似乎有很多问题需要了解。

Is there a set of screenshots to help reveal some of the mysteries to those of us who love to learn visually ?是否有一组屏幕截图可以帮助我们这些喜欢视觉学习的人揭示一些奥秘?

First create the bucket.首先创建存储桶。
The name will need to be unique across aws so you may easily find your first choices is already taken.该名称在 aws 中必须是唯一的,因此您可能很容易发现您的第一个选择已经被采用。

在此处输入图片说明

For (a different) example I was able to use my initials as a prefix.对于(不同的)示例,我可以使用我的首字母作为前缀。

在此处输入图片说明

Configure options (below) - you can leave all these blank to get started !配置选项(如下) - 您可以将所有这些留空以开始使用!

在此处输入图片说明

Then find the 'Static Website Hosting' section:然后找到“静态网站托管”部分:

在此处输入图片说明


And allow public access:并允许公共访问:

在此处输入图片说明

ie Unchecking it (I haven't tested individual boxes)即取消选中它(我还没有测试过单个盒子)

在此处输入图片说明


It's the first option for 'use this bucket to host a website'.这是“使用此存储桶托管网站”的第一个选项。 Don't be confused by the Redirect requests, you'll deal with an a DNS alias for a redirect in Route53不要被重定向请求所迷惑,您将在 Route53 中处理重定向的 DNS 别名

Note that this is where you can see the S3 endpoint that you'll use in DNS / Route53 below.请注意,您可以在此处看到将在下面的 DNS / Route53 中使用的 S3 端点。

在此处输入图片说明

OK so now for Route53 which was harder to find good examples.好的,现在对于 Route53 来说,很难找到好的例子。
Note that the names are generic请注意,名称是通用的
The key parts are:关键部分是:

  • Adding the 'A' record (for IPv4)添加“A”记录(对于 IPv4)
  • Point the alias to s3-website.us-east-2.amazonaws.com - and knowing that "website" is NOT replaced with your site name or anything.将别名指向 s3-website.us-east-2.amazonaws.com - 并且知道“网站”不会替换为您的网站名称或任何内容。 You literally use the that exact URL that I have (allowing for different regions).您确实使用了我拥有的确切 URL(允许使用不同的区域)。

在此处输入图片说明

For verification:验证:

在此处输入图片说明

在此处输入图片说明

One more - here's the policy you need to add.还有一个 - 这是您需要添加的策略。 A critical piece:一个关键的部分:

在此处输入图片说明


One last gotcha - once you have the site working, when you go to update future content to the bucket you will see:最后一个问题 - 一旦您的网站正常工作,当您将未来的内容更新到存储桶时,您将看到:

在此处输入图片说明

Know that you don't need to change that.知道你不需要改变它。 You can leave it as the default and the content will be available on the site anyway:您可以将其保留为默认值,无论如何,该内容在网站上可用:

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM