Frequently asked AWS CloudFormation Interview Questions (2021) | TechGeekNext >>





Frequently asked AWS CloudFormation Interview Questions (2021)

In this post, questions from AWS CloudFormation Interviews will be answered for Experienced and Freshers. We're trying to share our experience and learn how to help you make progress in your career.

Q: What is AWS CloudFormation ?
Ans:

CloudFormation is all about automating resource provisioning (Infrastructure as Code). So it simplifies the task of repeatedly and predictably creating groups of related resources that power your applications.

AWS CloudFormation offers an convenient way to developers and system administrators to create, manage, provision, and update a collection of related AWS resources in an orderly and predictable way.

  • Fully managed service
  • Create, update, and delete resources and sets known as stacks
  • Infrastructure as Code :

Q: What is Infrastructure as Code and its Benefits?
Ans:

Infrastructure as code is a technique whereby we create machine-readable files that describe our infrastructure.

Now there are many different technologies to do Infrastructure as code, and AWS CloudFormation is one example. AWS CloudFormation, you can maintain your infrastructure just like application source code.

Infrastructure as Code Benefits :
  • By codifying Infrastructure, that is describing it within a file, we have a way of including it within our source control solution. We can check-in the files into GitHub or whatever source control solution we're using. This makes it much easier to maintain the infrastructure, as we have the full power of the source control system to handle modifications to certain files. It makes deployments a lot smoother, too. Since the infrastructure is specified inside a file, it can be securely and continuously deployed over and over again.
  • In our build and release pipeline, we can also include it. So, as our application is deployed to the cloud, it is also possible to deploy any changes required to the infrastructure at the same time. It helps avoid what is known as environmental drift from occurring.
  • For testers, infrastructure as a code often provides advantages. Test teams have early access to production-like test environments, and an entirely new test environment that is very easily similar to the production environment can be spin up. This may be for load testing or penetration testing . When done, it is possible to break down and discard the environment.

Q: What is AWS CloudFormation Template?
Ans:

Templates are JSON or YAML formatted text files. AWS CloudFormation uses JSON or YAML format file to describe the collection of AWS resources (known as a stack), their associated dependencies, and any required runtime parameters is called CloudFormation Template

  • Text File
  • JSON or YAML format
  • Self-documenting environment
  • Resources to provision

Below is a basic AWS CloudFormation YAML-formatted template fragment. Templates contain parameters, resource declaration, and outputs. Templates can reference the outputs of other templates, which enables modularization.

---
AWSTemplateFormatVersion: "version date"
Description:
 String
Parameters:
 set of parameters
Mappings:
 set of mappings
Conditions:
 set of conditions
Transform:
 set of transforms
Resources:
 set of resources
Outputs:
 set of outputs

Here is an example of an AWS CloudFormation template. The template requests the name of an Amazon Elastic Compute Cloud (EC2) key pair from the user in the parameters section.2 The resources section of the template then creates an EC2 instance using that key pair, with an EC2 security group that enables HTTP (TCP port 80) access.

Parameters:
 KeyName:
 Description: The EC2 key pair to allow SSH access to the
instance
 Type: AWS::EC2::KeyPair::KeyName
Resources:
 Ec2Instance:
 Type: AWS::EC2::Instance
 Properties:
 SecurityGroups: !Ref InstanceSecurityGroup
 KeyName: !Ref KeyName
 ImageId: ami-70065467
 InstanceSecurityGroup:
 Type: AWS::EC2::SecurityGroup
 Properties:
 GroupDescription: Enable HTTP access via port 80
 SecurityGroupIngress:
 - IpProtocol: tcp
 FromPort: '80'
 ToPort: '80'
 CidrIp: 0.0.0.0/0

Q: What are benefits of AWS CloudFormation ?
Ans:

  • Infrastructure as a code : treat your infrastructure as a simplifying code that facilitates modification and changes.
  • Automated provisioning : We don't have to work on resources, we just have to improve his application. CloudFormation takes care of both the provision and control of resources
  • Safety controls : The inspections are automated to minimize stress and improve quality and efficiency.
  • Extensibility: CloudFormation Stack offers an expandable framework for our own extensions and adding them to the CloudFormation template. For a third party resource, customized extension provisioning can be created.
  • Centerlize Control : You can model a whole AWS infrastructure in a text file and construct multiple infrastructures with a single code using that design.

