- [Bobbie] Hi, and now I'm going to show you how to use S3 buckets to create a static, "serverless" website. We've already discussed why S3 is a great option. Now, let's do it. I want to clarify that when I say "static," I don't mean it can't be interactive. It can. You just can't use server-side processing code, like .NET or PHP. You can use a client-side script, like JavaScript. In my demo, I'm going to create a website that actually uses JavaScript to show you how easy it is. You can still set up your website to interact with other AWS services, like DynamoDB or API Gateway, and pull dynamic information by passing variables using query strings. I just bring that up so you are aware that your site can be dynamic, but your processing happens on the client side, or using a service like API Gateway. You will learn more about those services later on in this course. To host a static website, you configure an Amazon S3 bucket for website hosting, and then upload your website content to the bucket. This bucket must have public read access. It is intentional that everyone in the world will have read access to this bucket. The website is then available at the AWS Region-specific website endpoint. Instead of using the website endpoint for S3, you can also bring your own domain name - such as example.com - to serve your content. Amazon S3, along with Amazon Route 53, supports hosting a website at the root domain. For example, if you have the root domain, example.com, and you host your website on an Amazon S3 bucket, your website visitors can access the site from their browsers by typing in either example.com or www.example.com. For this demo, I'm going to use the AWS console, but you can also access S3 via the Command Line Interface and software development kits. Here we are inside of the AWS Management Console. I can select S3 from here, under my Recently visited services, or type it in using S3. Inside, this is actually going to show all of my buckets. And you will notice at the top right hand corner, it says Global, which lets me know that these are the all of the buckets in all the different Regions. You can see I have some in Northern Virginia, Oregon, and Ohio. I'm going to click on Create bucket. I have to come up with a unique bucket name. So, I'm actually going to use my last name and put a 200 behind it. I'm going to go ahead and keep it in the Northern Virginia Region. If I had other websites, I can actually just copy those policies here, instead of going through everything fresh. But for the sake of this demonstration, we're going to go through each screen. So I'm going to click on Next. Now, you'll notice that any time, I can actually click Create here at the bottom, we create the bucket. But we going to go through and set everything up the way we want it from here. I can choose to have Versioning. If you check to turn on Versioning, that means if I upload a new index page, for instance, maybe I overwrote something important, I would always have another version of that, that I can have access to. So this helps to prevent against accidental deletes. Not a requirement, something you can or cannot choose to turn on. I can also turn on logging for Server access logging. If this were going to be my production website, I may want to set the environment with the tag and say environment equals prod. You can add up to fifty different tags. I can also do Object-level logging and choose encryption. And for the Advanced settings, we have something called Object lock, and you can choose to do that for auditing purposes or for legal purposes. I'm actually going to leave everything at the default settings. Again, here is our CloudWatch metrics if we wanted to turn that on. This is important. This is talking about the public access for this bucket. And because this is going to be a website, I'm actually going to uncheck all of these. And I'm also, this is talking about the managing the system permissions, this is talking about allowing S3 Log Delivery. I'm going to turn that on, it's always a good thing to do logging. I'm going to click Next. And this is basically giving me an overview of my permissions and the different objects, object permissions that I chose. So I'm going to click on Create bucket. And you can see my bucket here - "atristain200" - is there, I'm going to click on that. First thing I need to do is go to Properties. Even though I made it open to the public, I want to say that this is going to be a static website. Because if do not, no one's going to be able to get to it still. So I'm going to say, Use this bucket. I have to identify my index document, which I'm going to stick with index.html. I do have an error.html, if I wanted to have redirects, I can do that. And, at anytime if I want to take this site offline, I can always disable that website hosting. So, I'm going to click Save on that, go back to Overview, and now we're actually going to upload our website. So I already have a site that I put together, it's on my desktop. I'm going to just grab those files, and choose all of these. And I have JavaScript in there, CSS, my HTML, and I'm going to click Next. And this is important, because if I do not change the public permissions to give everyone read access, no one's going to be able to see my website. So I said: Yes, I want public read access to these objects. I'm going to click Next. This is talking about the different type of storage classes. So, Standard is where I know that I'm going to be have replication happening in the background within my Region in Northern Virginia. For a website, you probably want to stick to Standard. If this were being used for other types of storage, something like Intelligent-Tiering or Standard- Infrequent Access, those are the options you might choose to be more frugal. But for a website, we're going to stay with Standard. I click Next, and say Upload. And so I can see the progress happening at the bottom. It's going to upload in a few seconds, it's uploading all those individual images and HTML files. And once it's done, I'm going to click on index.html. I'm going to see that URL and you will see that my website is going to be live. And it is done, so I'm going to go to index.html. I see, here is my S3.amazonaws.com, with my bucket name, atristain200. I'm going to actually do this in a new window. And this is the website that we just created. And so we have my three dogs, the 3 Amigos, Geist, Schatten, and Echo. And scroll down. Of course, I used this to talk about some of the important factors with Amazon S3. It's got some JavaScript things happening here with the menus. I put in, you know, things my dogs would like, so More Steak Please, Play Ball. But this is how easy it is, and because this website is hosted on S3, I don't have to worry about, is it going to be resilient? Because it is resilient, because it's a managed service from AWS. It's going to be cost-effective, again, because it is a managed service from AWS. And it's secure, because it's a managed service from AWS. So this is a great way that I can have a public-facing website and not have to worry about servers in the backend, scaling up or down. In the following lab, you're going to have the chance to do this all by yourself.