Posted on 27 Jan 2021
In this article, I am going to continue my overview of the Amazon Integrated Services, trying to explain my understanding of the following services:
Before reading this, make sure you read this and this.
The Simple Notification Service (SNS) is a notification system that allows decoupling microservices or sends notifications (i.e. email) when an event occurs. For a better understanding of this service let’s consider the following items:
The following figure shows the two typical usages of Amazon SNS: Amazon SNS Pub/Sub Messaging and Amazon SNS Mobile Notifications. In the former, the publisher sends notifications to subscribers that could be Lambda, SQS, or HTTP/S services. In the latter, Publisher sends a notification to the mobile subscribers via ADM, Baidu, and others.
Photo from AWS Cloud Practitioner Essentials (2nd Edition) course
Amazon CoudWatch is a real-time monitoring system for Amazon Web Services (AWS) resources and applications. The system. CloudWatch works with the following elements:
For each AWS resource, CloudWatch monitors a set of metrics. For example, for EC2 instances it monitors CPU, Status, Memory, etc. These statistics are visible to customers via the management console. When a metric reaches a threshold an alarming turn on and an action (SNS, Autoscaling, etc.) starts.
Photo from AWS Cloud Practitioner Essentials (2nd Edition) course
In this article, you can see an example of EC2 scale up when CPU > 80%. There are other useful use cases where you can use CloudWatch:
Each AWS resource has its own set of metrics customers can monitor. For example, CPU and Memory for an EC2 instance, disk usage for an S3 bucket, and so on. A metric is a time-ordered set of data points that monitor resource usage and performance. At the default metrics, customers can add custom metrics that enrich the system monitoring.
Customers can monitor CloudWatch Logs to search for string or pattern and take an action when a match occurs. CloudWatch Logs keep track of AWS Ec2 logs, monitor AWS CloudTrail logged events, archive or rotate log data.
An alarm monitors a single CloudWatch metrics and when it reaches a threshold, one or more actions are invoked. An action could be an SNS notification, an AWS Lambda function, an Autoscaling action, and so on. In the example above, for the CPU metric, we can define an Alarm that when CPU > 80% for 5 minutes an Autoscale action starts.
CloudWatch events are near real-time stream of system event that describes changes in AWS resources. You can use simple rules to match these events and route them to one or more target functions or streams. With these events, you are aware of operational changes occurring in the environment and react to them accordingly. Customers can set up automatic actions to react to these events.
An example of Events is when an EC2 instance is created due to a scale-up action. In this case, you can associate this event with a CloudWatch action that calls a Lambda function that sends an email to the administrator to inform him that a new EC2 instance exists in his environment.
You can monitor AWS resources via dashboards in the management console. Configure the CloudWatch home page to monitor, in a single view, the most important metrics of your system. Create a customized view of a dashboard using the management console, AWS CLI, or PutDashboard APIs.
Amazon CloudFront is the Content Delivery Network (CDN) of the Amazon platform. The basic idea is that if you have an application (i.e. a video stream like Netflix) in San Paolo and your end-users are in New York, in order to reduce the video stream latency, the video replicated in a location near New York.
In the [second article of this series]amazon-web-services), I talked about the AWS Global Infrastructure and its 210 Edge Locations where customers can replicate their content. The advantages for a customer to use this service are the following:
CloudFront supports two types of content to cache:
When you create a CDN for your application you need to specify:
CDN is useful in a lot of scenarios, for example:
AWS CloudFormation simplifies the task of repeatedly and predictably creating groups of related resources that power your application. Basically, it is the pipeline system you can use to manage application resources lifecycle like deploy, remove, and update. It is the basic component to manage DevOps activities on the system.
You can use the management console, AWS CLI, or SDK to provision AWS resources in your account environment. For example, you can create a pipeline that creates a VPC in your account with a Public subnet and an EC2 instance that runs a web server. You can create an S3 bucket where, periodically, you can store the application logs, and so on. Users can access the web server via an Internet GAteway (IGW) The scenarios you can create are endless.
Photo from AWS Cloud Practitioner Essentials (2nd Edition) course
In order to deploy, update, or remove AWS resources in a customer account, CloudFormation uses a Template file that contains a description of the resources that compose the customer environment. This template represents the customer’s “desired state” and CloudFormation takes care that the environment keeps it. It is in JSON or YAML format and it is self-explanatory.
Photo from AWS Cloud Practitioner Essentials (2nd Edition) course
An important concept in CloudFormation is Stacks, which are the resources generated by a template file. Stacks are units of deployment you can create, update, or remove. CloudFormation creates Stacks in random order unless the customer doesn’t specify dependencies among resources.
Usually, customers use development, test, and production environment. In order to create them, customers can use a single template file where it uses different variables, parameters, and conditions for each environment. Template files and CloudFormation is the way the Amazon platform implements its Infrastructure as a Code (IaaC).
If you are new to CloudFormation you can use the CloudFormation Designer to define the template for your infrastructure. CloudFormation Designer is a drag and drop tool where you can design your environment and the tool automatically create the relative template for you.
With this article, we terminated our AWS Integration Services overview. We analyzed Amazon SNS, CloudFront, CloudWatch, and CloudFormation. In the next article, we will continue our overview of the AWS platform.