

本文属于机器翻译版本。若本译文内容与英语原文存在差异，则一律以英文原文为准。

# 设置和配置 Amazon VPC
<a name="dataflows.vpc-configuration"></a>

设置 VPC 的完整指南超出了本指南的范围。要深入了解，请参阅 [Amazon VPC 用户指南](https://docs.aws.amazon.com/vpc/latest/userguide/what-is-amazon-vpc.html)。

在本节中，将介绍您的 Amazon EC2 和 Dataflow 终端节点如何存在于 VPC 中。 AWS Ground Station 不支持给定数据流的多个传送点——预计每个数据流都会终止到一个接收器。 EC2 正如我们所期望的那样，只有一个 EC2 接收器，该配置不是多可用区冗余的。有关使用您的 VPC 的完整示例，请参阅[任务配置文件配置示例](examples.md)。

## 使用 AWS Ground Station 代理配置 VPC
<a name="dataflows.vpc-configuration.agent"></a>

 ![AWS Ground Station architecture with VPC, private and public subnets, and Amazon EC2 instance.](http://docs.aws.amazon.com/zh_cn/ground-station/latest/ug/images/dataflows.vpc-gs-agent.png) 

您的卫星数据将提供给靠近天线的 AWS Ground Station 代理实例。 AWS Ground Station 代理将对您的数据进行条带化处理，然后使用您提供的 AWS KMS 密钥对其进行加密。每个条带都通过 AWS 网络主干从源天线发送到您的[亚马逊 EC2 弹性 IP (EIP)](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/elastic-ip-addresses-eip.html)。数据通过附带的 [Amazon EC2 弹性网络接口 (ENI)](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-eni.html) 到达您的 EC2 实例。进入您的 EC2实例后，安装的 AWS Ground Station 代理将解密您的数据并执行正向错误校正 (FEC) 以恢复所有丢失的数据，然后将其转发到您在设置中指定的 IP 和端口。

下表列出了在设置 VPC 以进行 AWS Ground Station 代理交付时的独特设置注意事项。

 **安全组**-建议您设置一个仅用于 AWS Ground Station 流量的安全组。此安全组应允许在您的 Dataflow 端点组中指定的相同端口范围上的 UDP 入口流量。 AWS Ground Station 维护 AWS 管理的前缀列表，将您的权限仅限于 AWS Ground Station IP 地址。有关如何替换您的部署区域的详细信息，请参阅 [AWS 托管前缀列表](https://docs.aws.amazon.com/vpc/latest/userguide/working-with-aws-managed-prefix-lists.html)。*PrefixListId*

 **弹性网络接口 (ENI)**-您需要将上述安全组与此 ENI 关联并将其放置在您的公有子网中。

**注意**  
 每个 ENI 附加的安全组数量的默认配额为 5。这是一个可调整的限制，最多 16 个，请参阅 [Amazon VPC 配额](https://docs.aws.amazon.com/vpc/latest/userguide/amazon-vpc-limits.html#vpc-limits-security-groups)。

 以下 CloudFormation 模板演示如何创建本节中描述的基础架构。

```
{{ReceiveInstanceEIP}}:
  Type: AWS::EC2::EIP
  Properties:
    Domain: 'vpc'

{{InstanceSecurityGroup}}:
  Type: AWS::EC2::SecurityGroup
  Properties:
    GroupDescription: {{AWS Ground Station receiver instance security group.}}
    VpcId:{{YourVpcId}}
    SecurityGroupIngress:
      # Add additional items here.
      - IpProtocol: udp
        FromPort: {{your-port-start-range}}
        ToPort: {{your-port-end-range}}
        PrefixListIds:
          - PrefixListId: {{com.amazonaws.global.groundstation}}
        Description: {{"Allow AWS Ground Station Downlink ingress."}}

{{InstanceNetworkInterface}}:
  Type: AWS::EC2::NetworkInterface
  Properties:
    Description: {{ENI for AWS Ground Station to connect to.}}
    GroupSet:
      - !Ref {{InstanceSecurityGroup}}
    SubnetId: {{A Public Subnet}}

{{ReceiveInstanceEIPAllocation}}:
  Type: AWS::EC2::EIPAssociation
  Properties:
    AllocationId:
      Fn::GetAtt: [ {{ReceiveInstanceEIP}}, AllocationId ]
    NetworkInterfaceId:
      Ref: {{InstanceNetworkInterface}}
```

## 带有数据流终端节点的 VPC 配置
<a name="dataflows.vpc-configuration.dataflow-endpoint"></a>

 ![Diagram showing two VPCs with Amazon EC2 instances running endpoint applications.](http://docs.aws.amazon.com/zh_cn/ground-station/latest/ug/images/dataflows.vpc-dataflow-endpoint-application.png) 

您的卫星数据将提供给靠近天线的 Dataflow 端点应用程序实例。然后，数据将通过跨账户 [Amazon EC2 弹性网络接口 (ENI)](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-eni.html) 从其拥有的 AWS Ground Station VPC 发送。然后，数据通过附加到您的 Amazon EC2 EC2 实例的 ENI 到达您的实例。然后，安装的 dataflow 端点应用程序会将其转发到您在设置中指定的 IP 和端口。对于上行链路连接，则会出现相反的情况。

 下表列出了为数据流终端节点传输设置 VPC 时的独特设置注意事项。

**注意**  
 每个 ENI 附加的安全组数量的默认配额为 5。这是一个可调整的限制，最多 16 个，请参阅 [Amazon VPC 配额](https://docs.aws.amazon.com/vpc/latest/userguide/amazon-vpc-limits.html#vpc-limits-security-groups)。

 **IAM 角色**-IAM 角色是 Dataflow 终端节点的一部分，未显示在图表中。用于创建跨账户 ENI 并将其附加到 A AWS Ground Station mazon EC2 实例的 IAM 角色。

 **安全组 1**-此安全组附加到 ENI，该弹性网卡将与您账户中的 Amazon EC2 实例相关联。它需要允许来自安全组 2 的 UDP 流量通过您的*dataflow-endpoint-group*中指定的端口。

 **弹性网络接口 (ENI) 1**-您需要将安全组 1 与此 ENI 关联并将其放置在子网中。

 **子网**-您需要确保您的账户中每个数据流至少有一个可用的 IP 地址可用于 Amazon EC2 实例。有关子网大小的更多详细信息，请参阅 “[子网 CIDR 块](https://docs.aws.amazon.com/vpc/latest/userguide/subnet-sizing.html)” 

 **安全组 2**-在 Dataflow 端点中引用了此安全组。此安全组将附加到用于 AWS Ground Station 将数据存入您的账户的 ENI。

 **区域**-有关跨区域连接支持的区域的更多信息，请参阅[使用跨区域数据传输](dataflows.cross-region-data-delivery.md)。

 以下 CloudFormation 模板演示如何创建本节中描述的基础架构。

```
{{DataflowEndpointSecurityGroup}}:
  Type: AWS::EC2::SecurityGroup
  Properties:
    GroupDescription: Security Group for AWS Ground Station registration of Dataflow Endpoint Groups
    VpcId: {{YourVpcId}}
  
{{AWSGroundStationSecurityGroupEgress}}:
  Type: AWS::EC2::SecurityGroupEgress
  Properties:
    GroupId: !Ref: {{DataflowEndpointSecurityGroup}}
    IpProtocol: udp
    FromPort: {{55555}}
    ToPort: {{55555}}
    CidrIp: {{10.0.0.0/8}}
    Description: {{"Allow AWS Ground Station to send UDP traffic on port 55555 to the 10/8 range."}}

{{InstanceSecurityGroup}}:
  Type: AWS::EC2::SecurityGroup
  Properties:
    GroupDescription: {{AWS Ground Station receiver instance security group.}}
    VpcId: {{YourVpcId}}
    SecurityGroupIngress:
      - IpProtocol: udp
        FromPort: {{55555}}
        ToPort: {{55555}}
        SourceSecurityGroupId: {{!Ref DataflowEndpointSecurityGroup}}
        Description: {{"Allow AWS Ground Station Ingress from DataflowEndpointSecurityGroup"}}

{{ReceiverSubnet}}:
  Type: AWS::EC2::Subnet
  Properties:
    # Ensure your CidrBlock will always have at least one available IP address per dataflow endpoint.
    # See https://docs.aws.amazon.com/vpc/latest/userguide/subnet-sizing.html for subent sizing guidelines.
    CidrBlock: {{"10.0.0.0/24"}}
    Tags:
      - Key: "Name"
        Value: {{"AWS Ground Station - Dataflow endpoint Example Subnet"}}
      - Key: "Description"
        Value: {{"Subnet for EC2 instance receiving AWS Ground Station data"}}
    VpcId: !Ref ReceiverVPC
```