Wednesday, July 8, 2020

Running Docker In Production Using Amazon ECS

Running Docker In Production Using Amazon ECS Running Docker In Production Using Amazon ECS Back Home Categories Online Courses Mock Interviews Webinars NEW Community Write for Us Categories Artificial Intelligence AI vs Machine Learning vs Deep LearningMachine Learning AlgorithmsArtificial Intelligence TutorialWhat is Deep LearningDeep Learning TutorialInstall TensorFlowDeep Learning with PythonBackpropagationTensorFlow TutorialConvolutional Neural Network TutorialVIEW ALL BI and Visualization What is TableauTableau TutorialTableau Interview QuestionsWhat is InformaticaInformatica Interview QuestionsPower BI TutorialPower BI Interview QuestionsOLTP vs OLAPQlikView TutorialAdvanced Excel Formulas TutorialVIEW ALL Big Data What is HadoopHadoop ArchitectureHadoop TutorialHadoop Interview QuestionsHadoop EcosystemData Science vs Big Data vs Data AnalyticsWhat is Big DataMapReduce TutorialPig TutorialSpark TutorialSpark Interview QuestionsBig Data TutorialHive TutorialVIEW ALL Blockchain Blockchain TutorialWhat is BlockchainHyperledger FabricWhat Is EthereumEthereum TutorialB lockchain ApplicationsSolidity TutorialBlockchain ProgrammingHow Blockchain WorksVIEW ALL Cloud Computing What is AWSAWS TutorialAWS CertificationAzure Interview QuestionsAzure TutorialWhat Is Cloud ComputingWhat Is SalesforceIoT TutorialSalesforce TutorialSalesforce Interview QuestionsVIEW ALL Cyber Security Cloud SecurityWhat is CryptographyNmap TutorialSQL Injection AttacksHow To Install Kali LinuxHow to become an Ethical Hacker?Footprinting in Ethical HackingNetwork Scanning for Ethical HackingARP SpoofingApplication SecurityVIEW ALL Data Science Python Pandas TutorialWhat is Machine LearningMachine Learning TutorialMachine Learning ProjectsMachine Learning Interview QuestionsWhat Is Data ScienceSAS TutorialR TutorialData Science ProjectsHow to become a data scientistData Science Interview QuestionsData Scientist SalaryVIEW ALL Data Warehousing and ETL What is Data WarehouseDimension Table in Data WarehousingData Warehousing Interview QuestionsData warehouse architectureTalend T utorialTalend ETL ToolTalend Interview QuestionsFact Table and its TypesInformatica TransformationsInformatica TutorialVIEW ALL Databases What is MySQLMySQL Data TypesSQL JoinsSQL Data TypesWhat is MongoDBMongoDB Interview QuestionsMySQL TutorialSQL Interview QuestionsSQL CommandsMySQL Interview QuestionsVIEW ALL DevOps What is DevOpsDevOps vs AgileDevOps ToolsDevOps TutorialHow To Become A DevOps EngineerDevOps Interview QuestionsWhat Is DockerDocker TutorialDocker Interview QuestionsWhat Is ChefWhat Is KubernetesKubernetes TutorialVIEW ALL Front End Web Development What is JavaScript â€" All You Need To Know About JavaScriptJavaScript TutorialJavaScript Interview QuestionsJavaScript FrameworksAngular TutorialAngular Interview QuestionsWhat is REST API?React TutorialReact vs AngularjQuery TutorialNode TutorialReact Interview QuestionsVIEW ALL Mobile Development Android TutorialAndroid Interview QuestionsAndroid ArchitectureAndroid SQLite DatabaseProgramming m sure youve heard about the Docker hype in the tech industry these days. Docker has made running applications on any kind of environment super easy. Do you know what makes Docker even more efficient? Using it with Amazons ECS. This article on Amazon ECS gives a detailed explanation of using Docker in production using Amazon ECS.Agenda For This Article:Introduction to DockerIntroduction To Amazon ECSHow ECS worksFeatures And Benefits of using ECSDemo: Run A Docker Image In Production Environment Using Amazon ECSIntroduction to DockerDocker is a software development platform. Its based on the concept of containerization. It wraps the application along with all its dependencies into a single container image. This container can be deployed on any platform to run that application. So basically these applications run exactly the same regardless of where they are running or on what system theyre running on. It uses an online cloud repository called DockerHub to store all these container images.Introduction to Am azon ECSNow that youve understood Docker, lets have a look at ECR. As part of container services platform, AWS provides Amazon EC2 Container Registry (Amazon ECR). Its a fully managed docker container registry.Now you have your containers, all you need is a platform to host them. This is where ECS come into the picture.ECS stands for Elastic Container Service. Its a container management service. Running, stopping or managing Docker containers on an ECS cluster is like taking a walk in the park. You can launch, stop or scale any container-based applications by just making a few simple API calls.Im sure you guys would have heard the term microservices which is pretty hot in the tech market right now. Amazon ECS can let you create consistent deployment by building sophisticated application architectures on the microservices model.ECS also keeps a track of your instances along with their resources. In the above diagram, There is a request to run two containers. ECS will look for instanc es that have the resources to run these containers,download the containers from the registry and deploy them on the containers accordingly.How ECS WorksNow that youve understood the theoretical concepts lets dig a little deeper into how ECS works. Lets take a very common scenario, say youre running an application that uses two docker container. For instance, one container has the actual application and the other has all the dependencies. You need both of these to successfully run the application.Amazon ECS consists of the following:Task DefinitionTask definition is basically the blueprint describing the docker containers that are used to run the application. In our case, it will be the two docker containers, details of the images used, the CPU memory to be allocated, environment variables to be declared and used, ports to expose, etc.TaskA task is an instance of the task definition. It runs the container along with the container details mentioned in the task definition. Multiple tas ks are created by a single class definition as and when required.ServiceService defines the minimum and the maximum tasks that are running from a single task definition at any given point. In our example, if there is one task running from a task definition and if the CPU gets maxed out, ECS adds another task. At the point, the service would be 2 as two tasks are running from one task definition.ECS Container Instance And ECS Container AgentEvery docker container will run on an EC2 instance. Such EC2 instances are called ECS Container Instance.Every ECS container instance will have an ECS Container Agent running on it. This agent communicates between the instance and ECS which helps in managing the running containers or even adding new ones.ClusterWe now have the task definition, tasks, and services. All we need is a platform to hosts these. That platform is the cluster. A cluster is a group of ECS container instances. A cluster can run many services. For instance, you have multiple applications as a part of your project, you can run several of them on a single cluster. This reduces the wastage of the resources and indirectly saves your money.Features And Benefits Of Using ECSIt lets you run application containers in a highly available manner across multiple Availability Zones within a RegionIt lets you use containers without infrastructure management.You can containerize anything and everything and let ECS manage it.Its super secure as you can store your container images on EC2 container registry which is very safe as your images are encrypted at rest.Another amazing feature of ECS which I honestly love is that it keeps the IAM roles separate for every task. The control access to every task is very guided.Demo: Run A Docker Image In A production Environment Using Amazon ECSIn this demo, Im going to show you how to use Amazon ECS and run a docker image on it. Lets get started.Go to Amazons login page and sign in if you already have an account. If you dont, then go ahead and create a free account. This is the console that youll see once youve logged in.Type in ECS and click on that service. Youll see a Get started button if you havent created a cluster before. Go ahead by clicking on Get Started.Running a docker image on AWS ECS has 4 main steps, Container definition, Task definition, Service, Cluster.Configure Container Definition:Select an image for your container. You have 4 options A sample application image, Nginx image, tomcat-webserver, and a custom image.For this demo, Ive chosen the sample-app.Click on edit on the top right corner if you wish to change the configuration.You can edit the container name, the image to use, Memory limits, Port mappings, Healthcheck configurations, Environment configurations, Container timeout configurations, Network settings, Storage and Logging configurations, Resource limits, and Docker Labels.For this demo, Ive used all the default configurations.Configure Task Definition:It consists of Task defin ition name, Network mode, Task execution role, capabilities, task memory, and Task CPU.You can click on Edit on the top right corner and configure according to your needs. For this demo, Im using all the default configurations. Once youre done, click on Nexton the bottom right corner.Configure Service: You can go ahead and change the Service name,Number of desired tasks,Security Group and Select the Load balancer type. For this demo, I havent used a load balancer. Click on Next.Configure Cluster: Configure your cluster by adding a Cluster nameand click on Next.Review:Once youve configured everything, you should see something like this.Review everything and click on Createon the bottom right corner. All the services will now get created. This might take about 10 mins.Once everything has the completed status, click on View ServicesYoull see something like this. Its going to show you your cluster details, task definition and an option to delete and update it.You can check further detai ls like the VPC, Subnets, Tasks, Events, Autoscaling, Deployments, Metrics, Tags and Logs.Now go ahead and click on task to check out the deployed container.Click on the task nameas shown below.Click on ENI Id under the Network section.Youll be taken to the Network Interface page which would look like this:Scroll down and youll see your IPV4 Public IP. Copy it.Paste it on any browser like a URL. Youll see the docker container output there. Youll see your sample-app.This was just a sample-app. You can run any kind of application or any kind of Docker image in just a few steps.This brings us to the end of this Amazon ECS article. You can integrate this service with various DevOps tools and can make the building process easier. I hope this blog was helpful.For more such blogs, visit Edureka Blog.If you wish to learn more about Cloud Computing and build a career in Cloud Computing, then check out ourCloud Computing Courseswhichcomes with instructor-led live training and real-life projec t experience.This training will help you understand Cloud Computing in depth and help you achieve mastery over the subject.Got a doubt? Please mention it in the comments sectionorpost it onEdureka Community and we will get back to you. At Edureka Community we have more than 1,00,000+ tech-fanatics ready to help.Recommended videos for you AWS Tutorial A Complete Tutorial On Amazon Web Services Watch Now Building Scalable Application on Cloud Watch Now Architecting in Cloud-III Watch Now Power The Hadoop Cluster With AWS Cloud Watch Now Efficient Disaster Recovery with Cloud Computing Watch Now Microsoft Azure Tutorial Step-By-Step Tutorial In Azure Watch Now AWS Vs Azure Cloud Platform Comparison Watch Now Architecting in Cloud-II Watch Now What Is AWS Getting Started With AWS Watch Now What Is Cloud Computing? A Beginners Guide To Understanding Cloud Watch Now AWS vs Google Cloud Cloud Platform Compared Watch Now AWS Certifications All You Need To Know Watch Now Cloud Computi ng with AWS II Watch NowRecommended blogs for you Skills You Should Learn To Become A Cloud Engineer Read Article What is Identity and Access Management(IAM) in AWS? Read Article What is AWS CLI? Know its Applications and Benefits Read Article Google Cloud Services : All You Need To Know About GCP Services Read Article How To Develop A Chat Bot Using Amazon Lex? Read Article AWS Certification â€" All you need to know Read Article Introduction to Internet of Things: IoT Tutorial with IoT Application Read Article How To Create Hadoop Cluster With Amazon EMR? Read Article How to Launch an EC2 Instance From a Custom AMI? Read Article Top AWS Architect Interview Questions In 2020 Read Article Salesforce Developer Tutorial: Get Started With Salesforce Programming Read Article All you need to know about Amazons Network Load Balancer Read Article Amazon Elastic Block Store Tutorial: All You Need To Know Read Article AWS Snowball and Snowmobile Tutorial Read Article ServiceNow Tutorial: Get ting Started With ServiceNow Read Article Big Data In AWS Smart Solution For Big Data Read Article Introduction to Amazon CloudWatch Read Article Microservices Security How To Secure Your Microservice Infrastructure? Read Article Top 50 Salesforce Interview Questions And Answers You Must Prepare In 2020 Read Article Salesforce Tutorial: Learn To Create Your Own Salesforce App Read Article Comments 0 Comments Trending Courses in Cloud Computing Microsoft Certified Expert: Azure Solutions A ...6k Enrolled LearnersWeekendLive Class Reviews 5 (2250)

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.