VPC네트워크 생성 - Amazon Managed Workflows for Apache Airflow

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

VPC네트워크 생성

Apache Airflow용 Amazon 관리형 워크플로를 사용하려면 환경을 지원하는 Amazon VPC 및 특정 네트워킹 구성 요소가 필요합니다. 이 가이드에서는 Apache Airflow용 Amazon 관리형 워크플로 환경을 위한 Amazon VPC 네트워크를 생성하는 다양한 옵션에 대해 설명합니다.

참고

Apache Airflow는 지연 시간이 짧은 네트워크 환경에서 가장 잘 작동합니다. 트래픽을 다른 지역이나 온 프레미스 환경으로 VPC 라우팅하는 기존 Amazon을 사용하는 경우 AmazonSQS, CloudWatch Amazon S3 AWS PrivateLink 및 에 대한 엔드포인트를 추가하는 것이 좋습니다. AWS KMS MWAAAmazon을 구성하는 방법에 AWS PrivateLink 대한 자세한 내용은 인터넷 액세스 없이 Amazon VPC 네트워크 만들기를 참조하십시오.

사전 조건

AWS Command Line Interface (AWS CLI) 는 명령줄 셸의 명령을 사용하여 AWS 서비스와 상호 작용할 수 있는 오픈 소스 도구입니다. 이 페이지에서 단계를 완료하려면 다음이 필요합니다.

시작하기 전 준비 사항

Amazon VPC 네트워크 생성 옵션

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

참고

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

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

옵션 1: Amazon MWAA 콘솔에서 VPC 네트워크 생성

다음 섹션에서는 Amazon MWAA 콘솔에서 Amazon VPC 네트워크를 생성하는 방법을 보여줍니다. 이 옵션은 인터넷을 통한 퍼블릭 라우팅를 사용합니다. 프라이빗 네트워크 또는 퍼블릭 네트워크 액세스 모드의 Apache Airflow 웹 서버에 사용할 수 있습니다.

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

이 이미지는 Amazon MWAA VPC MWAA 콘솔에서 Create를 찾을 수 있는 위치를 보여줍니다.

옵션 2: 인터넷에 액세스할 수 있는 Amazon VPC 네트워크 생성

다음 AWS CloudFormation 템플릿은 기본 AWS 지역에서 인터넷에 액세스할 수 있는 Amazon VPC 네트워크를 생성합니다. 이 옵션은 인터넷을 통한 퍼블릭 라우팅를 사용합니다. 이 템플릿은 프라이빗 네트워크 또는 퍼블릭 네트워크 액세스 모드의 Apache Airflow 웹 서버에 사용할 수 있습니다.

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

    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
  2. 명령 프롬프트에서 cfn-vpc-public-private.yaml이 저장된 디렉터리로 이동합니다. 예:

    cd mwaaproject
  3. AWS CLI를 사용하여 스택을 생성하려면 aws cloudformation create-stack 명령을 사용합니다.

    aws cloudformation create-stack --stack-name mwaa-environment --template-body file://cfn-vpc-public-private.yaml
    참고

    Amazon VPC 인프라를 생성하는 데 약 30분이 소요됩니다.

옵션 3: 인터넷에 접속하지 않고 Amazon VPC 네트워크 만들기

다음 AWS CloudFormation 템플릿은 기본 AWS 지역에서 인터넷에 액세스할 수 없는 Amazon VPC 네트워크를 생성합니다.

이 옵션은 인터넷 접속이 필요 없는 프라이빗 라우팅를 사용합니다. 이 템플릿은 프라이빗 네트워크 액세스 모드가 있는 Apache Airflow 웹 서버에만 사용할 수 있습니다. 환경에서 사용하는 AWS 서비스에 필요한 VPC 엔드포인트를 생성합니다.

  1. 다음 템플릿의 내용을 복사하고 로컬에 cfn-vpc-private.yaml로 저장합니다. 템플릿을 다운로드할 수도 있습니다.

    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
  2. 명령 프롬프트에서 cfn-vpc-private.yml이 저장된 디렉터리로 이동합니다. 예:

    cd mwaaproject
  3. AWS CLI를 사용하여 스택을 생성하려면 aws cloudformation create-stack 명령을 사용합니다.

    aws cloudformation create-stack --stack-name mwaa-private-environment --template-body file://cfn-vpc-private.yml
    참고

    Amazon VPC 인프라를 생성하는 데 약 30분이 소요됩니다.

  4. 컴퓨터에서 이러한 VPC 엔드포인트에 액세스할 수 있는 메커니즘을 만들어야 합니다. 자세한 내용은 아마존 MWAA의 서비스별 아마존 VPC 엔드포인트에 대한 액세스 관리을 참조하십시오.

참고

Amazon MWAA 보안 그룹의 아웃바운드 액세스를 추가로 제한할 수 있습니다. CIDR 예를 들어 자체 참조 아웃바운드 규칙, Amazon S3의 접두사 목록 및 Amazon의 CIDR 접두사 목록을 추가하여 자체적으로 제한할 수 있습니다. VPC

다음 단계