Previous Lecture Complete and continue  

  AWS Services for Containers

So first of all, containers, how you can use containers with AWS. There are multiple ways. One of the ways is to just create an EC2 instance, which is like a VM. You'd create it, install Docker engine inside of it, and you would basically run your container. Kind of a manual way, but offers you a lot of customization. Pretty much anything you want to do, you can do it with EC2s. Then there is Elastic Container Service. Elastic Container Service under the hood will also create an EC2 for you but then ECS will do way, way more things for you. It could create a load balancer, it could create an auto-scaling group, it could create a registry, it could create a lot of other things, such as monitor for health, etc., etc. So that's what we would be using and that's what I recommend to you is Elastic Container Service. And then under the Elastic Container Service, there is Elastic Container Registry. Now that's basically storage for your images. So first, you would push your image, you would upload your image to the cloud, and then you would deploy it. You would run it… you would run the container from the registry. Then there is also Elastic Beanstalk. It's a platform as a service. So primarily, it supports just plain code, not containers. But then, they added containers as well. So mostly, Elastic Beanstalk is used when you just have one container. When you have two or more containers in your project and they need to be deployed in the same network, so Elastic Container Service is a better option. Also, Elastic Beanstalk doesn't provide you all the full spectrum of the production level features that you might need with ECS. ECS provides those. And then there is Docker Enterprise Edition for AWS. It's a special blueprint which you can use in CloudFormation service and that will create an infrastructure for you which you can use. And also, I highly recommend using a managed database such as RDS. We would be deploying a Mongo database as a separate container, and it could be good for caching purposes, but for like a normal traditional kind of database, relational, and for data storage you don't want to create your own container. You want to use a managed database such as RDS. So do-it-yourself approach, that's EC2. I've already explained to you briefly, but the whole idea is that you get an Amazon Linux or any other AMI and install Docker Engine. You can get AMI, which stands for Amazon Machine Image, with Docker Engine as well. And then you can also use a CloudFormation blueprint, which refers to one of the Docker images. You don't have to create that instance manually. You can use AWS CLI. Of course if you want to do it manually, you can use Web Console or AWS CLI and then in the User Data, you can configure a lot of install scripts just install Docker Engine or maybe install your code or run Docker Build or something like that. So it's do-it-yourself approach but as I mentioned, ECS, it's a better alternative because it does more things for you. You can monitor, create Elastic Load Balancers, create autoscaling, check for health of the containers. If for example one container fails, ECS can restart it. Storage for container images which can be used with ECS, that's our registry. And then as far as Elastic Beanstalk goes, it's ideal for small containers and for small applications. This is a schema from the Docker Enterprise Edition. So CloudFormation, it's a special mechanism that AWS uses to provision the entire stack. So as you can see, there are a lot of resources in this Enterprise Edition but it was just one command using this blueprint. In CloudFormation, you can create this entire stack and then deploy your containers inside. RDS, that's AWS-managed databases. I highly recommend using one of those if you need a relational database. If you have to use MongoDB or some other exotic database like CouchDB or Cassandra, then there are other services which are not part of AWS, such as Compose, mLab, etc. They're also managed, but you can use them together with AWS. You don't have to just use only AWS.

0 comments