

# CloudFormation을 사용하여 보안 그룹 관리
<a name="quickref-ec2-sg"></a>

다음 코드 조각은 CloudFormation을 사용하여 보안 그룹과 Amazon EC2 인스턴스를 관리하여 AWS 리소스에 대한 액세스를 제어하는 방법을 보여줍니다.

**Topics**
+ [보안 그룹과 Amazon EC2 인스턴스 연결](#quickref-ec2-instances-associate-security-group)
+ [인그레스 규칙이 있는 보안 그룹 생성](#quickref-ec2-instances-ingress)
+ [보안 그룹 인그레스 규칙이 있는 Elastic Load Balancer 생성](#scenario-ec2-security-group-elbingress)

## 보안 그룹과 Amazon EC2 인스턴스 연결
<a name="quickref-ec2-instances-associate-security-group"></a>

다음 예제 코드 조각은 CloudFormation을 사용하여 Amazon EC2 인스턴스를 기본 Amazon VPC 보안 그룹과 연결하는 방법을 보여줍니다.

**Topics**
+ [기본 VPC 보안 그룹과 Amazon EC2 인스턴스 연결](#using-cfn-getatt-default-values)
+ [연결된 볼륨 및 보안 그룹을 포함하는 Amazon EC2 인스턴스를 생성합니다.](#scenario-ec2-volumeattachment)

### 기본 VPC 보안 그룹과 Amazon EC2 인스턴스 연결
<a name="using-cfn-getatt-default-values"></a>

다음 코드 조각은 Amazon VPC, VPC 내의 서브넷, Amazon EC2 인스턴스를 생성합니다. VPC는 [AWS::EC2::VPC](https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/aws-resource-ec2-vpc.html) 리소스를 사용하여 생성됩니다. VPC의 IP 주소 범위는 더 큰 템플릿에서 정의되며 `MyVPCCIDRRange` 파라미터에 의해 참조됩니다.

서브넷은 [AWS::EC2:: Subnet](https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/aws-resource-ec2-subnet.html) 리소스를 사용하여 VPC 내에 생성됩니다. 서브넷은 `MyVPC`(으)로 참조되는 VPC와 연결됩니다.

EC2 인스턴스는 [AWS::EC2::Instance](https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/aws-resource-ec2-instance.html) 리소스를 사용하여 VPC와 서브넷 내에서 시작됩니다. 이 리소스는 인스턴스를 시작하는 데 사용할 Amazon Machine Image(AMI), 인스턴스를 실행할 서브넷, 인스턴스와 연결할 보안 그룹을 지정합니다. `ImageId`는 Systems Manager 파라미터를 사용하여 최신 Amazon Linux 2 AMI를 동적으로 검색합니다.

보안 그룹 ID는 `MyVPC` 리소스에서 기본 보안 그룹을 검색하는 `Fn::GetAtt` 함수를 사용하여 가져옵니다.

인스턴스는 코드 조각에 정의된 `MySubnet` 리소스 내에 배치됩니다.

CloudFormation을 사용하여 VPC를 생성하는 경우 AWS는 VPC 내에 기본 보안 그룹을 포함한 기본 리소스를 자동으로 생성합니다. 하지만 CloudFormation 템플릿 내에 VPC를 정의하면 템플릿을 생성할 때 이러한 기본 리소스의 ID에 액세스하지 못할 수 있습니다. 템플릿에 지정된 기본 리소스에 액세스하고 사용하려면 `Fn::GetAtt`와(과) 같은 내장 함수를 사용할 수 있습니다. 이 함수를 사용하면 CloudFormation에서 자동으로 생성한 기본 리소스를 사용하여 작업할 수 있습니다.

#### JSON
<a name="quickref-ec2-example-15.json"></a>

```
"MyVPC": {
    "Type": "AWS::EC2::VPC",
    "Properties": {
        "CidrBlock": {
            "Ref": "MyVPCCIDRRange"
        },
        "EnableDnsSupport": false,
        "EnableDnsHostnames": false,
        "InstanceTenancy": "default"
    }
},
"MySubnet": {
    "Type": "AWS::EC2::Subnet",
    "Properties": {
        "CidrBlock": {
            "Ref": "MyVPCCIDRRange"
        },
        "VpcId": {
            "Ref": "MyVPC"
        }
    }
},
"MyInstance": {
    "Type": "AWS::EC2::Instance",
    "Properties": {
        "ImageId": "{{resolve:ssm:/aws/service/ami-amazon-linux-latest/amzn2-ami-hvm-x86_64-gp2}}",
        "SecurityGroupIds": [
            {
                "Fn::GetAtt": [
                    "MyVPC",
                    "DefaultSecurityGroup"
                ]
            }
        ],
        "SubnetId": {
            "Ref": "MySubnet"
        }
    }
}
```

#### YAML
<a name="quickref-ec2-example-15.yaml"></a>

```
MyVPC:
  Type: AWS::EC2::VPC
  Properties:
    CidrBlock:
      Ref: MyVPCCIDRRange
    EnableDnsSupport: false
    EnableDnsHostnames: false
    InstanceTenancy: default
MySubnet:
  Type: AWS::EC2::Subnet
  Properties:
    CidrBlock:
      Ref: MyVPCCIDRRange
    VpcId:
      Ref: MyVPC
MyInstance:
  Type: AWS::EC2::Instance
  Properties:
    ImageId: '{{resolve:ssm:/aws/service/ami-amazon-linux-latest/amzn2-ami-hvm-x86_64-gp2}}'
    SecurityGroupIds:
      - Fn::GetAtt:
          - MyVPC
          - DefaultSecurityGroup
    SubnetId:
      Ref: MySubnet
```

### 연결된 볼륨 및 보안 그룹을 포함하는 Amazon EC2 인스턴스를 생성합니다.
<a name="scenario-ec2-volumeattachment"></a>

다음 코드 조각은 지정된 AMI에서 시작되는 [AWS::EC2::Instance](https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/aws-resource-ec2-instance.html) 리소스를 사용하여 Amazon EC2 인스턴스를 생성합니다. 인스턴스는 [AWS::EC2::SecurityGroup](https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/aws-resource-ec2-securitygroup.html) 리소스를 사용하여 지정된 IP 주소로부터 포트 22로 들어오는 SSH 트래픽을 허용하는 보안 그룹과 연결됩니다. [AWS::EC2::Volume](https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/aws-resource-ec2-volume.html) 리소스를 사용하여 100GB Amazon EBS 볼륨을 생성합니다. 볼륨은 `GetAtt` 함수에 지정된 대로 인스턴스와 동일한 가용 영역에 생성되며 `/dev/sdh` 디바이스의 인스턴스에 마운트됩니다.

Amazon EBS 볼륨 생성에 대한 자세한 내용은 [Amazon EBS 볼륨 생성](https://docs.aws.amazon.com/ebs/latest/userguide/ebs-creating-volume.html)을 참조하세요.

#### JSON
<a name="quickref-ec2-example-14.json"></a>

```
 1. "Ec2Instance": {
 2.     "Type": "AWS::EC2::Instance",
 3.     "Properties": {
 4.         "SecurityGroups": [
 5.             {
 6.                 "Ref": "InstanceSecurityGroup"
 7.             }
 8.         ],
 9.         "ImageId": "ami-1234567890abcdef0"
10.     }
11. },
12. "InstanceSecurityGroup": {
13.     "Type": "AWS::EC2::SecurityGroup",
14.     "Properties": {
15.         "GroupDescription": "Enable SSH access via port 22",
16.         "SecurityGroupIngress": [
17.             {
18.                 "IpProtocol": "tcp",
19.                 "FromPort": "22",
20.                 "ToPort": "22",
21.                 "CidrIp": "192.0.2.0/24"
22.             }
23.         ]
24.     }
25. },
26. "NewVolume": {
27.     "Type": "AWS::EC2::Volume",
28.     "Properties": {
29.         "Size": "100",
30.         "AvailabilityZone": {
31.             "Fn::GetAtt": [
32.                 "Ec2Instance",
33.                 "AvailabilityZone"
34.             ]
35.         }
36.     }
37. },
38. "MountPoint": {
39.     "Type": "AWS::EC2::VolumeAttachment",
40.     "Properties": {
41.         "InstanceId": {
42.             "Ref": "Ec2Instance"
43.         },
44.         "VolumeId": {
45.             "Ref": "NewVolume"
46.         },
47.         "Device": "/dev/sdh"
48.     }
49. }
```

#### YAML
<a name="quickref-ec2-example-14.yaml"></a>

```
 1. Ec2Instance:
 2.   Type: AWS::EC2::Instance
 3.   Properties:
 4.     SecurityGroups:
 5.       - !Ref InstanceSecurityGroup
 6.     ImageId: ami-1234567890abcdef0
 7. InstanceSecurityGroup:
 8.   Type: AWS::EC2::SecurityGroup
 9.   Properties:
10.     GroupDescription: Enable SSH access via port 22
11.     SecurityGroupIngress:
12.       - IpProtocol: tcp
13.         FromPort: 22
14.         ToPort: 22
15.         CidrIp: 192.0.2.0/24
16. NewVolume:
17.   Type: AWS::EC2::Volume
18.   Properties:
19.     Size: 100
20.     AvailabilityZone: !GetAtt [Ec2Instance, AvailabilityZone]
21. MountPoint:
22.   Type: AWS::EC2::VolumeAttachment
23.   Properties:
24.     InstanceId: !Ref Ec2Instance
25.     VolumeId: !Ref NewVolume
26.     Device: /dev/sdh
```

## 인그레스 규칙이 있는 보안 그룹 생성
<a name="quickref-ec2-instances-ingress"></a>

다음 코드 조각 예제는 CloudFormation을 사용하여 특정 인그레스 규칙이 있는 보안 그룹을 구성하는 방법을 보여줍니다.

**Topics**
+ [SSH 및 HTTP 액세스를 위한 인그레스 규칙이 있는 보안 그룹 생성](#scenario-ec2-security-group-rule)
+ [지정된 CIDR 범위에서의 HTTP 및 SSH 액세스에 대한 인그레스 규칙이 있는 보안 그룹 생성](#scenario-ec2-security-group-two-ports)
+ [인그레스 규칙이 있는 교차 참조 보안 그룹 생성](#scenario-ec2-security-group-ingress)

### SSH 및 HTTP 액세스를 위한 인그레스 규칙이 있는 보안 그룹 생성
<a name="scenario-ec2-security-group-rule"></a>

다음 코드 조각은 [AWS::EC2::SecurityGroup](https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/aws-resource-ec2-securitygroup.html) 리소스를 사용하는 두 가지 보안 그룹 인그레스 규칙을 설명합니다. 첫 번째 인그레스 규칙은 계정 번호가 `1111-2222-3333`인 AWS 계정이 소유한 `MyAdminSecurityGroup`이라는 기존 보안 그룹에서의 SSH(포트 22) 액세스를 허용합니다. 두 번째 인그레스 규칙은 동일한 템플릿에서 생성된 `MySecurityGroupCreatedInCFN`이라는 다른 보안 그룹에서의 HTTP(포트 80) 액세스를 허용합니다. `Ref` 함수는 동일한 템플릿에 생성된 보안 그룹의 논리명을 참조하는 데 사용됩니다.

첫 번째 인그레스 규칙에서는 `SourceSecurityGroupName` 및 `SourceSecurityGroupOwnerId` 속성 모두에 값을 추가해야 합니다. 두 번째 인그레스 규칙에서 `MySecurityGroupCreatedInCFNTemplate`은(는) 동일한 템플릿에 생성된 다른 보안 그룹을 참조합니다. 논리명 `MySecurityGroupCreatedInCFNTemplate`이(가) 더 큰 템플릿에서 지정한 보안 그룹 리소스의 실제 논리명과 일치하는지 확인합니다.

보안 그룹에 대한 자세한 내용은 *Amazon EC2 사용 설명서*의 [Amazon EC2 인스턴스에 대한 Amazon EC2 보안 그룹](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-security-groups.html)을 참조하세요.

#### JSON
<a name="quickref-ec2-example-10.json"></a>

```
 1. "SecurityGroup": {
 2.     "Type": "AWS::EC2::SecurityGroup",
 3.     "Properties": {
 4.         "GroupDescription": "Allow connections from specified source security group",
 5.         "SecurityGroupIngress": [
 6.             {
 7.                 "IpProtocol": "tcp",
 8.                 "FromPort": "22",
 9.                 "ToPort": "22",
10.                 "SourceSecurityGroupName": "MyAdminSecurityGroup",
11.                 "SourceSecurityGroupOwnerId": "1111-2222-3333"
12.             },
13.             {
14.                 "IpProtocol": "tcp",
15.                 "FromPort": "80",
16.                 "ToPort": "80",
17.                 "SourceSecurityGroupName": {
18.                     "Ref": "MySecurityGroupCreatedInCFNTemplate"
19.                 }
20.             }
21.         ]
22.     }
23. }
```

#### YAML
<a name="quickref-ec2-example-10.yaml"></a>

```
 1. SecurityGroup:
 2.   Type: AWS::EC2::SecurityGroup
 3.   Properties:
 4.     GroupDescription: Allow connections from specified source security group
 5.     SecurityGroupIngress:
 6.       - IpProtocol: tcp
 7.         FromPort: '22'
 8.         ToPort: '22'
 9.         SourceSecurityGroupName: MyAdminSecurityGroup
10.         SourceSecurityGroupOwnerId: '1111-2222-3333'
11.       - IpProtocol: tcp
12.         FromPort: '80'
13.         ToPort: '80'
14.         SourceSecurityGroupName:
15.           Ref: MySecurityGroupCreatedInCFNTemplate
```

### 지정된 CIDR 범위에서의 HTTP 및 SSH 액세스에 대한 인그레스 규칙이 있는 보안 그룹 생성
<a name="scenario-ec2-security-group-two-ports"></a>

다음 코드 조각은 두 가지 인바운드 규칙이 있는 Amazon EC2 인스턴스용 보안 그룹을 생성합니다. 인바운드 규칙은 지정된 CIDR 범위에서 지정된 포트로 들어오는 TCP 트래픽을 허용합니다. 규칙을 지정하는 데 [AWS::EC2::SecurityGroup](https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/aws-resource-ec2-securitygroup.html) 리소스가 사용됩니다. 각 규칙마다 프로토콜을 지정해야 합니다. TCP의 경우 포트 또는 포트 범위도 지정해야 합니다. 소스 보안 그룹 또는 CIDR 범위를 지정하지 않으면 스택이 성공적으로 시작되지만 규칙이 보안 그룹에 적용되지 않습니다.

보안 그룹에 대한 자세한 내용은 *Amazon EC2 사용 설명서*의 [Amazon EC2 인스턴스에 대한 Amazon EC2 보안 그룹](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-security-groups.html)을 참조하세요.

#### JSON
<a name="quickref-ec2-example-9.json"></a>

```
 1. "ServerSecurityGroup": {
 2.   "Type": "AWS::EC2::SecurityGroup",
 3.   "Properties": {
 4.     "GroupDescription": "Allow connections from specified CIDR ranges",
 5.     "SecurityGroupIngress": [
 6.       {
 7.         "IpProtocol": "tcp",
 8.         "FromPort": "80",
 9.         "ToPort": "80",
10.         "CidrIp": "192.0.2.0/24"
11.       },
12.       {
13.         "IpProtocol": "tcp",
14.         "FromPort": "22",
15.         "ToPort": "22",
16.         "CidrIp": "192.0.2.0/24"
17.       }
18.     ]
19.   }
20. }
```

#### YAML
<a name="quickref-ec2-example-9.yaml"></a>

```
 1. ServerSecurityGroup:
 2.   Type: AWS::EC2::SecurityGroup
 3.   Properties:
 4.     GroupDescription: Allow connections from specified CIDR ranges
 5.     SecurityGroupIngress:
 6.       - IpProtocol: tcp
 7.         FromPort: 80
 8.         ToPort: 80
 9.         CidrIp: 192.0.2.0/24
10.       - IpProtocol: tcp
11.         FromPort: 22
12.         ToPort: 22
13.         CidrIp: 192.0.2.0/24
```

### 인그레스 규칙이 있는 교차 참조 보안 그룹 생성
<a name="scenario-ec2-security-group-ingress"></a>

다음 코드 조각은 [AWS::EC2::SecurityGroup](https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/aws-resource-ec2-securitygroup.html) 리소스를 사용하여 두 개의 Amazon EC2 보안 그룹 `SGroup1` 및 `SGroup2`을(를) 생성합니다. 두 보안 그룹 간의 통신을 허용하는 인그레스 규칙은 [AWS::EC2::SecurityGroupIngress](https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/aws-resource-ec2-securitygroupingress.html) 리소스를 사용하여 생성됩니다. `SGroup1Ingress`은(는) 소스 보안 그룹 `SGroup2`에서 포트 80으로 들어오는 TCP 트래픽을 허용하는 `SGroup1`의 인그레스 규칙을 설정합니다. `SGroup2Ingress`은(는) 소스 보안 그룹 `SGroup1`에서 포트 80으로 들어오는 TCP 트래픽을 허용하는 `SGroup2`의 인그레스 규칙을 설정합니다.

#### JSON
<a name="quickref-ec2-example-12.json"></a>

```
 1. "SGroup1": {
 2.     "Type": "AWS::EC2::SecurityGroup",
 3.     "Properties": {
 4.         "GroupDescription": "EC2 instance access"
 5.     }
 6. },
 7. "SGroup2": {
 8.     "Type": "AWS::EC2::SecurityGroup",
 9.     "Properties": {
10.         "GroupDescription": "EC2 instance access"
11.     }
12. },
13. "SGroup1Ingress": {
14.     "Type": "AWS::EC2::SecurityGroupIngress",
15.     "Properties": {
16.         "GroupName": {
17.             "Ref": "SGroup1"
18.         },
19.         "IpProtocol": "tcp",
20.         "ToPort": "80",
21.         "FromPort": "80",
22.         "SourceSecurityGroupName": {
23.             "Ref": "SGroup2"
24.         }
25.     }
26. },
27. "SGroup2Ingress": {
28.     "Type": "AWS::EC2::SecurityGroupIngress",
29.     "Properties": {
30.         "GroupName": {
31.             "Ref": "SGroup2"
32.         },
33.         "IpProtocol": "tcp",
34.         "ToPort": "80",
35.         "FromPort": "80",
36.         "SourceSecurityGroupName": {
37.             "Ref": "SGroup1"
38.         }
39.     }
40. }
```

#### YAML
<a name="quickref-ec2-example-12.yaml"></a>

```
 1. SGroup1:
 2.   Type: AWS::EC2::SecurityGroup
 3.   Properties:
 4.     GroupDescription: EC2 Instance access
 5. SGroup2:
 6.   Type: AWS::EC2::SecurityGroup
 7.   Properties:
 8.     GroupDescription: EC2 Instance access
 9. SGroup1Ingress:
10.   Type: AWS::EC2::SecurityGroupIngress
11.   Properties:
12.     GroupName: !Ref SGroup1
13.     IpProtocol: tcp
14.     ToPort: 80
15.     FromPort: 80
16.     SourceSecurityGroupName: !Ref SGroup2
17. SGroup2Ingress:
18.   Type: AWS::EC2::SecurityGroupIngress
19.   Properties:
20.     GroupName: !Ref SGroup2
21.     IpProtocol: tcp
22.     ToPort: 80
23.     FromPort: 80
24.     SourceSecurityGroupName: !Ref SGroup1
```

## 보안 그룹 인그레스 규칙이 있는 Elastic Load Balancer 생성
<a name="scenario-ec2-security-group-elbingress"></a>

다음 템플릿은 지정된 가용 영역에 [AWS::ElasticLoadBalancing::LoadBalancer](https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/aws-resource-elasticloadbalancing-loadbalancer.html) 리소스를 생성합니다. [AWS::ElasticLoadBalancing::LoadBalancer](https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/aws-resource-elasticloadbalancing-loadbalancer.html) 리소스는 포트 80에서 HTTP 트래픽을 수신하고 포트 80에서 인스턴스로 직접 요청을 보내도록 구성됩니다. Elastic Load Balancer는 인스턴스 간에 들어오는 HTTP 트래픽의 로드 밸런싱을 담당합니다.

 또한 이 템플릿은 로드 밸런서와 연결된 [AWS::EC2::SecurityGroup](https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/aws-resource-ec2-securitygroup.html) 리소스를 생성합니다. 이 보안 그룹은 포트 80에서 들어오는 TCP 트래픽을 허용하는 단일 인그레스 규칙(`ELB ingress group`(으)로 설명됨)으로 생성됩니다. 이 인그레스 규칙의 소스는 로드 밸런서 리소스에서 속성을 검색하는 `Fn::GetAtt` 함수를 사용하여 정의됩니다. `SourceSecurityGroupOwnerId`은(는) `Fn::GetAtt`을 사용하여 로드 밸런서 소스 보안 그룹의 `OwnerAlias`을(를) 가져옵니다. `SourceSecurityGroupName`은(는) `Fn::Getatt`을(를) 사용하여 ELB 소스 보안 그룹의 `GroupName`을(를) 가져옵니다.

이 설정은 ELB와 인스턴스 간의 보안 통신을 보장합니다.

로드 밸런싱에 대한 자세한 내용은 [Elastic Load Balancing 사용 설명서](https://docs.aws.amazon.com/elasticloadbalancing/latest/userguide/)를 참조하세요.

### JSON
<a name="quickref-ec2-example-11.json"></a>

```
{
    "AWSTemplateFormatVersion": "2010-09-09",
    "Resources": {
        "MyELB": {
            "Type": "AWS::ElasticLoadBalancing::LoadBalancer",
            "Properties": {
                "AvailabilityZones": [
                    "aa-example-1a"
                ],
                "Listeners": [
                    {
                        "LoadBalancerPort": "80",
                        "InstancePort": "80",
                        "Protocol": "HTTP"
                    }
                ]
            }
        },
        "MyELBIngressGroup": {
            "Type": "AWS::EC2::SecurityGroup",
            "Properties": {
                "GroupDescription": "ELB ingress group",
                "SecurityGroupIngress": [
                    {
                        "IpProtocol": "tcp",
                        "FromPort": 80,
                        "ToPort": 80,
                        "SourceSecurityGroupOwnerId": {
                            "Fn::GetAtt": [
                                "MyELB",
                                "SourceSecurityGroup.OwnerAlias"
                            ]
                        },
                        "SourceSecurityGroupName": {
                            "Fn::GetAtt": [
                                "MyELB",
                                "SourceSecurityGroup.GroupName"
                            ]
                        }
                    }
                ]
            }
        }
    }
}
```

### YAML
<a name="quickref-ec2-example-11.yaml"></a>

```
AWSTemplateFormatVersion: '2010-09-09'
Resources:
  MyELB:
    Type: AWS::ElasticLoadBalancing::LoadBalancer
    Properties:
      AvailabilityZones:
        - aa-example-1a
      Listeners:
        - LoadBalancerPort: '80'
          InstancePort: '80'
          Protocol: HTTP
  MyELBIngressGroup:
    Type: AWS::EC2::SecurityGroup
    Properties:
      GroupDescription: ELB ingress group
      SecurityGroupIngress:
        - IpProtocol: tcp
          FromPort: '80'
          ToPort: '80'
          SourceSecurityGroupOwnerId:
            Fn::GetAtt:
              - MyELB
              - SourceSecurityGroup.OwnerAlias
          SourceSecurityGroupName:
            Fn::GetAtt:
              - MyELB
              - SourceSecurityGroup.GroupName
```