Cloudformation - Deploy cloud resources with just few clicks

Deploy cloud resources with just few clicks-web

When we work on building an application, we often tend to use various aws services through console or CLI. In case if we need to migrate the application to other aws accounts or client's account , we need to provision those resources again and re-work on deploying the application. This overall process may be time consuming if you have many resources and there is an inter-linked connection between these resources. You may end up missing one or the other step and the application may not work as expected. Even with concrete documentation , it still can be tedious while working with different aws services to be migrated. To overcome this problem and migrate the application with ease we have a service in aws called cloudformation.

What is cloudformation ?

AWS CloudFormation gives you an easy way to model a collection of related AWS and third-party resources, provision them quickly and consistently, and manage them throughout their life cycles, by treating infrastructure as code. A CloudFormation template describes your desired resources and their dependencies so you can launch and configure them together as a stack. You can use a template to create, update, and delete an entire stack as a single unit, as often as you need to, instead of managing resources individually. You can manage and provision stacks across multiple AWS accounts and AWS Regions.

How does it work ?

01

Does it work with serverless applications ?

Yes. Fortunately all the resources we need like s3 , api gateway , lambda , dynamoDB,etc can be very well defined in cloudformation. All the defination like lambda function handler need to be kept in s3 to be accessible for public or valid AWS account owners. All the shared resources from the primary aws account , gets created on your demo account by running the stacks. When you run the cloudformation stack , it's vital to provide access role permission to provision the required aws services.

Cloudformation components

  1. Cloudformation Stack - To run the set of instructions for provisioning the cloud resources
  2. YAML / JSON Template - To define all the required cloud resources and generate output with endpoints to be used in other resource definitions.
  3. S3 (Simple storage service) - To store the Yaml/ Json templates and resource definitions like lambda function definition
  4. IAM - To provide permissions for role to execute stack

Sample YML Code:

01

In the code above, first we define the aws template version and description which is used for any template. Furthermore, Resources contains different AWS services which we need to use and their configurations as per the need. The output is to get those services information or urls after those resources are provisioned on the cloud.

Time efficiency and Cost effectiveness

As resources are provisioned using Infrastructure as code , it's very quick to move your application resources on different AWS accounts or client’s accounts by a few clicks.If your application requires additional availability, you might replicate it in multiple regions so that if one region becomes unavailable, your users can still use your application in other regions. The challenge in replicating your application is that it also requires you to replicate your resources. Not only do you need to record all the resources that your application requires, but you must also provision and configure those resources in each region. Overall cost for allocating people to deploy and provision resources is very less.

Error traceability and scalability

It's quite easy to trace or update the configuration required for the resources required in your application as infrastructure is defined in code. Also if you need to allocate more resources in the application and replicate the same on other instances is easily possible. Even if there are updates in the standards of the configuration then the same can be updated in the code.

Thanks for your time and please let me know if you find this article helpful.

Author Profile Picture
Siddhesh Shirodkar
Software Developer
Why Pharma Companies Need Crafted Emails Marketing

Why Pharma Companies Need Crafted Emails Marketing

SAYEED AHMED
SJ Innovation Appreciates Our Happy Clients

SJ Innovation Appreciates Our Happy Clients

SHAHED ISLAM

Project Manager: As a Divergent

ARIF ISLAM