AWS CloudFormation Basics
AWS CloudFormation Basics
AWS CloudFormation Basics
CloudFormation Designer
Intrinsic Functions
Intrinsic Functions are useful when you want to assign values to properties in a
template that are not available until runtime.
CloudFormation provides a set of intrinsic functions that help in managing stacks:
Fn : : Base64 : Returns the Base64 representation of the input string.
Fn : : Cidr : Returns an array of CIDR address blocks, and the number of blocks
is dependent on the parameter used.
Fn : : FindInMap : Returns values corresponding to keys in a two-level map that
are declared in the Mappings section.
Fn : : GetAtt : Returns the value of an attribute from a resource.
Fn : : GetAZs : Returns the array list of AZs in a specified region.
Intrinsic Functions
Fn : : ImportValue : Returns a value that is exported, or the output of another
stack.
Fn : : Join : Returns the appended value separated by a specified delimiter.
Fn : : Select : Returns the value from a list of objects by index.
Fn : : Split : Splits a string into a list of string values, so that you can select an
element from the resulting string list. The location of the split is defined by a
delimiter that is used in conjunction with Select.
Fn : : Sub : Substitutes variables in an input string with values you specify.
Fn : : Transform : Specifies a macro to perform a specific process on a specific
part of a stack.
Condition Functions : All the intrinsic functions can be used to create a stack
with conditions, or apply conditions for certain resources. There are five
conditional functions; Fn : : If , And , Equals , Not , Or. All conditions are
used in the Conditions section, except for Fn : : If. Details about conditions, and
examples are available in Condition Documentation.
For detailed explanation with examples of intrinsic functions, refer to Intrinsic Functions
Documentation.
Are very useful when you use resources with the same configuration multiple
times. These can be consolidated into a stack, and further used.
Each nested stack has a parent stack and only one root stack.
CloudWatch Components
CloudWatch has three key capabilities:
CloudWatch Monitoring - To collect metrics data, and set alarms.
CloudWatch Logs - To collect and analyze log files from AWS services, and
applications running on EC2 machines.
CloudWatch Events - To trigger events based on changes in AWS resources,
time, or cron expressions.
Monitoring Types
There are two types of Metrics monitoring in CloudWatch:
Basic Monitoring : This is free, and collects data from AWS resources at an
interval of five minutes. All resources, except ELB and RDS provide metrics in
basic monitoring. For other services, you can enable detailed monitoring.
Detailed Monitoring : This is charged, and collects metrics at an interval of one
minute. A new high-resolution metric is available which collects metrics at 1-
second resolution. ELB and RDS is facilitated only in detailed monitoring.
There will be at least five metrics for a single EC2 instance. Therefore, how do you
manage hundreds of them? Moreover, many of them might not be useful to you. To
overcome this, we have Dashboards which are customizable home pages.
Dashboards help in monitoring all required metrics and alarms from different
regions in a single page.
It creates a common view of resource data which can be shared by the team,
and enables faster resolutions to issues.
With Dashboards, you can display the latest value of a metric, a simple line
graph of one or more metrics, or a stacked area graph of multiple metrics.
CloudWatch Logs
CloudWatch Logs is a place to monitor, access, and store logs from various AWS
services such as EC2 instances, Lambda, S3, VPC, and also the application running on
EC2.
For more information about log insights, refer to AWS official documentation.
CloudWatch Events
Events is also an importance feature of CloudWatch. It provides a near real-time event
stream, as changes take place in the AWS resources present. The change of events
can trigger predefined actions on targets, such as send notifications and emails,
invoke lambda functions, change instance state, and so on.
By using simple rules, you can match events, and route them to one or more
targets, functions, or streams.
Helps to identify operational changes when they take place.
Can be used to schedule automated actions that self-trigger at certain times, by
using cron or rate expressions.
It supports many crucial services as its targets in AWS.
AWS CloudTrail
CloudTrail is a security and management service which enables governance,
compliance, and risk auditing of the AWS account. It continuously logs and monitors
activities related to actions in your account.
Every action taken through console, AWS CLI, AWS SDK's, and other AWS
services is logged. - The information logged contains the identity of the
API caller, time of the call, the source IP, request parameters, and
response of the call.
It helps in security analysis, resource change tracking, and compliance auditing.
It is enabled by default when the AWS account is created.
All the events are saved in event history in CloudTrail and saved for 90 days.
You can create a trail to archive, analyze, and respond to changes, and log all of
them to the S3 bucket you specify.
What is CloudFront
CloudFront is a content delivery network (CDN) service that offers low-latent, fast,
secure, and high-speed static and dynamic content delivery to end-users, globally.
Is integrated with AWS global infrastructure, and works with many services.
Uses edge locations of AWS which are a distributed network of data centers.
Works seamlessly with services like S3, Elastic Load Balancer, EC2 instances,
and AWS Shield for DDoS migration and AWS Lambda.
Advantages of CloudFront
CloudFront is one of the most used services of AWS. It has a huge customer base,
and organizations like King, Prime Video, Rovio, Discovery, Supercell, Bandai Namco
use it for its following iconic features:
The CloudFront network has 166 POP locations across the globe, aiding in
superior performance and high-speed delivery to users.
CloudFront is a highly secure CDN, providing both application and network
security at no extra cost. Also, users have the ability to configure AWS Certificate
manager to manage SSL certificates.
It works with many AWS services, and with Lambda@Edge functions triggered
by CloudFront events, you can take your code closer to the user to improve
responsiveness and serve private content.
It is very useful in video streaming, both live and pre-recorded video.
It is a comparatively less-expensive service, and you are only charged for
content delivered and requested.
Types of Origins
The previous example showed an S3 Bucket serving content to the CloudFront.
However, it also supports various other services to act as an origin:
Using MediaStore Container/Package Channel : This is used to stream video
content to CloudFront, both on-demand and live streaming. On-demand video is
streamed by using services like AWS Elemental Media Convert to convert
media files into streaming package and is stored in S3.
For live streaming, either a live-event or 24/7 live channel, encoders such
as Media live or AWS Elemental Media Package are used. Also, there are
many third-party tools and servers too that does the encoding, converts the video
to deliverable format, and uses CloudFront for delivery.
For the detailed steps and tasks involved in video streaming for both on-demand and
live video streaming, refer to AWS Documentation.
Types of Origins...
EC2 Server or other HTTP server : In this, the origin is a custom HTTP server,
or an EC2 instance that you manage. An S3 bucket that is configured for website
hosting is also a custom origin. When you configure this HTTP custom server as
origin, you specify the DNS, HTTP, or HTTPS ports and protocol that CloudFront
should use to fetch content.
In this custom HTTP origin server, CloudFront does not support Real-Time
Messaging Protocol Secure(RTMPS) and private content delivery.
CloudFront origin groups : These origin groups are used for failover scenarios
when you need high availability. Use origin failover to designate a primary origin
for CloudFront, and a secondary origin, so that CloudFront automatically
switches to the secondary origin when the primary origin returns specific HTTP
status code.
WAF is a very useful security service provided by AWS, and is associated with
CloudFront for high-level security.
A part of a signed URL or a signed cookie is hashed and signed, using the private key
from a public/private key pair. When a signed URL or signed cookie is used to access a
file, CloudFront compares the signed and unsigned portions of the URL or cookie. If
they do not match, CloudFront will not serve the file.
A part of a signed URL or a signed cookie is hashed and signed, using the private key
from a public/private key pair. When a signed URL or signed cookie is used to access a
file, CloudFront compares the signed and unsigned portions of the URL or cookie. If
they do not match, CloudFront will not serve the file.
AWS SNS is a highly available, secure, fully managed messaging service that helps
you decouple microservices, distributed systems, and serverless architecture.*
By using SNS topics, publisher systems can send messages to a large number
of subscriber endpoints for parallel processing, including Amazon SQS queues,
AWS Lambda functions, and HTTP/HTTPS webhooks.
SNS can be used to send notifications to end-users through mobile push, SMS,
and email.
With encryption, you can secure message content, and restrict the
publisher and subscriber.
SNS Pricing
SNS uses a pay-as-you-go model. There are no upfront commitments.
With SNS free tier, your first million push notifications are free every month.
You pay based on the number of notifications you publish.
SNS currently allows a maximum limit of 256 KB for published messages.
Each 64 KB chunk of published data is billed as 1 request.
Delivery prices vary depending on the end point, and SNS offers SMS services to
more than 200 countries.
Amazon SQS
Amazon Simple Queue Service (SQS) is a web service that enables web service
applications quickly and reliably queue messages, that one component or application
generates, to be used by another component or application.
Course Summary
You have reached the end of the course. Let us summarize what you have learnt thus
far:
Conclusion
Amazon is growing larger everyday by adding new services to its portfolio. Existing
services are being upgraded, and new features are being added regularly.
SQS FIFO service is a recent addition, and the expiration time for metrics has been
extended from 2 weeks to 15 months.
This course covers all the important concepts. You can keep a track of changes and
updates at AWS Documentation.