What is AWS Cloudformation? Pros and Cons?

Be A Better Dev
9 Nov 202016:24

Summary

TLDRThe video introduces AWS CloudFormation, an infrastructure as code service, emphasizing its importance in the software industry. It explains CloudFormation's benefits, such as simplifying deployment and enabling regional expansion, and compares it with other IaC tools like Terraform, Serverless Framework, AWS SAM, and AWS CDK. The speaker shares insights on the learning curve, potential pitfalls, and the concept of drift, concluding with advice on getting started, particularly recommending AWS SAM for beginners.

Takeaways

  • πŸš€ AWS CloudFormation is a favorite service for infrastructure as code (IaC) in the software industry, simplifying deployment and management of AWS resources.
  • πŸ“„ CloudFormation uses template files written in YAML or JSON to define resources and their configurations, which can be created, updated, and managed through AWS.
  • πŸ”§ The service allows for incremental updates and automatic rollbacks in case of issues, providing a safe and efficient way to manage infrastructure changes.
  • 🌐 CloudFormation is particularly useful for regional expansion, enabling easy replication of infrastructure across different AWS regions.
  • πŸ” Key concepts in CloudFormation include template files, stacks (logical groupings of resources), and change sets (preview of changes before deployment).
  • πŸ“ˆ Pros of using CloudFormation include ease of use, support for code reviews, integration with CI/CD pipelines, and a large community for support.
  • ⚠️ Learning curve and potential dangers from seemingly innocent changes are among the cons, as well as the risk of 'drift' if resources are manually modified outside of CloudFormation.
  • πŸ”„ Comparison with other IaC tools like AWS SAM, Serverless Framework, Terraform, and AWS CDK shows that while they have their unique features, they all compile down to CloudFormation.
  • πŸ“š Getting started with CloudFormation is recommended to begin with AWS SAM due to its straightforward CLI tool and support for rapid development cycles.
  • πŸ› οΈ For beginners, start by installing SAM, reading AWS CloudFormation documentation, and experimenting with basic resources like Lambda functions and S3 buckets.

Q & A

  • What is AWS CloudFormation?

    -AWS CloudFormation is an infrastructure as code service provided by Amazon Web Services that allows users to define and deploy resources through template files written in YAML or JSON, which can then be uploaded to AWS for creation and management of those resources.

  • Why is learning AWS CloudFormation considered an important skill in the software industry?

    -Learning AWS CloudFormation is important because it enables developers to manage and provision AWS resources in a reproducible and automated manner, which is crucial for scaling applications, ensuring consistency, and integrating with continuous integration and continuous deployment (CI/CD) pipelines.

  • What are the key concepts of AWS CloudFormation?

    -The key concepts of AWS CloudFormation include template files (in YAML or JSON) that define resources, stacks which are logical groupings of resources, and change sets that represent the differences between the current state and the desired state of the infrastructure.

  • What are the benefits of using AWS CloudFormation?

    -Benefits of using AWS CloudFormation include ease of use, support for regional expansion, the ability to introduce code review mechanisms for infrastructure changes, easy integration with CI pipelines, and a large community for support and troubleshooting.

  • What are some potential drawbacks or challenges when using AWS CloudFormation?

    -Drawbacks of AWS CloudFormation include a steep learning curve initially, the risk of inadvertently causing issues with seemingly innocent changes (like renaming resources), and the concept of drift, where manual changes outside of CloudFormation can lead to inconsistencies and deployment failures.

  • How does AWS CloudFormation compare to other infrastructure as code solutions like Terraform, Serverless Framework, AWS SAM, and AWS CDK?

    -AWS CloudFormation is the underlying technology used by AWS SAM and the Serverless Framework, both of which simplify the deployment of serverless applications. Terraform is a provider-agnostic tool that can manage resources across multiple cloud providers. AWS CDK is a newer offering that allows developers to define infrastructure using actual programming languages like JavaScript or TypeScript, offering more flexibility and familiar programming constructs.

  • What is the recommended starting point for beginners to learn AWS CloudFormation?

    -For beginners, it is recommended to start with AWS SAM, which provides a CLI tool for quick development cycles and is straightforward to use. This approach allows new learners to get hands-on experience with CloudFormation templates and understand the basics before diving into more complex scenarios.

  • How can AWS CloudFormation be integrated into a continuous integration and continuous deployment (CI/CD) pipeline?

    -AWS CloudFormation can be integrated into a CI/CD pipeline by attaching the YAML or JSON template files to CI tools like GitHub hooks. Changes to these files can trigger a pipeline in AWS through services like AWS CodePipeline, automatically deploying the infrastructure updates defined in the templates.

  • What is 'drift' in the context of AWS CloudFormation?

    -Drift refers to the state where the actual configuration of resources in AWS does not match the expected configuration as defined in the CloudFormation stack. This can occur if changes are made directly through the AWS console or CLI, outside of the CloudFormation management process, leading to inconsistencies and potential deployment failures.

  • How can one mitigate the risk of data loss due to changes in AWS CloudFormation?

    -To mitigate the risk of data loss, it is important to understand the implications of changes in CloudFormation templates, especially when it comes to resource names and configurations that can lead to resource replacement. Additionally, maintaining version control over the infrastructure code and thoroughly reviewing changes before deployment can help prevent accidental data loss.

  • What is the recommended approach for troubleshooting AWS CloudFormation issues?

    -For troubleshooting AWS CloudFormation issues, it is recommended to first understand the concept of change sets and the differences they represent. If problems arise, reviewing the CloudFormation logs and the status of the resources can provide insights. Since all tools like SAM, Serverless Framework, Terraform, and CDK compile down to CloudFormation, understanding the underlying CloudFormation processes is crucial for debugging.