Q: What steps are involved in implementing a CloudFormation Solution?
Ans:

These are the steps to a solution for CloudFormation:

  1. To begin, we must code our infrastructure in a YAML or JSON text-based file known as a template to create√ā¬†CloudFormation template.
  2. Then we write our code locally in the AWS CloudFormation tool. Otherwise, we can use the S3 bucket to store a YAML or JSON file that will act as a repository for the code.
  3. Then, using the AWS CF GUI or the Command Line Interface, create a stack based on our template code by calling the bucket.
  4. CloudFormation reads the file and recognises the services, also known as the relationship between the services, before provisioning the services one after the other.
  5. Finally, CloudFormation deploys resources, provisiones them, and configures them according to the template we specified.

Q: How do you create and delete AWS stacks?
Ans:

  • AWS CloudFormation manages related resources as a single unit called a stack.
  • A stack of AWS CloudFormation template defines all resources.
  • A collection of resources can be created, updated and deleted by generating, updating and deleting stacks.
Checkout our related posts :

Q: what is the difference between AWS CloudFormation vs Elastic Beanstalk?
Ans:

  • Both services are designed to serve each other. Elastic Beanstalk is used to create an environment of any programming platform and easily deploy your applications and run it in the cloud. Developers tools are an add-on in Elastic Beanstalk.
  • Now, CloudFormation is a provisioning method that can be used to establish a predictable, recursive order for a wide variety of services. A complete infrastructure can be created using AWS CloudFormation.
  • Compared to Elastic Beanstalk and AWS OpsWorks, AWS CloudFormation gives you the most power and versatility when providing services. AWS CloudFormation allows you to manage a wide range of AWS resources.

Q: How does AWS Cloud Pipeline interact with CloudFormation ?
Ans:

You can use AWS Code Pipeline to run a Cloud Formation template in the deployment phase. The pipeline has following stages:

  • Source phase: Get the latest commit.
  • Build phase: Build the code into a docker image and push it to ECR.
  • Deploy phase: take the latest docker image from ECR, deploy it to ECS.

Q: Cloudformation template vs SAM template?
Ans:

Cloudformation template

SAM template

The AWS resources that make up a stack are declared in a Cloudformation template.

SAM templates are an extension of AWS CloudFormation templates that include some additional components that make them easier to use.

The template is saved as a text file that follows the JavaScript Object Notation (JSON) or YAML format standards. You declare the AWS resources you want to build and configure in the template.

Allows you to define serverless AWS Lambda applications at a higher level. It automates common tasks such as function role creation, and makes it easier to write CloudFormation templates for your serverless applications.

Q: What exactly is the Amazon Web Services CloudFormation Registry?
Ans:

The CloudFormation registry lists the extensions available for use in your CloudFormation account, both private and public (AWS). An extension is a artifact, registered in the CloudFormation Registry that augments CloudFormation's native functionality.

Before third-party resource types can be used to provision services with AWS CloudFormation models, they must first be recorded. Amazon, APN partners, Marketplace sellers, and the developer community may all build extensions. CloudFormation items like resource types and modules are examples of extensions.

Q: On top of CloudFormation, what does AWS Serverless Application Model offer?
Ans:

An Open Source framework that can help create serverless apps on AWS is an AWS Serverless Application Model.

AWS SAM has an application description template for the serverless application, AWS SAM is an extension to AWS CloudFormation's Template language that enables you to set AWS Lambda applications without servers, on a higher level. CloudFormation is supported in service configuration. It automates common tasks such as building functional role, making it easier for your serverless applications to type out CloudFormation templates.

Q: Describe the three main types of cloud services?
Ans:

The three primary forms of cloud services are as follows:

  • Computing : services such as EC2, Elastic Beanstalk, Lambda, Auto-Scaling, and Lightsat are examples.
  • Storage : S3, Glacier, Elastic Block Storage, and Elastic File System are examples of storage services.
  • Networking : VPC, Amazon CloudFront, and Route53 are examples of networking services.





































Recommendation for Top Popular Post :