-
Introduction to AWS Fargate: How to build and deploy a web application using Docker and Python
Introduction
AWS recently launched Fargate which lets users build and deploy containerized applications without having to manage the underlying servers themselves. Previously, if you wanted to deploy a container on AWS, you would have to first provision a cluster and then deploy your container onto that cluster. This can add a lot of friction as a lot of developers want to be able to deploy their applications as quickly as possible without worrying about the underlying infrastructure.
Fargate makes deploying your containerized applications pretty easy and straightforward.
In this tutorial, we will create a Python web application using Flask and deploy it using Fargate.
If you are interested in learning about how Fargate works internally and how it compares to other AWS services, check out our new blog post here.
Prerequisites
-
virtualenv: Virtualenv is a tool to create isolated python environments. We will be using it to create an isolated environment for our application. Instructions for installation are available here.
-
Docker: We will be using Docker to containerize our python application. More information about Docker is available here.
-
News API: Since we will be building a simple news aggregator application, we need an API from where we can get the data. News API has a free developer tier which you can sign up for and get an API key. You can sign up by visiting this link.
-
-
How to Monitor & Reduce AWS EC2 and S3 Bill by 50%+
One of the benefits of using a cloud provider like AWS is the ease of spinning up resources such as a new EC2 instance or storing more data in S3. As developers, we are generally more focused on getting our product or feature to the users as quickly as possible. However, we generally don’t think about costs until we see the bill at the end of the month and are left wondering how we ended up spending so much money.
In this article, we will look at the different ways available to monitor and reduce your bill significantly.
Monitoring
Extensive monitoring is essential for reducing your costs and keeping them low in the future. Amazon provides a few tools to track your costs easily and accurately:
-
Cost Explorer: This is a tool which lets you view your costs easily. The tool shows historical data so that you can see how your cost is changing over time. The cost explorer also lets you filter based on a bunch of criteria such as the service, the region etc. More information about how to use the Cost Explorer is available here.
-
Use Tags everywhere: A tag is a label that can be assigned to any AWS resource. Tags can be used to organize your resources and can help in tracking costs in more detail. For example, if you wanted to know the cost of a particular feature or service, you could add tags to all the resources being used by that service and the cost report will be able to show you the cost for that service. More information about how to use tags for tracking cost is available here.
-
Create billing alerts: An important component of any good monitoring system is being able to alert based on certain conditions. AWS lets you create billing alerts that send notifications when the usage exceeds the defined thresholds. More information about how to create alerts is available here.
Once you start monitoring your costs, you should have a much better idea about which services and resources are the most expensive and what you want to optimize.
Let’s look at how to reduce the cost for some of the more popular AWS services.
-
-
AWS EC2 Instance Comparison: C4 vs C5
Amazon recently introduced the next generation of their compute-optimized instances: EC2 C5 instances. Compute instances are well suited to compute-heavy workloads such as batch processing, distributed analytics, high-performance computing etc.
If you are considering whether you should migrate your workload from the previous generation instance families to C5, then the next couple of sections should help with the decision.
What’s new in C5?
The C5 instances are powered by the Skylake processor from Intel. The Skylake processor has several improvements over the Haswell processor which is used in the C4 instance family.
Amazon has also introduced a new instance type for the C5 instance family, c5.18xlarge, which provides 72 vCPUs and 144 GB of memory. There is no comparable instance type in any of the previous instance families.
Comparing C4 and C5 instances
Let’s take a closer look at the differences between the two instance families.
-
How to create a blog on AWS using S3 in 3 easy steps
Why should you care about where to host your blog?
Have you ever had to face any of these issues with your site?
-
Reliability: Frequent downtime leading to bad user experience. There could be many reasons for this such as hardware failures, security issues or application errors.
-
Scalability & Flexibility: Your site went viral but it couldn’t handle the sudden increase in traffic. One of the major reasons for this is that many hosting providers limit the bandwidth and storage you can use.
-
Pricing: Most hosting providers charge a fixed fee every month. If you end up not using all the resources, you overpay for the service.
-
Developer friendly: There is no easy and programmatic way to interact with the underlying infrastructure. You have to manually update your site every time you make changes.
There is good news! Amazon provides a service called Simple Storage Service also known as “S3” that solves a lot of the problems mentioned above.
Amazon S3 is a simple key, value store which can store as many files as you want. These objects are stored in buckets.
-