Outlines

00:00

πŸš€ Introduction to AWS CloudFormation

The speaker expresses excitement about discussing AWS CloudFormation, a favorite service due to its importance in the software industry. The video aims to provide a simple understanding of CloudFormation. It begins with defining CloudFormation using a relatable example of building a REST API with API Gateway and Lambda Function. The speaker then explains the complexity of managing AWS resources manually and introduces CloudFormation as a solution to define, create, and manage AWS resources through template files, emphasizing its ease of use and benefits like automatic rollback in case of issues.

05:01

πŸ“š Key Concepts of CloudFormation

The speaker delves into the key concepts of CloudFormation, starting with the creation of template files in YAML or JSON, which contain resources representing AWS components. An example of a Lambda function in YAML format is provided. The speaker then explains the concept of 'stacks' as logical groupings of templates and resources, and 'change sets' as diffs between updates that allow for incremental and previewed changes. The benefits of CloudFormation are highlighted, including simplicity, regional expansion support, code review integration, and CI pipeline compatibility, along with a large community for support.

10:02

πŸ“‰ Pros and Cons of CloudFormation

The speaker discusses the pros and cons of using CloudFormation. The pros include ease of use, support for regional expansion, the ability to integrate with code reviews and CI pipelines, and a strong community for support. The cons are the initial steep learning curve, the potential danger of seemingly innocent changes leading to resource deletion, and the concept of 'drift' where manual changes outside CloudFormation can cause out-of-sync issues. The speaker advises treating the AWS account as read-only to avoid drift and emphasizes the importance of understanding CloudFormation's nuances.

15:03

πŸ”„ Comparison with Other IaC Solutions

The speaker compares CloudFormation with other Infrastructure as Code (IaC) solutions like AWS SAM, Serverless Framework, Terraform, and AWS CDK. AWS SAM and Serverless Framework are similar and both use CloudFormation under the hood, with SAM being AWS-supported. Terraform is noted for its provider-agnostic approach, suitable for managing resources across multiple cloud providers. AWS CDK is highlighted as a newer offering that allows infrastructure to be coded in familiar programming languages with constructs like loops and conditionals. The speaker points out that all these tools compile down to CloudFormation, making knowledge of CloudFormation essential for debugging.

🌟 Getting Started with CloudFormation

The speaker suggests using AWS SAM for beginners due to its simplicity and the ease of using a CLI tool for quick development cycles. The process of getting started with SAM and CloudFormation is recommended, starting with basic resources like Lambda functions and S3 buckets. The speaker plans to release a follow-up video on getting started with SAM and CloudFormation for serverless application development. The video concludes with a call to action for viewers to explore more AWS and software engineering content on the speaker's channel and to like and subscribe.

Mindmap

Keywords

πŸ’‘AWS CloudFormation

