

기계 번역으로 제공되는 번역입니다. 제공된 번역과 원본 영어의 내용이 상충하는 경우에는 영어 버전이 우선합니다.

# VPC 네트워크 생성
<a name="vpc-create"></a>

Amazon Managed Workflows for Apache Airflow에는 환경을 지원하기 위해 Amazon VPC 및 특정 네트워킹 구성 요소가 필요합니다. 이 가이드에서는 Amazon Managed Workflows for Apache Airflow 환경에 대한 Amazon VPC 네트워크를 생성하는 다양한 옵션에 대해 설명합니다.

**참고**  
Apache Airflow는 지연 시간이 짧은 네트워크 환경에서 가장 잘 작동합니다. 트래픽을 다른 지역이나 온프레미스 환경으로 트래픽을 라우팅하는 기존 Amazon VPC를 사용하는 경우 Amazon SQS, CloudWatch, Amazon S3 및 AWS KMS에 대한 AWS PrivateLink 엔드포인트를 추가하는 것이 좋습니다. Amazon MWAA에 대해 AWS PrivateLink를 구성하는 방법에 대한 자세한 내용은 [인터넷 액세스 없이 Amazon VPC 네트워크 생성](#vpc-create-template-private-only)을 참조하세요.

**Contents**
+ [사전 조건](#vpc-create-prereqs)
+ [시작하기 전 준비 사항](#vpc-create-how-networking)
+ [Amazon VPC 네트워크 생성 옵션](#vpc-create-options)
  + [옵션 1: Amazon MWAA 콘솔에서 VPC 네트워크 생성](#vpc-create-mwaa-console)
  + [옵션 2: 인터넷에 액세스할 수 *있는* Amazon VPC 네트워크 생성](#vpc-create-template-private-or-public)
  + [옵션 3: 인터넷에 액세스할 수 *없는* Amazon VPC 네트워크 생성](#vpc-create-template-private-only)
+ [다음 단계](#create-vpc-next-up)

## 사전 조건
<a name="vpc-create-prereqs"></a>

AWS Command Line Interface(AWS CLI)는 명령줄 쉘의 명령을 사용하여 AWS 서비스와 상호 작용할 수 있는 오픈 소스 도구입니다. 이 페이지에서 단계를 완료하려면 다음이 필요합니다.
+ [AWS CLI - 버전 2 설치](https://docs.aws.amazon.com/cli/latest/userguide/install-cliv2.html)
+ [AWS CLI - `aws configure`을 통한 빠른 구성](https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-configure.html).

## 시작하기 전 준비 사항
<a name="vpc-create-how-networking"></a>
+ 환경에 지정된 [VPC 네트워크](#vpc-create)는 환경 생성 후에는 변경할 수 없습니다.
+ Amazon VPC 및 Apache Airflow 웹 서버에 프라이빗 또는 퍼블릭 라우팅을 사용할 수 있습니다. 옵션 목록에 액세스하려면 [Amazon VPC 및 Apache Airflow 액세스 모드의 사용 사례 예시](networking-about.md#networking-about-network-usecase) 섹션을 참조하세요.

## Amazon VPC 네트워크 생성 옵션
<a name="vpc-create-options"></a>

다음 섹션에서는 환경에 대한 Amazon VPC 네트워크를 생성하는 데 사용할 수 있는 옵션을 설명합니다.

**참고**  
Amazon MWAA는 미국 동부(버지니아 북부) 리전에서 `use1-az3` 가용 영역(AZ) 사용을 지원하지 않습니다. 미국 동부(버지니아 북부) 리전에서 Amazon MWAA용 VPC를 생성할 때는 CloudFormation(CFN) 템플릿에서 `AvailabilityZone`를 명시적으로 할당해야 합니다. 할당된 가용 영역 이름을 `use1-az3`에 매핑해서는 안 됩니다. 다음 명령을 실행하여 해당 AZ ID에 대한 AZ 이름의 상세한 매핑을 검색할 수 있습니다.  

```
aws ec2 describe-availability-zones --region us-east-1
```

### 옵션 1: Amazon MWAA 콘솔에서 VPC 네트워크 생성
<a name="vpc-create-mwaa-console"></a>

다음 섹션에서는 Amazon MWAA 콘솔에서 Amazon VPC 네트워크를 생성하는 방법을 설명합니다. 이 옵션은 [인터넷을 통한 퍼블릭 라우팅](networking-about.md#networking-about-overview-public)를 사용합니다. **프라이빗 네트워크** 또는 **퍼블릭 네트워크** 액세스 모드의 Apache Airflow 웹 서버에 사용할 수 있습니다.

다음 이미지는 Amazon MWAA 콘솔에서 **MWAA VPC 생성** 버튼을 찾을 수 있는 위치를 보여줍니다.

![\[이 이미지는 Amazon MWAA 콘솔에서 MWAA VPC 생성을 찾을 수 있는 위치를 보여줍니다.\]](http://docs.aws.amazon.com/ko_kr/mwaa/latest/userguide/images/mwaa-console-create-vpc.png)


### 옵션 2: 인터넷에 액세스할 수 *있는* Amazon VPC 네트워크 생성
<a name="vpc-create-template-private-or-public"></a>

다음 CloudFormation 템플릿은 기본 AWS 리전에 인터넷 액세스가 가능한 Amazon VPC 네트워크를 생성합니다. 이 옵션은 [인터넷을 통한 퍼블릭 라우팅](networking-about.md#networking-about-overview-public)를 사용합니다. 이 템플릿은 **프라이빗 네트워크** 또는 **퍼블릭 네트워크** 액세스 모드의 Apache Airflow 웹 서버에 사용할 수 있습니다.

1. 다음 템플릿의 내용을 복사하고 로컬에 `cfn-vpc-public-private.yaml`로 저장합니다. [템플릿을 다운로드](./samples/cfn-vpc-public-private.zip)할 수도 있습니다.

   ```
   Description:  This template deploys a VPC, with a pair of public and private subnets spread
     across two Availability Zones. It deploys an internet gateway, with a default
     route on the public subnets. It deploys a pair of NAT gateways (one in each AZ),
     and default routes for them in the private subnets.
   
   Parameters:
     EnvironmentName:
       Description: An environment name that is prefixed to resource names
       Type: String
       Default: mwaa-
   
     VpcCIDR:
       Description: Please enter the IP range (CIDR notation) for this VPC
       Type: String
       Default: 10.192.0.0/16
   
     PublicSubnet1CIDR:
       Description: Please enter the IP range (CIDR notation) for the public subnet in the first Availability Zone
       Type: String
       Default: 10.192.10.0/24
   
     PublicSubnet2CIDR:
       Description: Please enter the IP range (CIDR notation) for the public subnet in the second Availability Zone
       Type: String
       Default: 10.192.11.0/24
   
     PrivateSubnet1CIDR:
       Description: Please enter the IP range (CIDR notation) for the private subnet in the first Availability Zone
       Type: String
       Default: 10.192.20.0/24
   
     PrivateSubnet2CIDR:
       Description: Please enter the IP range (CIDR notation) for the private subnet in the second Availability Zone
       Type: String
       Default: 10.192.21.0/24
   
   Resources:
     VPC:
       Type: AWS::EC2::VPC
       Properties:
         CidrBlock: !Ref VpcCIDR
         EnableDnsSupport: true
         EnableDnsHostnames: true
         Tags:
           - Key: Name
             Value: !Ref EnvironmentName
   
     InternetGateway:
       Type: AWS::EC2::InternetGateway
       Properties:
         Tags:
           - Key: Name
             Value: !Ref EnvironmentName
   
     InternetGatewayAttachment:
       Type: AWS::EC2::VPCGatewayAttachment
       Properties:
         InternetGatewayId: !Ref InternetGateway
         VpcId: !Ref VPC
   
     PublicSubnet1:
       Type: AWS::EC2::Subnet
       Properties:
         VpcId: !Ref VPC
         AvailabilityZone: !Select [ 0, !GetAZs '' ]
         CidrBlock: !Ref PublicSubnet1CIDR
         MapPublicIpOnLaunch: true
         Tags:
           - Key: Name
             Value: !Sub ${EnvironmentName} Public Subnet (AZ1)
   
     PublicSubnet2:
       Type: AWS::EC2::Subnet
       Properties:
         VpcId: !Ref VPC
         AvailabilityZone: !Select [ 1, !GetAZs  '' ]
         CidrBlock: !Ref PublicSubnet2CIDR
         MapPublicIpOnLaunch: true
         Tags:
           - Key: Name
             Value: !Sub ${EnvironmentName} Public Subnet (AZ2)
   
     PrivateSubnet1:
       Type: AWS::EC2::Subnet
       Properties:
         VpcId: !Ref VPC
         AvailabilityZone: !Select [ 0, !GetAZs  '' ]
         CidrBlock: !Ref PrivateSubnet1CIDR
         MapPublicIpOnLaunch: false
         Tags:
           - Key: Name
             Value: !Sub ${EnvironmentName} Private Subnet (AZ1)
   
     PrivateSubnet2:
       Type: AWS::EC2::Subnet
       Properties:
         VpcId: !Ref VPC
         AvailabilityZone: !Select [ 1, !GetAZs  '' ]
         CidrBlock: !Ref PrivateSubnet2CIDR
         MapPublicIpOnLaunch: false
         Tags:
           - Key: Name
             Value: !Sub ${EnvironmentName} Private Subnet (AZ2)
   
     NatGateway1EIP:
       Type: AWS::EC2::EIP
       DependsOn: InternetGatewayAttachment
       Properties:
         Domain: vpc
   
     NatGateway2EIP:
       Type: AWS::EC2::EIP
       DependsOn: InternetGatewayAttachment
       Properties:
         Domain: vpc
   
     NatGateway1:
       Type: AWS::EC2::NatGateway
       Properties:
         AllocationId: !GetAtt NatGateway1EIP.AllocationId
         SubnetId: !Ref PublicSubnet1
   
     NatGateway2:
       Type: AWS::EC2::NatGateway
       Properties:
         AllocationId: !GetAtt NatGateway2EIP.AllocationId
         SubnetId: !Ref PublicSubnet2
   
     PublicRouteTable:
       Type: AWS::EC2::RouteTable
       Properties:
         VpcId: !Ref VPC
         Tags:
           - Key: Name
             Value: !Sub ${EnvironmentName} Public Routes
   
     DefaultPublicRoute:
       Type: AWS::EC2::Route
       DependsOn: InternetGatewayAttachment
       Properties:
         RouteTableId: !Ref PublicRouteTable
         DestinationCidrBlock: 0.0.0.0/0
         GatewayId: !Ref InternetGateway
   
     PublicSubnet1RouteTableAssociation:
       Type: AWS::EC2::SubnetRouteTableAssociation
       Properties:
         RouteTableId: !Ref PublicRouteTable
         SubnetId: !Ref PublicSubnet1
   
     PublicSubnet2RouteTableAssociation:
       Type: AWS::EC2::SubnetRouteTableAssociation
       Properties:
         RouteTableId: !Ref PublicRouteTable
         SubnetId: !Ref PublicSubnet2
   
   
     PrivateRouteTable1:
       Type: AWS::EC2::RouteTable
       Properties:
         VpcId: !Ref VPC
         Tags:
           - Key: Name
             Value: !Sub ${EnvironmentName} Private Routes (AZ1)
   
     DefaultPrivateRoute1:
       Type: AWS::EC2::Route
       Properties:
         RouteTableId: !Ref PrivateRouteTable1
         DestinationCidrBlock: 0.0.0.0/0
         NatGatewayId: !Ref NatGateway1
   
     PrivateSubnet1RouteTableAssociation:
       Type: AWS::EC2::SubnetRouteTableAssociation
       Properties:
         RouteTableId: !Ref PrivateRouteTable1
         SubnetId: !Ref PrivateSubnet1
   
     PrivateRouteTable2:
       Type: AWS::EC2::RouteTable
       Properties:
         VpcId: !Ref VPC
         Tags:
           - Key: Name
             Value: !Sub ${EnvironmentName} Private Routes (AZ2)
   
     DefaultPrivateRoute2:
       Type: AWS::EC2::Route
       Properties:
         RouteTableId: !Ref PrivateRouteTable2
         DestinationCidrBlock: 0.0.0.0/0
         NatGatewayId: !Ref NatGateway2
   
     PrivateSubnet2RouteTableAssociation:
       Type: AWS::EC2::SubnetRouteTableAssociation
       Properties:
         RouteTableId: !Ref PrivateRouteTable2
         SubnetId: !Ref PrivateSubnet2
   
     SecurityGroup:
       Type: AWS::EC2::SecurityGroup
       Properties:
         GroupName: "mwaa-security-group"
         GroupDescription: "Security group with a self-referencing inbound rule."
         VpcId: !Ref VPC
   
     SecurityGroupIngress:
       Type: AWS::EC2::SecurityGroupIngress
       Properties:
         GroupId: !Ref SecurityGroup
         IpProtocol: "-1"
         SourceSecurityGroupId: !Ref SecurityGroup
   
   Outputs:
     VPC:
       Description: A reference to the created VPC
       Value: !Ref VPC
   
     PublicSubnets:
       Description: A list of the public subnets
       Value: !Join [ ",", [ !Ref PublicSubnet1, !Ref PublicSubnet2 ]]
   
     PrivateSubnets:
       Description: A list of the private subnets
       Value: !Join [ ",", [ !Ref PrivateSubnet1, !Ref PrivateSubnet2 ]]
   
     PublicSubnet1:
       Description: A reference to the public subnet in the 1st Availability Zone
       Value: !Ref PublicSubnet1
   
     PublicSubnet2:
       Description: A reference to the public subnet in the 2nd Availability Zone
       Value: !Ref PublicSubnet2
   
     PrivateSubnet1:
       Description: A reference to the private subnet in the 1st Availability Zone
       Value: !Ref PrivateSubnet1
   
     PrivateSubnet2:
       Description: A reference to the private subnet in the 2nd Availability Zone
       Value: !Ref PrivateSubnet2
   
     SecurityGroupIngress:
       Description: Security group with self-referencing inbound rule
       Value: !Ref SecurityGroupIngress
   ```

1. 명령 프롬프트에서 `cfn-vpc-public-private.yaml`이 저장된 디렉터리로 이동합니다. 예:

   ```
   cd mwaaproject
   ```

1. AWS CLI를 사용하여 스택을 생성하려면 [https://docs.aws.amazon.com/cli/latest/reference/cloudformation/create-stack.html](https://docs.aws.amazon.com/cli/latest/reference/cloudformation/create-stack.html) 명령을 사용합니다.

   ```
   aws cloudformation create-stack --stack-name mwaa-environment --template-body file://cfn-vpc-public-private.yaml
   ```
**참고**  
Amazon VPC 인프라를 생성하는 데 약 30분 정도 걸립니다.

### 옵션 3: 인터넷에 액세스할 수 *없는* Amazon VPC 네트워크 생성
<a name="vpc-create-template-private-only"></a>

다음 CloudFormation 템플릿은 기본 AWS 리전에서 *인터넷 액세스 없이* Amazon VPC 네트워크를 생성합니다.

이 옵션은 [인터넷 접속이 필요 없는 프라이빗 라우팅](networking-about.md#networking-about-overview-private)를 사용합니다. 이 템플릿은 **프라이빗 네트워크** 액세스 모드가 있는 Apache Airflow 웹 서버에만 사용할 수 있습니다. 이는 [환경에서 사용하는 AWS 서비스에 필요한 VPC 엔드포인트](vpc-vpe-create-access.md#vpc-vpe-create-view-endpoints-attach-services)를 생성합니다.

1. 다음 템플릿의 내용을 복사하고 로컬에 `cfn-vpc-private.yaml`로 저장합니다. [템플릿을 다운로드](./samples/cfn-vpc-private-no-ops.zip)할 수도 있습니다.

   ```
   AWSTemplateFormatVersion: "2010-09-09"
        
   Parameters:
      VpcCIDR:
        Description: The IP range (CIDR notation) for this VPC
        Type: String
        Default: 10.192.0.0/16
        
      PrivateSubnet1CIDR:
        Description: The IP range (CIDR notation) for the private subnet in the first Availability Zone
        Type: String
        Default: 10.192.10.0/24
        
      PrivateSubnet2CIDR:
        Description: The IP range (CIDR notation) for the private subnet in the second Availability Zone
        Type: String
        Default: 10.192.11.0/24
        
   Resources:
      VPC:
        Type: AWS::EC2::VPC
        Properties:
          CidrBlock: !Ref VpcCIDR
          EnableDnsSupport: true
          EnableDnsHostnames: true
          Tags:
           - Key: Name
             Value: !Ref AWS::StackName
        
      RouteTable:
        Type: AWS::EC2::RouteTable
        Properties:
          VpcId: !Ref VPC
          Tags:
           - Key: Name
             Value: !Sub "${AWS::StackName}-route-table"
        
      PrivateSubnet1:
        Type: AWS::EC2::Subnet
        Properties:
          VpcId: !Ref VPC
          AvailabilityZone: !Select [ 0, !GetAZs  '' ]
          CidrBlock: !Ref PrivateSubnet1CIDR
          MapPublicIpOnLaunch: false
          Tags:
           - Key: Name
             Value: !Sub "${AWS::StackName} Private Subnet (AZ1)"
        
      PrivateSubnet2:
        Type: AWS::EC2::Subnet
        Properties:
          VpcId: !Ref VPC
          AvailabilityZone: !Select [ 1, !GetAZs  '' ]
          CidrBlock: !Ref PrivateSubnet2CIDR
          MapPublicIpOnLaunch: false
          Tags:
           - Key: Name
             Value: !Sub "${AWS::StackName} Private Subnet (AZ2)"
        
      PrivateSubnet1RouteTableAssociation:
        Type: AWS::EC2::SubnetRouteTableAssociation
        Properties:
          RouteTableId: !Ref RouteTable
          SubnetId: !Ref PrivateSubnet1
        
      PrivateSubnet2RouteTableAssociation:
        Type: AWS::EC2::SubnetRouteTableAssociation
        Properties:
          RouteTableId: !Ref RouteTable
          SubnetId: !Ref PrivateSubnet2
        
      S3VpcEndoint:
        Type: AWS::EC2::VPCEndpoint
        Properties:
          ServiceName: !Sub "com.amazonaws.${AWS::Region}.s3"
          VpcEndpointType: Gateway
          VpcId: !Ref VPC
          RouteTableIds:
           - !Ref RouteTable
        
      SecurityGroup:
        Type: AWS::EC2::SecurityGroup
        Properties:
          VpcId: !Ref VPC
          GroupDescription: Security Group for Amazon MWAA Environments to access VPC endpoints
          GroupName: !Sub "${AWS::StackName}-mwaa-vpc-endpoints"
      
      SecurityGroupIngress:
        Type: AWS::EC2::SecurityGroupIngress
        Properties:
          GroupId: !Ref SecurityGroup
          IpProtocol: "-1"
          SourceSecurityGroupId: !Ref SecurityGroup
      
      SqsVpcEndoint:
        Type: AWS::EC2::VPCEndpoint
        Properties:
          ServiceName: !Sub "com.amazonaws.${AWS::Region}.sqs"
          VpcEndpointType: Interface
          VpcId: !Ref VPC
          PrivateDnsEnabled: true
          SubnetIds:
           - !Ref PrivateSubnet1
           - !Ref PrivateSubnet2
          SecurityGroupIds:
           - !Ref SecurityGroup
        
      CloudWatchLogsVpcEndoint:
        Type: AWS::EC2::VPCEndpoint
        Properties:
          ServiceName: !Sub "com.amazonaws.${AWS::Region}.logs"
          VpcEndpointType: Interface
          VpcId: !Ref VPC
          PrivateDnsEnabled: true
          SubnetIds:
           - !Ref PrivateSubnet1
           - !Ref PrivateSubnet2
          SecurityGroupIds:
           - !Ref SecurityGroup
        
      CloudWatchMonitoringVpcEndoint:
        Type: AWS::EC2::VPCEndpoint
        Properties:
          ServiceName: !Sub "com.amazonaws.${AWS::Region}.monitoring"
          VpcEndpointType: Interface
          VpcId: !Ref VPC
          PrivateDnsEnabled: true
          SubnetIds:
           - !Ref PrivateSubnet1
           - !Ref PrivateSubnet2
          SecurityGroupIds:
           - !Ref SecurityGroup
        
      KmsVpcEndoint:
        Type: AWS::EC2::VPCEndpoint
        Properties:
          ServiceName: !Sub "com.amazonaws.${AWS::Region}.kms"
          VpcEndpointType: Interface
          VpcId: !Ref VPC
          PrivateDnsEnabled: true
          SubnetIds:
           - !Ref PrivateSubnet1
           - !Ref PrivateSubnet2
          SecurityGroupIds:
           - !Ref SecurityGroup
   
   
   Outputs:
      VPC:
        Description: A reference to the created VPC
        Value: !Ref VPC
        
      MwaaSecurityGroupId:
        Description: Associates the Security Group to the environment to allow access to the VPC endpoints 
        Value: !Ref SecurityGroup
        
      PrivateSubnets:
        Description: A list of the private subnets
        Value: !Join [ ",", [ !Ref PrivateSubnet1, !Ref PrivateSubnet2 ]]
        
      PrivateSubnet1:
        Description: A reference to the private subnet in the 1st Availability Zone
        Value: !Ref PrivateSubnet1
        
      PrivateSubnet2:
        Description: A reference to the private subnet in the 2nd Availability Zone
        Value: !Ref PrivateSubnet2
   ```

1. 명령 프롬프트에서 `cfn-vpc-private.yml`이 저장된 디렉터리로 이동합니다. 예:

   ```
   cd mwaaproject
   ```

1. AWS CLI를 사용하여 스택을 생성하려면 [https://docs.aws.amazon.com/cli/latest/reference/cloudformation/create-stack.html](https://docs.aws.amazon.com/cli/latest/reference/cloudformation/create-stack.html) 명령을 사용합니다.

   ```
   aws cloudformation create-stack --stack-name mwaa-private-environment --template-body file://cfn-vpc-private.yml
   ```
**참고**  
Amazon VPC 인프라를 생성하는 데 약 30분 정도 걸립니다.

1. 컴퓨터에서 이러한 VPC 엔드포인트에 액세스하기 위한 메커니즘을 생성해야 합니다. 자세한 내용은 [Amazon MWAA에서 서비스별 Amazon VPC 엔드포인트에 대한 액세스 관리](vpc-vpe-access.md) 섹션을 참조하세요.

**참고**  
Amazon MWAA 보안 그룹의 CIDR에서 아웃바운드 액세스를 추가로 제한할 수 있습니다. 예를 들어 자체 참조 아웃바운드 규칙, Amazon S3의 [접두사 목록](https://docs.aws.amazon.com/vpc/latest/privatelink/vpce-gateway.html), Amazon VPC의 CIDR을 추가하여 자체적으로 제한할 수 있습니다.

## 다음 단계
<a name="create-vpc-next-up"></a>
+ [Amazon MWAA 환경 생성](create-environment.md)에서 Amazon MWAA 환경을 만드는 방법을 알아봅니다.
+ [튜토리얼: AWS Client VPN을(를) 사용한 프라이빗 네트워크 액세스 구성](tutorials-private-network-vpn-client.md)에서 프라이빗 라우팅을 사용하여 컴퓨터에서 Amazon VPC로 VPN 터널을 생성하는 방법을 알아봅니다.