

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

# Amazon MWAA에서 자체 Amazon VPC 엔드포인트 관리
<a name="vpc-endpoint-management"></a>

Amazon MWAA는 Amazon VPC 엔드포인트를 사용하여 Apache Airflow 환경을 설정하는 데 필요한 다양한 AWS 서비스와 통합합니다. 자체 엔드포인트 관리에는 다음과 같은 두 가지 기본 사용 사례가 있습니다.

1. 즉,를 사용하여 여러 리소스를 [AWS Organizations](https://aws.amazon.com/organizations/) 관리하고 공유할 때 공유 Amazon VPC에서 Apache Airflow 환경을 생성할 수 AWS 계정 있습니다.

1. 자체 엔드포인트 관리를 통해 엔드포인트를 사용하는 구체적인 리소스로 권한을 좁혀 보다 제한적인 액세스 정책을 사용할 수 있습니다.

자체 VPC 엔드포인트를 관리하도록 선택하는 경우 환경 RDS for PostgreSQL 데이터베이스와 환경 웹 서버에 대한 자체 엔드포인트를 직접 생성해야 합니다.

Amazon MWAA가 클라우드에서 Apache Airflow를 배포하는 방법에 대한 자세한 내용은 [Amazon MWAA 아키텍처 다이어그램](what-is-mwaa.md#architecture-mwaa)을 참조하세요.

**중요**  
Amazon MWAA는 고객 관리형 엔드포인트에 대한 IP 주소 유형(`AddressType`) 선택을 검증하지 않으므로 `AddressType`을 올바르게 지정해야 합니다(유효한 옵션은 IPv4 또는 IPv6).



## 공유 Amazon VPC에서 환경 생성
<a name="configure-shared-vpc"></a>

[AWS Organizations](https://aws.amazon.com/organizations/)를 사용하여 리소스를 공유하는 여러 AWS 계정 을 관리하는 경우 Amazon MWAA에서 고객 관리형 VPC 엔드포인트를 사용하여 조직의 다른 계정과 환경 리소스를 공유할 수 있습니다.

공유 VPC 액세스를 구성하면 기본 Amazon VPC를 소유한 계정(*소유자*)이 Amazon MWAA에 필요한 두 개의 Amazon MWAA에 필요한 두 개의 프라이빗 서브넷을 동일한 조직에 속한 다른 계정(*참가자*)과 공유합니다. 이러한 서브넷을 공유하는 참가자 계정은 공유 Amazon VPC에서 환경을 보고, 생성하고, 수정하고, 삭제할 수 있습니다.

조직의 `Root` 계정 역할을 하고 Amazon VPC 리소스를 소유하는 `Owner` 계정과 동일한 조직의 구성원인 참가자 계정 `Participant`가 있다고 가정해 보겠습니다. `Participant`가 `Owner`와 공유하는 Amazon VPC에서 새로운 Amazon MWAA를 생성하면 Amazon MWAA는 먼저 서비스 VPC 리소스를 생성한 다음, 최대 72시간 동안 [https://docs.aws.amazon.com/mwaa/latest/API/API_Environment.html#mwaa-Type-Environment-Status](https://docs.aws.amazon.com/mwaa/latest/API/API_Environment.html#mwaa-Type-Environment-Status) 상태로 전환합니다.

환경 상태가 `CREATING`에서 `PENDING`으로 변경되면 `Owner`를 대신하여 활동하는 위탁자가 필요한 엔드포인트를 생성합니다. 이를 위해 Amazon MWAA는 Amazon MWAA 콘솔에 데이터베이스 및 웹 서버 엔드포인트를 나열합니다. []() API 작업을 직접 호출하여 서비스 엔드포인트를 가져올 수도 있습니다.

**참고**  
리소스를 공유하는 데 사용하는 Amazon VPC가 프라이빗 Amazon VPC인 경우에도 [Amazon MWAA에서 서비스별 Amazon VPC 엔드포인트에 대한 액세스 관리](vpc-vpe-access.md)에 설명된 단계를 완료해야 합니다. 이 주제에서는 Amazon ECR, Amazon ECS 및 Amazon SQS와 같이와 AWS 통합되는 다른 AWS 서비스와 관련된 다른 Amazon VPC 엔드포인트 세트를 설정하는 방법을 다룹니다. 이러한 서비스는 클라우드에서 Apache Airflow 환경을 운영 및 관리하는 데 필수적입니다.

### 사전 조건
<a name="configure-shared-vpc-prerequisites"></a>

공유 VPC에서 Amazon MWAA 환경을 생성하기 전에 다음 리소스가 필요합니다.
+ Amazon VPC를 소유한 계정으로 AWS 계정`Owner` 사용할 입니다.
+ *루트*로 생성된 `MyOrganization`, [AWS Organizations](https://aws.amazon.com/organizations/) 조직 단위
+ 의 두 번째 AWS 계정, `Participant``MyOrganization`는 새 환경을 생성하는 참가자 계정을 제공합니다.

또한 Amazon VPC에서 리소스를 공유할 때 [소유자와 참가자의 책임과 권한](https://docs.aws.amazon.com/vpc/latest/userguide/vpc-sharing.html#vpc-share-limitations)을 숙지하는 것이 좋습니다.

### Amazon VPC 생성
<a name="configure-shared-vpc-create-vpc"></a>

먼저 소유자와 참가자 계정이 공유할 새로운 Amazon VPC를 생성합니다.

1. 를 사용하여 콘솔에 로그인한 `Owner`다음 CloudFormation 콘솔을 엽니다. 다음 템플릿을 사용하여 스택을 생성합니다. 이 스택은 Amazon VPC와 이 시나리오에서 두 계정이 공유할 서브넷을 비롯하여 여러 네트워킹 리소스를 프로비저닝합니다.

   ```
   AWSTemplateFormatVersion: "2010-09-09"                   
   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. 새 Amazon VPC 리소스가 프로비저닝된 후 AWS Resource Access Manager 콘솔로 이동한 다음 **리소스 공유 생성을** 선택합니다.

1. `Participant`와 공유할 수 있는 사용 가능한 서브넷 목록 중에서, 첫 번째 단계에서 생성한 서브넷을 선택합니다.

### 환경 생성
<a name="configure-shared-vpc-create-mwaa"></a>

다음 단계를 완료하여 고객 관리형 Amazon VPC 엔드포인트를 사용하여 Amazon MWAA 환경을 생성합니다.

1. `Participant`를 사용하여 로그인하고 Amazon MWAA 콘솔을 엽니다. **1단계: 세부 정보 지정**을 완료하여 Amazon S3 버킷, DAG 폴더 및 새로운 환경에 대한 종속성을 지정합니다. 자세한 내용은 [시작하기](create-environment.md#create-environment-start-details)를 참조하세요.

1. **고급 설정 구성** 페이지의 **네트워킹**에서 공유 Amazon VPC의 서브넷을 선택합니다.

1. **엔드포인트 관리**의 드롭다운 목록에서 **고객**을 선택합니다.

1. 페이지의 나머지 옵션에 대한 기본값을 유지한 다음, **검토 및 생성** 페이지에서 **환경 생성**을 선택합니다.

환경은 `CREATING` 상태에서 시작한 다음, `PENDING` 상태로 변경됩니다. 환경이 `PENDING` 상태이면 콘솔을 사용하여 **데이터베이스 엔드포인트 서비스 이름**과 **웹 서버 엔드포인트 서비스 이름**(프라이빗 웹 서버를 설정한 경우)을 기록합니다.

Amazon MWAA 콘솔을 사용하여 새로운 환경을 생성하는 경우 Amazon MWAA는 필수 인바운드 및 아웃바운드 규칙을 사용하여 새로운 보안 그룹을 생성합니다. 보안 그룹 ID를 기록합니다.

다음 섹션에서 `Owner`는 서비스 엔드포인트와 보안 그룹 ID를 사용하여 공유 Amazon VPC에서 새 Amazon VPC 엔드포인트를 생성합니다.

### Amazon VPC 엔드포인트 생성
<a name="configure-shared-vpc-create-endpoints"></a>

다음 단계를 완료하여 환경에 필요한 Amazon VPC 엔드포인트를 생성합니다.

1. 를 AWS Management Console 사용하여에 로그인`Owner`하고 [https://console.aws.amazon.com/vpc/](https://console.aws.amazon.com/vpc/) 엽니다.

1. 왼쪽 탐색 패널에서 **보안 그룹**을 선택한 후 다음 인바운드 및 아웃바운드 규칙을 사용하여 공유 Amazon VPC에서 새로운 보안 그룹을 생성합니다.    
[\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/ko_kr/mwaa/latest/userguide/vpc-endpoint-management.html)
**주의**  
`Owner` 계정은 새로운 환경에서 공유 Amazon VPC로의 트래픽을 허용하도록 `Owner` 계정에서 보안 그룹을 설정해야 합니다. `Owner`에서 새 보안 그룹을 생성하거나 기존 보안 그룹을 편집하여 이 작업을 수행할 수 있습니다.

1. **엔드포인트**를 선택한 다음, 이전 단계의 엔드포인트 서비스 이름을 사용하여 환경 데이터베이스 및 웹 서버(프라이빗 모드인 경우)에 대한 새 엔드포인트를 생성합니다. 공유 Amazon VPC, 환경에 사용한 서브넷 및 환경의 보안 그룹을 선택합니다.

성공하면 환경이 `PENDING` 상태에서 `CREATING` 상태로, 마지막으로 `AVAILABLE` 상태로 변경됩니다. `AVAILABLE` 상태인 경우 Apache Airflow 콘솔에 로그인할 수 있습니다.

### 공유 Amazon VPC 문제 해결
<a name="configure-shared-vpc-troubleshooting"></a>

다음 참조를 사용하여 공유 Amazon VPC에서 환경을 생성할 때 발생하는 문제를 해결하세요.

**`CREATE_FAILED` 상태 후 `PENDING`의 환경**  
+ [AWS Resource Access Manager](https://docs.aws.amazon.com/ram/latest/userguide/what-is.html)를 사용하여 `Owner`가 `Participant`와 서브넷을 공유하는지 확인합니다.
+ 데이터베이스 및 웹 서버의 Amazon VPC 엔드포인트가 환경과 연결된 동일한 서브넷에 생성되었는지 확인합니다.
+ 엔드포인트에 사용되는 보안 그룹이 환경에 사용되는 보안 그룹의 트래픽을 허용하는지 확인합니다. `Owner` 계정은 `Participant`의 보안 그룹을 `123456789012/security-group-id`로 참조하는 규칙을 생성합니다.    
[\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/ko_kr/mwaa/latest/userguide/vpc-endpoint-management.html)

  자세한 내용은 [소유자 및 참가자에 대한 책임 및 권한](https://docs.aws.amazon.com/vpc/latest/userguide/vpc-sharing.html#vpc-share-limitations)을 참조하세요.

**`PENDING` 상태에 정체된 환경**  
각 VPC 엔드포인트 상태를 확인하여 `Available`인지 확인합니다. 프라이빗 웹 서버로 환경을 구성하는 경우 웹 서버에 대한 엔드포인트도 생성해야 합니다. 환경이 `PENDING` 상태에 정착되어 있는 경우 프라이빗 웹 서버 엔드포인트가 누락된 것일 수 있습니다.

**`The Vpc Endpoint Service 'vpce-service-name' does not exist` 오류 수신**  
다음 오류가 표시되면 공유 VPC를 소유하는 `Owner` 계정에서 엔드포인트를 생성하는 계정인지 확인합니다.  

```
ClientError: An error occurred (InvalidServiceName) when calling the CreateVpcEndpoint operation: 
							
The Vpc Endpoint Service 'vpce-service-name' does not exist
```