DEVELOPER BLOG

HOME > DEVELOPER BLOG > 【Introduction to AWS】What is Infrastructure as Code? - PrismScaler

【Introduction to AWS】What is Infrastructure as Code? - PrismScaler

1. Introduction

Hello! We are a writer team from Definer Inc. In this issue, you are wondering about the use of Infrastructure as Code in AWS. Let's take a look at the actual screens and resources to explain in detail.

2. Purpose/Use Cases

This article is about using the Cloudformation technology for the purpose of "managing cloud resources in code". It summarizes information and practices that can be helpful when you want to use Cloudformation to manage AWS resources Infrastructure as Code (IaC) in IT.

3. Infrastructure as Code Overview

Infrastructure as Code (IaC) is the creation and management of infrastructure and its configuration in code. Instead of the traditional method of manually creating resources on the AWS console, infrastructure settings are put into code and resource creation is performed automatically. Using IaC is expected to reduce human error and increase development speed because it is coded. AWS has an IaC service called Cloudformation (Cfn). Cloudformation allows resources to be described in yaml or json format, and there is a 1:1 correspondence between the Cloudformation unit called a stack and the described resources.

4. Try to create a Cloudformation configuration file

We will create a VPC using Cloudformation as soon as possible. Below is a description of the VPC in json format.   It is hard to comment out.
{
  "AWSTemplateFormatVersion": "2010-09-09",
  "Description": "definer-vpc-test",
  "Resources": {
    "VPC": {
      "Type": "AWS::EC2::VPC",
      "Properties": {
        "CidrBlock": "172.16.0.0/16",
        "EnableDnsSupport": true,
        "EnableDnsHostnames": true,
        "Tags": [
          {
            "Key": "Name",
            "Value": "definer-test"
          }
        ]
      }
    }
  }
}                
 

Then, I described the same VPC as above in yaml.
Since comments can be written, visibility seems to be higher than json.
# Comment

AWSTemplateFormatVersion: "2010-09-09"
Description: definer-vpc-test
Resources:
  VPC:
    Type: AWS::EC2::VPC
    Properties:
      CidrBlock: 172.16.0.0/16
      EnableDnsSupport: true
      EnableDnsHostnames: true
      Tags:
      - Key: Name
        Value: definer-test                  

5. Try running Cloudformation

Finally, let's create a VPC using this template. ① Log in to AWS and go to the Cloudformation screen. ② Click "Create Stack" -> "Use New Resource (Standard)" to move to the stack creation details screen. ③ Select "Upload Template File" and upload the yaml file or json file you have just created. ④ Enter an arbitrary stack name. The other items can be left as default. ⑤ Press "Create Stack" to start VPC creation.   After the stack creation is complete, a look at the list of VPCs on the VPC screen confirms that a VPC has indeed been created!

6. Cited/Referenced Articles

7. About the proprietary solution "PrismScaler"

・PrismScaler is a web service that enables the construction of multi-cloud infrastructures such as AWS, Azure, and GCP in just three steps, without requiring development and operation. ・PrismScaler is a web service that enables multi-cloud infrastructure construction such as AWS, Azure, GCP, etc. in just 3 steps without development and operation. ・The solution is designed for a wide range of usage scenarios such as cloud infrastructure construction/cloud migration, cloud maintenance and operation, and cost optimization, and can easily realize more than several hundred high-quality general-purpose cloud infrastructures by appropriately combining IaaS and PaaS.  

8. Contact us

This article provides useful introductory information free of charge. For consultation and inquiries, please contact "Definer Inc".

9. Regarding Definer

・Definer Inc. provides one-stop solutions from upstream to downstream of IT. ・We are committed to providing integrated support for advanced IT technologies such as AI and cloud IT infrastructure, from consulting to requirement definition/design development/implementation, and maintenance and operation. ・We are committed to providing integrated support for advanced IT technologies such as AI and cloud IT infrastructure, from consulting to requirement definition, design development, implementation, maintenance, and operation. ・PrismScaler is a high-quality, rapid, "auto-configuration," "auto-monitoring," "problem detection," and "configuration visualization" for multi-cloud/IT infrastructure such as AWS, Azure, and GCP.