In this video you will explore partially managed in hosting websites in compute using Beanstalk and additionally applying Docker. The other area that you're going to explore is the Amazon Elastic container service for your Docker containers. Lynn will show you how your solutions automatically are registered in the EC2 container service.
- [Voiceover] This whole idea of partially managed is really new in hosting websites in Compute. In the past, you just had a virtual machine EC2 so in addition to what Beanstalk offers there's another game in town. And to get us thinking about that I'm going to go back and click on Beanstalk, and I'm going to click on Create New Application, and I'm going to call it myDocker, and I'm going to call it demo, I'm going to click Next, and I'm going to Create a web server.
And on my Select a platform you'll notice at the bottom I have something called Docker or Multi-container Docker and before I do this I'm going to talk a little bit about Docker. The idea of Docker has to do with application virtualization so in plain English, before Docker, in order to host Compute or websites on multiple machines we would normally have a physical machine and then we would have multiple virtual machines on that.
If you see on the left for the virtual machines that each time that you have a website App one, App two, App three you're going to have a complete copy of the Guest Operating System. So if you're in Linux you'd have three copies of Linux. Well, that can be kind of inefficient because really do those three Applications need three entire copies of Linux? So out of work that was actually done at Google that was then open sourced Docker was created. So what is it in essence? If you look on the right you can see that we have the same physical machine and we have three virtualizations, so three copies of our website.
The big difference, though, is that we have a small, little agent on each one of our Instances which are called Containers. We have only one copy of the Operating System and this is tremendously more efficient in terms of the use of storage space in Compute because the Operating System only has to run once not three times. So when you're thinking about scaling on the Cloud, using resources, storage, and Compute more efficiently translates into saving time and money.
You can scale up your websites more quickly and more efficiently using Containers. So how do they work and how does this relate to Elastic Beanstalk? Let's take a look. So we were in Beanstalk, and we were going to set up a new website, and we were looking in the platforms, and we had the ability to select a sample with either a single Docker container or a Multi-container Docker. Let's do the second one. So now we're told that we're going to have a Beanstalk sample that's going to run Multi-container Docker on Linux.
The environment type will be Load balancing and auto scaling. We could use a Single instance and if you're new to Docker I recommend that you start with Single instance but I want to show you the full capabilities so we'll use Load balancing and auto scaling for multiple instances and we'll click Next. To keep things straightforward we are going to use the Sample application. Of course, you would be writing the code for your own website and you would uploading it as a ZIP file as is required for Elastic Beanstalk. In addition, you would need to have a Docker file which is a single page text file that provides the configuration to the Docker agent on how you want your Containers to be set up.
Notice, you could get your code and Docker file from an S3 bucket, alternatively to uploading it directly. I'm going to scroll down and we'll take a look at the Deployment Preferences. So you could have a Rolling Deployment, you could have All at once, you could have a Rolling in a batch, or you could have Immutable, not changing. Rolling is default so what this means is that when you're Deploying as it says you can avoid downtime. This a really sophisticated capability that many of my customers use so that they can implement Agile practices like continuous Deployment, pushing new features out across their Containers and making those features just become emergent for more and more of their customers.
We have the ability to set a Healthy threshold, and we can ignore health checks, and we can say what percentage will update at a time. Another reason for this capability is if you want a A/B test website features and you want to put it out to a really small percentage of the total capacity you can set that or you can set it by Instance. And I'm going to click Next. So this is my Docker Environment. This will be the default URL which of course you would map to a real URL for production website.
We're going to check the availability and this is a common one so we'll put a number at the end here and that one's okay. They have to be unique within Amazon, we'll click Next. We could create an RDS database Instance with this environment and we saw this in an earlier movie. More complex websites generally have one or more backing data source because we've done this we're not going to do it in this movie. And again, we could create this inside of a VPC and because we've seen that in earlier movies we're not going to do it. These are common configurations though when you are setting up complex websites with Elastic Beanstalk and Containers so that's why Amazon presents them here.
We'll click Next. Here we set the Instance type and these are EC2 Instances. And you can do everything from the new, super tiny nanos which is not common, from micros all the way up to extra large. I'll remind you that the appropriate Instance selection is really, really important to having an effective website so you're going to use monitoring to determine what's going to be best for you. For testing, I usually just use m1.smalls. Here's the key pair in case you need to log into your Instances.
And if you're using Linux you'd SSH, you can put in notification email, health check, put in the type of updates so Rolling or Time based updates. You've got load balancing. You have something called Connection draining which means the Load Balancer will maintain the Connections this is the emergent feature as you're pushing out new code so in other words, when a customer disconnects if there was new code they would get their new website but it wouldn't disconnect a currently connected customer. And then what you're Booting from, and the size of your Root volume, and click Next.
And then our good old Tagging so we'll call this dev and it's reserved so I'll just call it myenvironment, there we go, and dev. I'll remind you on Tags they're case sensitive that's why we're getting those red warnings. And now we have to have Permissions so these are IAM roles because we're communicating across not only Beanstalk but we're using Network Services, we're using Load Balancers, and we're using Docker Registry as well, and we'll click Launch.
As with our previous movie this is going to set up with a Sample Application with this URL. Notice now the configuration is Linux running Docker. Now we don't have a runtime here so we would have to install Node if we were continuing on with our Node example. If we're using Python we'd have to install Python runtime, so on and so forth. And once you become more sophisticated with this you can actually point to an underlying EC2 image that has that runtime on it.
But when you're just getting started it's best to kind of separate these things out and just work on understanding Docker first and then install your runtime manually. So as with the other Beanstalk this is going to take about five minutes so I'll let this spin up and then we'll take a look at it. Okay, you can see that this worked and if I go out here's the website. One other area that you're going to want to explore is the Amazon Elastic Container Service so I'll just open this up really briefly and show you that these Docker Containers that were created for this solution automatically are registered in the EC2 Container Service.
It might be a little confusing because we're using Beanstalk but remember everything's EC2 under the hood. So if I click into here you'll see that I have a Cluster, and I have a Container Instance, and I have ECS Instances. Again, really going through this in detail is beyond the scope of what I'm doing here but be aware that this Container Service works in conjunction with the Load Balancer to accomplish keeping your website up and scaled when you use Elastic Beanstalk with Docker Containers.
Starting with top-level categories of storage, data, computer, and services, Lynn guides you through planning your ideal AWS architecture, providing service demos using the AWS Console, command-line interface, and other tools. Learn when to use which service for which business case, such as Docker or Lambda or DynamoDB or Aurora? She shows how to script creation of services such as S3 buckets and EC2 instances, create and populate a managed data warehouse, and develop a data processing pipeline that works for you. Chapter 6 covers the AWS Internet of Things (IoT) services.
These exercises can help you build proof-of-concepts, minimum viable products, and deployable solutions to scale and support big data initiatives at your company.
- Setting up your AWS account
- Using AWS tools
- Defining your minimum viable products
- Choosing computer, storage, and data services
- Using S3, EC2, or Docker for website hosting
- Developing an AWS website
- Using a data warehouse
- Developing a data processing pipeline
- Developing an Internet of Things project with AWS