AWS CloudFormation is an infrastructure as code (IaC) service provided by Amazon Web Services that allows users to define and deploy resources on AWS through template files written in YAML or JSON. It simplifies the process of creating and managing AWS resources by treating infrastructure as code, enabling version control, and facilitating the automation of infrastructure deployment. In the video, the speaker emphasizes the ease of use and the benefits of CloudFormation, such as its ability to manage complex infrastructure setups and support for regional expansion.

πŸ’‘Infrastructure as Code (IaC)

Infrastructure as Code (IaC) is a software development methodology that involves managing and provisioning infrastructure through machine-readable definition files, rather than through manual setup in a cloud console. This approach treats infrastructure as if it were software, allowing for version control, automation, and repeatability. In the context of the video, IaC is exemplified by the use of AWS CloudFormation, where infrastructure is defined in template files that can be version-controlled and deployed in a consistent manner.

πŸ’‘YAML

YAML (YAML Ain't Markup Language) is a human-readable data serialization format often used for configuration files and data exchange between languages with different data structures. It is one of the two formats (the other being JSON) in which AWS CloudFormation templates can be written. YAML is known for its readability and ease of use, making it a popular choice for defining CloudFormation templates due to its clean and straightforward syntax.

πŸ’‘Stacks

In the context of AWS CloudFormation, stacks are the logical groupings of resources that are defined within a template. Stacks allow users to manage related resources together, making it easier to perform operations such as creation, updates, and deletion in a coordinated manner. A stack can include multiple template files, and there can be nested stacks for more complex deployments, creating a hierarchical relationship between different stacks.

πŸ’‘Change Sets

Change sets in AWS CloudFormation represent a collection of changes that will be made to the resources in a stack when a new template is applied. They provide a way to preview the changes that CloudFormation will make before actually applying them, allowing users to review and approve the changes before they are implemented. This feature helps to prevent unexpected modifications and ensures that only intended changes are applied to the infrastructure.

πŸ’‘Continuous Integration (CI)

Continuous Integration (CI) is a software development practice where developers integrate their code changes into a shared repository frequently, allowing for early detection of integration problems, conflicts, and bugs. In the context of AWS CloudFormation, CI can be used to automatically trigger the deployment of infrastructure changes when updates are made to the CloudFormation template files, ensuring that the infrastructure remains in sync with the codebase.

πŸ’‘Serverless Application Model (SAM)

The Serverless Application Model (SAM) is an open-source framework for building serverless applications. It is fully supported by AWS and simplifies the process of defining, deploying, and testing serverless applications on AWS. SAM transforms serverless applications into AWS CloudFormation templates, leveraging the power of IaC to manage serverless resources such as Lambda functions, API Gateways, and more.

πŸ’‘Serverless Framework

The Serverless Framework is an open-source CLI (Command Line Interface) tool that provides a simple way to deploy and manage serverless applications across different cloud providers. It is a wrapper around AWS CloudFormation and other cloud provider APIs, allowing users to define their serverless infrastructure in a simple and intuitive configuration language. The framework then translates these configurations into CloudFormation or other provider-specific IaC templates for deployment.

πŸ’‘Terraform

Terraform is an IaC tool developed by HashiCorp that enables users to manage infrastructure across multiple cloud providers in a provider-agnostic way. Unlike AWS CloudFormation, which is specific to AWS, Terraform can handle infrastructure deployment on various platforms such as AWS, Azure, and Google Cloud Platform. Terraform uses its own declarative language to define infrastructure, which it then translates into the respective cloud provider's resources.

πŸ’‘AWS Cloud Development Kit (CDK)

The AWS Cloud Development Kit (CDK) is a software development framework for defining cloud infrastructure in code, using familiar programming languages such as TypeScript, JavaScript, Python, and Java. Unlike CloudFormation, which uses YAML or JSON templates, the CDK allows developers to use full programming languages and constructs like loops and conditionals to define infrastructure. The CDK then generates CloudFormation templates from this code, which can be deployed to AWS.

πŸ’‘Drift

Drift in the context of AWS CloudFormation refers to the situation where the actual state of the AWS resources diverges from the expected state as defined in the CloudFormation template. This can occur when changes are made to the resources directly through the AWS console or CLI, outside of the CloudFormation management process. Drift can lead to inconsistencies and deployment failures because CloudFormation's snapshot of the infrastructure state is out of sync with the actual state.

Highlights

Introduction to AWS CloudFormation, one of the favorite AWS services of the speaker.

Explanation of why AWS CloudFormation is an important skill in the software industry, though it can be intimidating to learn.

Overview of what to expect from the video, including an introduction to CloudFormation, key concepts, pros and cons, comparison with other IaC solutions, and how to get started.

Simple example to illustrate the concept of CloudFormation using AWS services like API Gateway and Lambda Function.

Discussion on the complexity of managing AWS resources manually and the solution provided by CloudFormation.

Explanation of how CloudFormation works as an Infrastructure as Code (IaC) provider, allowing the creation and deployment of AWS resources through template files.

The benefits of using CloudFormation, such as ease of use, support for regional expansion, and automated rollback in case of errors.

Key concepts of CloudFormation including template files in YAML or JSON, resources, stacks, and change sets.

Pros of CloudFormation like simplicity, regional expansion support, code review mechanisms, and CI integration.

Cons of CloudFormation, including the steep learning curve, potential dangers of seemingly innocent changes, and the issue of drift.

Comparison of CloudFormation with other IaC solutions like AWS SAM, Serverless Framework, Terraform, and AWS CDK.

Recommendation to start with AWS SAM for beginners due to its simplicity and quick development cycles.

Advice on how to get started with CloudFormation by installing SAM, reading documentation, and experimenting with basic AWS resources.

Mention of a follow-up video on getting started with SAM and CloudFormation for developing serverless applications.

Encouragement for viewers to explore the speaker's channel for more AWS, software engineering, and system design videos.

Transcripts

play00:00

what is going on guys i am very very

play00:02

excited about this video because i

play00:04

finally get to talk to you about one of

play00:06

my favorite aws services

play00:08

aws cloud formation and the reason that

play00:11

i wanted to make this video is not only

play00:12

because i love aws cloudformation

play00:15

but because i think it is such an

play00:17

important skill right now

play00:18

especially in the software industry but

play00:20

it could be kind of intimidating to

play00:22

learn

play00:22

so what i wanted to do in this video is

play00:24

just kind of give you a very simple

play00:26

understanding of what cloudformation is

play00:28

so in terms of what to expect we're

play00:31

first going to talk about

play00:32

what is cloud formation and i'm going to

play00:34

explain to you with a very simple

play00:35

example

play00:36

second we're going to talk about the key

play00:38

cloud formation concepts

play00:39

from there we're going to talk about the

play00:41

pros and cons of using cloud formation

play00:43

and then from there we're going to talk

play00:44

about how it compares to some other

play00:46

popular infrastructure as

play00:48

code solutions such as terraform

play00:50

serverless framework aws sam

play00:53

also known as serverless application

play00:55

model and

play00:56

aws cdk which is cloud development kit

play00:59

and then finally i'm going to talk to

play01:01

you about how to get started learning

play01:02

cloud formation

play01:03

for your next project so first of all

play01:06

let's explain

play01:07

what cloudformation is through a very

play01:09

very simple example

play01:10

so let's say you're just getting started

play01:12

on aws and you go ahead on us east one

play01:15

you're in the aws

play01:16

console you want to build a rest api and

play01:18

you're going to use api gateway combined

play01:20

with a lambda function because it's

play01:22

super super

play01:23

easy to build rest apis and by the way i

play01:25

have a whole video on this and i think i

play01:27

have one where you can set this up in

play01:29

eight clicks or something like that

play01:30

i'll put that in the description so

play01:32

you're having a good time in aws console

play01:34

you're doing all this stuff manually

play01:36

you decide hey i need a database i need

play01:38

my dynamodb table so you go ahead and

play01:40

create that

play01:41

and then you decide later hey i also

play01:42

needs an s3 bucket to store some of my

play01:44

log data or some other metadata about my

play01:46

app

play01:47

you go ahead and create that and you're

play01:49

like hey i need some roles that go along

play01:51

with my lambda function now to access

play01:53

this stuff

play01:54

okay then i want aws athena to perform

play01:56

analytics

play01:57

i want to create some users for my

play01:59

business users to access athena

play02:01

then they gotta get logins and passwords

play02:04

then you gotta get permissions to them

play02:06

as well

play02:06

and you can see this is getting very

play02:09

very difficult to manage just in this

play02:10

very simple example

play02:12

and then what's worse after that well

play02:15

your boss comes to you and says hey dan

play02:17

your application is doing really well

play02:18

we want to move it over to eu west one

play02:21

because we want to serve

play02:22

our european customers too and then

play02:25

you've got to do this and you've got to

play02:27

do this all through the console

play02:29

and you better hope you remembered the

play02:32

name of every resource you

play02:34

created and all the permissions that you

play02:36

added and you better hope that you

play02:37

didn't forget anything because then all

play02:39

this isn't going to work

play02:40

and you just feel like this guy this

play02:42

isn't a good feeling to have to

play02:44

kind of copy paste all this stuff so no

play02:46

one wants to feel like this guy no one

play02:47

wants to look this sad this upset this

play02:49

frustrated

play02:50

so there must be a better way what is

play02:53

the better way

play02:54

and this is where cloudformation comes

play02:55

in so wouldn't it be nice

play02:58

wouldn't it be nice instead of going

play02:59

into the console and clicking

play03:01

a thousand buttons and creating all

play03:03

these things and having to manage them

play03:05

and remember them

play03:06

that we can instead write a document

play03:09

write a file a template file that

play03:11

defines how each of these things are

play03:13

created

play03:14

how they are constructed every

play03:16

connection between them all the

play03:18

permissions

play03:18

and have that all written as code and

play03:21

wouldn't it be nice

play03:23

if we can upload that to aws and say aws

play03:26

can you go ahead

play03:27

and deploy this file and create your api

play03:31

gateway create your lambda function

play03:33

create your roles create your dynamodb

play03:35

table your s3 bucket

play03:37

your athena databases your users your

play03:39

everything wouldn't it be nice if we can

play03:41

just upload a simple file

play03:42

to somewhere and get aws to do this

play03:46

well this is what aws cloudformation is

play03:49

it is an infrastructure as code provider

play03:52

that allows you to do

play03:54

just what i demonstrate it allows you to

play03:56

create and define

play03:57

a file and then upload that to aws

play03:59

cloudformation which is this guy here

play04:01

and aws cloudformation through a single

play04:04

click will take that file and go

play04:06

and deploy every single thing in this

play04:09

diagram

play04:09

for you and then give you status updates

play04:12

on the way to say yeah this is done

play04:13

that's done that's done

play04:15

and then oops what if something goes

play04:16

wrong maybe your lambda function is

play04:18

having a problem

play04:19

it'll automatically roll back for you

play04:21

wouldn't that be nice

play04:22

well that's exactly what aws

play04:24

cloudformation is and that's why it's so

play04:26

awesome

play04:27

it's so easy to use all you do is define

play04:30

your template files

play04:31

you upload them there's a couple

play04:33

different means to upload them which

play04:34

we'll get to in a second

play04:35

it's great for regional expansion so if

play04:37

you want to move all this stuff to a

play04:39

different region if your business is

play04:40

quickly growing then it's great for that

play04:43

it's got a whole bunch of other benefits

play04:45

but this is the main idea you write a

play04:47

template file

play04:48

you upload that to cloudformation in

play04:50

this case and that is responsible for

play04:52

creating

play04:52

all of this different stuff here that is

play04:54

what cloudformation is in a nutshell

play04:57

so let's move on to the key concepts of

play04:59

cloudformation now

play05:01

uh so the first one is that you create

play05:04

these

play05:04

uh template files that are in either

play05:07

yaml or

play05:08

json now for whatever reason yaml has

play05:11

really taken off i don't know why you

play05:13

would expect that everyone would use

play05:14

json

play05:15

but it seems like the community has

play05:17

decided that yaml is the way to go

play05:19

and i've been doing this for a while and

play05:21

i gotta say it looks pretty clean when

play05:23

you use yaml compared to json so i'm

play05:25

all for that but anyways you define

play05:27

these templates and these template files

play05:29

contain

play05:30

resources and the resources are

play05:32

essentially all the aws things that you

play05:34

want to create

play05:35

your you know s3 buckets your sqs cues

play05:38

your

play05:38

im rolls your users everything that goes

play05:41

with it

play05:42

so that is the first concept so what do

play05:44

these templates even look like

play05:46

well this is a example of a lambda

play05:48

function

play05:49

in a yaml format so what are we looking

play05:51

at here well this is the name

play05:53

of your resource and the type of your

play05:56

resource is a lambda function

play05:58

and then you're defining some properties

play06:00

on that lambda function and you're

play06:02

saying the handler's

play06:04

input file is the index.handler you're

play06:06

seeing it has a role called this guy

play06:08

and this example is actually doing

play06:10

something fairly interesting typically

play06:11

what you would do with the lambda

play06:12

function

play06:13

is in the code section here you would

play06:15

give it a zip file that's located in s3

play06:18

but what they're doing here is actually

play06:20

kind of interesting it's it's a little

play06:21

bit of a shortcut so they're using

play06:23

substitution

play06:24

to do some inline javascript so all this

play06:27

javascript down here this is going to be

play06:28

the definition of your lambda function

play06:30

and then finally it lets you specify the

play06:32

runtime of it

play06:33

now this is how you would define in this

play06:35

case a lambda function but it's the same

play06:38

format for every other aws resource you

play06:40

just specify the type

play06:42

if you want an sqsq you put that here if

play06:44

you want an s3 bucket you put that here

play06:46

there's recipes that you can follow and

play06:48

this stuff is very very well documented

play06:51

so that is the first concept you kind of

play06:52

define these yaml or json files that are

play06:55

called templates and they contain it of

play06:57

us

play06:57

resources so the second key concept is

play07:00

something called stacks

play07:01

and these are the things that are the

play07:02

logical groupings of your templates and

play07:04

their resources so maybe you would

play07:06

set this up on an application level so

play07:08

every application has a different stack

play07:10

you can combine multiple template files

play07:12

together so you can kind of sum them up

play07:14

and deploy them all at once

play07:15

with the same stack you can also create

play07:18

something called

play07:18

nested stacks where you can have kind of

play07:21

graph like relationships between your

play07:23

stacks if you want to deploy something a

play07:24

little bit more complex

play07:26

but that's stacks and the third main

play07:28

concept to know about is something

play07:30

called change sets

play07:31

and what change sets are are basically a

play07:34

diff

play07:34

between what cloudformation has from

play07:36

your previous upload

play07:38

and what you are attempting to upload so

play07:40

they are the diff between those two

play07:41

things

play07:42

similar to what you would see on git if

play07:44

you have a diff between two git commits

play07:46

uh so what change sets basically do is

play07:48

show you a preview of what

play07:50

cloudformation is going to do in its

play07:52

incremental update

play07:53

so cloudformation always updates

play07:55

incrementally it always looks at what

play07:57

has

play07:58

changed since your last upload and only

play08:00

performs updates on things that have

play08:02

changed so that's how cloud formation

play08:04

works it works in incremental steps

play08:07

so those are the key concepts now let's

play08:09

talk about some of the pros and cons of

play08:11

cloudformation so in terms of the pros i

play08:14

kind of mentioned a lot of them here

play08:15

but it makes your life just a whole lot

play08:17

easier it's very simple and quick to

play08:19

whip together some recipes that can do

play08:21

some pretty complicated things

play08:23

like i said it's also great for regional

play08:24

expansion so you can very very quickly

play08:26

deploy this out to multiple different

play08:28

regions

play08:28

with just a couple clicks second it

play08:31

allows you to introduce code review

play08:33

mechanisms for infrastructure changes

play08:36

i can't tell you how many times i've

play08:38

seen people accidentally fat finger

play08:40

something

play08:41

and delete either a queue a database a

play08:43

bucket a file

play08:44

something on aws and you just think why

play08:48

why did you do this to yourself so using

play08:51

infrastructure as code and cloud

play08:52

formation in particular you can add an

play08:55

additional layer of verification to your

play08:57

infrastructure

play08:58

change process through code reviews so

play09:00

instead of someone just going in there

play09:02

and making changes directly in the

play09:03

console without anyone knowing

play09:05

you can kind of release your

play09:06

infrastructure updates through a change

play09:08

management process

play09:10

that is backed by code reviews uh the

play09:12

third main pro is that you can very

play09:14

easily integrate this with the ci

play09:16

pipeline ci stands for continuous

play09:18

integration

play09:19

so you can attach your yaml or json

play09:22

template files to

play09:23

things like github hooks and based on

play09:25

changes to your files it'll

play09:27

automatically trigger a

play09:28

pipeline in aws through code pipeline

play09:31

and deploy all your changes through

play09:32

cloudformation

play09:33

so it's very very quick and easy to get

play09:35

started with this and introduce a full

play09:37

ci pipeline for your infrastructure

play09:39

changes

play09:40

fourth it's got a huge community support

play09:42

cloudformation has been around for many

play09:44

years

play09:45

uh it's not a new service by any means

play09:47

there's tons of stack overflow help tons

play09:50

of community volunteers that'll help you

play09:52

kind of work through some of your

play09:53

problems so

play09:54

you're not alone if you face some issues

play09:56

with cloud formation

play09:57

now in terms of the cons every great

play09:59

thing has its set of weaknesses and

play10:01

cloud formation is no different

play10:03

so the first con is that it's a little

play10:05

bit of a steep learning curve

play10:07

and i would say that this is less true

play10:10

more recently because like i said it's

play10:12

got a large community support and

play10:13

there's tons of examples out there

play10:15

but it's just a little bit difficult

play10:16

getting started because there's a lot of

play10:18

concepts at play and a lot of different

play10:20

recipes and things that can go wrong

play10:22

that can impact you so i would say it's

play10:24

got a steep learning curve but once you

play10:26

learn the main concepts this stuff is

play10:28

cake like it's very very easy to

play10:30

understand

play10:31

the second main con is that i learned

play10:34

this the hard way which is that innocent

play10:36

looking changes can be dangerous

play10:38

and what i mean by this is that in my

play10:40

particular case

play10:41

if you change the name of a resource

play10:44

such as a dynamodb

play10:45

table or a database instance or whatever

play10:48

changing the name will

play10:49

cause cloudformation to delete that

play10:51

thing and spin up a new one

play10:53

and when it deletes it there goes all

play10:55

your data so

play10:56

you gotta understand the nuances of

play10:58

cloudformation formation because

play10:59

unfortunately these things do exist and

play11:01

it can't come to bite you so you just

play11:03

kind of need to be aware of them before

play11:04

you get started

play11:06

and the third one is there's this

play11:08

concept of drift and it can be painful

play11:10

if you're not aware of it

play11:11

and drift is this concept that

play11:13

cloudformation keeps a snapshot of what

play11:16

it

play11:16

thinks the state of your aws account is

play11:19

and all the resources that are tied to

play11:21

your cloudformation stack

play11:22

and it kind of persists this snapshot

play11:24

and that snapshot typically only changes

play11:27

when you perform an update through a

play11:28

change set through that process that i

play11:30

spoke to you

play11:31

before about however if you come

play11:34

you know through your aws console or

play11:36

through to your aws cli

play11:37

and you make a modification directly to

play11:40

some of the resources that your

play11:41

cloudformation stack is in charge of

play11:44

maintaining

play11:45

then that causes drift which is an out

play11:47

of sync issue where cloudformation

play11:50

thinks

play11:50

that your resource is set up in this way

play11:52

but in fact on aws

play11:54

it is set up in a different way so what

play11:56

i'm trying to say here is that when you

play11:57

start

play11:58

using cloudformation to manage your

play12:00

resources you kind of need to

play12:01

treat your aws account as read-only you

play12:04

shouldn't be making manual changes

play12:07

in your account anymore that'll cause a

play12:09

concept called drift

play12:10

and it can actually cause your

play12:11

deployments to fail on cloud formation

play12:14

uh so be aware of drift it's i label it

play12:16

as a con but maybe it's just kind of a

play12:17

negative feature about cloud formation

play12:19

so we talked about what's good and

play12:20

what's bad now let's talk about

play12:22

uh kind of how does it compare to some

play12:24

other popular infrastructure as

play12:26

code solutions uh so the first one that

play12:28

i want to talk about is aws sam stands

play12:30

for serverless application management

play12:32

and under the hood sam actually uses

play12:35

cloudformation

play12:36

it's great for setting up like it says

play12:38

serverless applications so lambdas api

play12:40

gateways

play12:41

it really helps you build serverless

play12:43

applications very quickly

play12:45

now on the other side of that coin is

play12:47

the serverless framework which i would

play12:49

say

play12:49

is pretty much a direct competitor to

play12:51

aws sam

play12:52

but interestingly serverless also uses

play12:55

cloud formation under the hood

play12:56

but it uses kind of a wrapper language

play12:58

on top of it

play13:00

that you need to use but it looks very

play13:01

very similar to what cloudformation

play13:03

looks like

play13:04

so these are very very similar sam and

play13:06

serverless there's not too much

play13:08

differences between them but

play13:09

you know one is supported and built by

play13:11

aws one is not so

play13:13

take that as your deciding factor

play13:15

perhaps

play13:16

now the next popular one is terraform

play13:18

and what terraform is great at

play13:20

is if you have a kind of mix and match

play13:23

scenario where some of your

play13:24

infrastructure may be on

play13:26

azure some of it may be on aws some of

play13:28

it may be elsewhere

play13:29

in another cloud provider terraform is a

play13:31

great wrapper on top

play13:33

of cloud infrastructure concepts which

play13:35

allows you to be provider agnostic

play13:38

a lot of people like to say that

play13:39

terraform is more dedicated to

play13:40

infrastructure i don't think i would

play13:42

necessarily agree with that but that's

play13:43

kind of what the community has decided

play13:45

and then finally there's aws cloud

play13:47

development kit and this is kind of a

play13:49

newer offering from aws

play13:51

and cdk allows you to write actual

play13:53

javascript or typescript or some other

play13:55

languages as well

play13:56

and declare your infrastructure as code

play13:58

in your template files as opposed to

play14:00

using

play14:00

this json or yaml notation so it allows

play14:04

you to use

play14:04

constructs like if statements for loops

play14:07

all that kind of stuff that you would

play14:08

expect in a standard programming

play14:09

language and because of that it allows

play14:11

you to do some very interesting and

play14:12

flexible things

play14:14

so this is kind of the newer hotter

play14:15

thing to learn right now cloud

play14:16

development kit

play14:17

now another thing that i wanted to point

play14:19

out was that all of these sam

play14:21

serverless terraform and cdk all compile

play14:24

down to cloud formation to deploy to aws

play14:28

so regardless of which one of these

play14:29

things that you choose

play14:31

if you're ever facing problems with any

play14:33

of these frameworks

play14:34

you're probably going to need to know

play14:35

how cloud formation works to debug the

play14:37

problem

play14:38

so it's a very good starting point very

play14:40

good foundational

play14:42

skill to learn because it's going to be

play14:44

present in all of these different

play14:46

frameworks and actually some of the

play14:49

notation is almost identical

play14:51

to what you would see in a cloud

play14:52

formation template file

play14:54

in yaml now if you're just getting

play14:56

started i would suggest to probably

play14:58

learn sam first and the reason i say

play15:01

this is because

play15:02

if you're trying to get started through

play15:04

the console it's not a very good process

play15:06

in terms of development cycles

play15:09

you kind of got to upload a new template

play15:10

file every time you make a change

play15:12

try it out see if it fails you know make

play15:14

a change again upload it try it out

play15:16

yada yada yada now if you're using sam

play15:18

it comes with a handy cli tool in fact

play15:21

these all do so maybe this applies to

play15:22

all these different ones but

play15:24

i i learned on sam i think it's

play15:25

straightforward but anyways because

play15:27

you're using a cli

play15:29

tool to update your cloudformation stack

play15:31

your very very quick cycles because you

play15:34

just define your cloudformation file

play15:36

locally so it allows you to test things

play15:38

out kind of just get your feet wet and

play15:39

experiment a little bit

play15:41

so i would definitely use sam when

play15:43

you're getting started in terms of like

play15:45

mechanically what should you do to get

play15:47

started install sam

play15:49

read some of the documentation on aws

play15:51

cloudformation and just get started with

play15:53

something basic like a lambda function

play15:55

and maybe like an s3 bucket just get

play15:57

your feet wet and just create some stuff

play15:59

like anything you learn by doing and

play16:00

cloud formation is no exception

play16:02

so i'm going to be coming out with a

play16:03

follow-up video to this which is kind of

play16:05

getting started with sam and getting

play16:07

started with cloudformation to develop

play16:08

serverless applications so i'll put that

play16:10

in the description section when it is

play16:12

available

play16:12

and if you like this video be sure to

play16:14

check out my channel i have a whole

play16:15

bunch of aws

play16:16

and software engineering system design

play16:18

videos available on my channel

play16:20

and as always please don't forget to

play16:21

like and subscribe and i'll see you next

play16:23

time

Rate This
β˜…
β˜…
β˜…
β˜…
β˜…

5.0 / 5 (0 votes)

Related Tags
AWS CloudFormationInfrastructure as CodeDevOpsSoftware EngineeringCloud ServicesServerlessCI/CDCommunity SupportLearning ResourcesAWS SAMTerraformAWS CDK