AWS Snowball Edge设备的安全组管理
by Macey Neff 发表于2023年8月25日,来源于 Amazon EC2,AWS Snow Family,AWS Snowball,AWS Snowball Edge,最佳实践 ,客户解决方案 ,存储,永久链接
关键要点
AWS Snowball Edge 设备能够在大规模数据移动中,实现本地数据向AWS区域的迁移。安全组用于保护EC2实例,通过控制流入和流出流量来实现。每个实例只能使用一个安全组,可以有至多120条规则60条入站和60条出站。AWS Snowball Edge 支持最多50个安全组,所有规则仅支持允许网络流量的声明。本文由 Jared Novotny 和 Tareq Rajabi 编写,专注于混合边缘解决方案的架构师。
AWS Snow家族产品是专门设计的设备,支持在PB级别移动数据,从本地位置到AWS区域。Snow设备还使客户可以在边缘位置运行亚马逊弹性计算云 (Amazon EC2) 实例,以及使用 亚马逊弹性块存储 (Amazon EBS) 和 亚马逊简单存储服务 (Amazon S3) 。
安全组用于保护EC2实例,通过控制流入和流出流量。当创建安全组并与实例关联后,客户可以添加入站和出站规则来控制数据流。类似于区域内的默认VPC,Snow设备上也有默认安全组。当启动实例时,如果未指定其他安全组,将应用此默认安全组。区域内的默认安全组允许来自网络接口和被分配到同一安全组的实例的所有入站流量,并允许所有出站流量。而在Snowball Edge上,默认安全组允许所有入站和出站流量。
在本文中,我们将回顾在Snowball Edge设备上创建、管理和使用安全组所需的工具和命令。
前提条件和工具
客户必须从 AWS控制台 下单以获得Snowball Edge,才能运行以下AWS CLI命令并配置安全组来保护其EC2实例。
AWS Snowball Edge客户端 是一款独立的终端应用,客户可以在本地服务器和工作站上运行,以管理和操作其Snowball Edge设备。该客户端支持Windows、Mac和Linux系统。
AWS OpsHub 是一个图形用户界面,您可以用来管理AWS Snowball设备。更重要的是,这是解锁Snowball Edge设备的最简单工具。它还可以用来配置设备、启动实例、管理存储和提供监控。
客户可以从 AWS Snowball资源 下载并安装Snowball Edge客户端和AWS OpsHub。
开始使用
当Snow设备到达客户现场时,客户必须解锁设备并启动一个EC2实例。这可以通过 AWS OpsHub 或 AWS Snowball Edge客户 完成。AWS Snow家族设备支持虚拟网络接口(VNI) 和直接网络接口(DNI),客户应在选择最适合其用例的接口类型之前,查看 接口类型。请注意,安全组仅支持VNIs,因此本文中使用的是该接口类型。关于如何使用这些接口的 文章 应该在继续之前查看。
查看安全组信息
一旦AWS Snowball Edge被解锁、配置并运行EC2实例,我们可以深入探讨使用安全组作为虚拟防火墙来控制进出流量。
虽然AWS OpsHub工具提供了各种计算和存储操作的功能,但它只能用来查看与Snowball Edge设备上的实例关联的安全组名称:
与安全组的任何其他交互都必须通过AWS CLI进行。
以下命令显示如何轻松读取描述协议、源和目标的输出。该命令将显示有关默认安全组的信息,该安全组允许在Snowball Edge上运行的EC2实例上的所有入站和出站流量。
在以下部分中,我们将回顾最常用的命令,并提供示例和输出。
查看所有现有安全组:
bashaws ec2 describesecuritygroups endpoint Http//MySnowIPAddress8008 profile SnowballEdge
输出示例:
json{ SecurityGroups [ { Description default security group GroupName default IpPermissions [ { IpProtocol 1 IpRanges [ { CidrIp 0000/0 } ] } ] GroupId ssg8ec664a23666db719 IpPermissionsEgress [ { IpProtocol 1 IpRanges [ { CidrIp 0000/0 } ] } ] } ]}
创建新的安全组:
bashaws ec2 createsecuritygroup groupname allowssh description allow only ssh inbound endpoint Http//MySnowIPAddress8008 profile SnowballEdge
输出示例:
json{ GroupId ssg8f25ee27cee870b4a}
添加端口22的入站规则到安全组:
bashaws ec2 authorizesecuritygroupingress groupids sg8f25ee27cee870b4a protocol tcp port 22 cidr 10100100/24 endpoint Http//MySnowIPAddress8008 profile SnowballEdge
输出示例:
json{ Return true}
请注意,如果您使用的是默认安全组,则出站规则仍然是允许所有流量。
撤销安全组中的端口22入站规则
bashaws ec2 revokesecuritygroupingress groupids sg8f25ee27cee870b4a ippermissions IpProtocol=tcpFromPort=22ToPort=22IpRanges=[{CidrIp=10100100/24}] endpoint Http//MySnowIPAddress8008 profile SnowballEdge
输出示例:
json{ Return true}
奈云npv加速器官网撤销默认出站规则:
bashaws ec2 revokesecuritygroupegress groupids sg8f25ee27cee870b4a ippermissions IpProtocol=1IpRanges=[{CidrIp=0000/0}] endpoint Http//MySnowIPAddress8008 profile SnowballEdge
输出示例:
json{ Return true}
请注意,此规则将移除所有出站的短暂端口。
添加默认的出站规则被撤销的规则:
bashaws ec2 authorizesecuritygroupegress groupid ssg8f25ee27cee870b4a ippermissions IpProtocol=1 IpRanges=[{CidrIp=0000/0}] endpoint Http//MySnowIPAddress8008 profile SnowballEdge
输出示例:
json{ Return true}
更改实例的现有安全组:
bashaws ec2 modifyinstanceattribute instanceid si852971d05144e1d63 groups ssg8f25ee27cee870b4a endpoint Http//MySnowIPAddress8008 profile SnowballEdge
请注意,该命令不会产生输出。我们可以通过“aws ec2 describeinstances”命令进行验证。以下是示例命令输出简化:
bashaws ec2 describeinstances instanceid si852971d05144e1d63 endpoint Http//MySnowIPAddress8008 profile SnowballEdge
输出示例:
jsonReservations [{ Instances [{ InstanceId si852971d05144e1d63 InstanceType sbec2xlarge LaunchTime 20220627T1458301670000000 PrivateIpAddress 3422314193 PublicIpAddress 101001060 SecurityGroups [ { GroupName allowssh GroupId ssg8f25ee27cee870b4a } ] } ] }]
将实例的安全组更改回默认:
bashaws ec2 modifyinstanceattribute instanceids i852971d05144e1d63 groups ssg8ec664a23666db719 endpoint Http//MySnowIPAddress8008 profile SnowballEdge
请注意,该命令不会产生输出。您可以通过“aws ec2 describeinstances”命令进行验证。以下是示例:
bashaws ec2 describeinstances instanceids i852971d05144e1d63 endpoint Http//MySnowIPAddress8008 profile SnowballEdge
输出示例:
json{ Reservations [ { Instances [{ AmiLaunchIndex 0 ImageId sami8b0223704ca8f08b2 InstanceId si852971d05144e1d63 InstanceType sbec2xlarge LaunchTime 20220627T1458301670000000 PrivateIpAddress 3422314193 PublicIpAddress 101001060 SecurityGroups [ { GroupName default GroupId ssg8ec664a23666db719 } ] } ] } ]}
删除安全组:
bashaws ec2 deletesecuritygroup groupids sg8f25ee27cee870b4a endpoint Http//MySnowIPAddress8008 profile SnowballEdge
示例:添加SSH安全组
假设在Snowball Edge设备上运行的单个EC2实例“A”。默认情况下,所有流量都可以访问EC2实例“A”。根据以下图示,我们希望加强安全性,仅允许管理PC SSH访问该实例。
创建SSH安全组:bashaws ec2 createsecuritygroup groupname MySshGroup description ssh access endpoint Http//MySnowIPAddress8008 profile SnowballEdge
这将返回“GroupId”作为输出:json{ GroupId ssg8a420242d86dbbb89}
创建安全组后,我们必须允许管理PC的IP的端口22入站:bashaws ec2 authorizesecuritygroupingress groupname MySshGroup protocol tcp port 22 cidr 19216826193/32 endpoint Http//MySnowIPAddress8008 profile SnowballEdge
验证安全组是否已创建:bashaws ec2 describesecuritygroups groupname MySshGroup endpoint Http//MySnowIPAddress8008 profile SnowballEdge
输出示例:

json{ SecurityGroups [ { Description SG for web servers GroupName MySshGroup IpPermissions [ { FromPort 22 IpProtocol tcp IpRanges [ { CidrIp 19216826193/32 } ] ToPort 22 } ] } ]}
创建安全组后,我们必须将其与实例关联:bashaws ec2 modifyinstanceattribute instanceid si8f7ab16867ffe23d4 groups ssg8a420242d86dbbb89 endpoint Http//MySnowIPAddress8008 profile SnowballEdge
可选地,当不再需要时,可以删除安全组:bashaws ec2 deletesecuritygroup groupid ssg8a420242d86dbbb89 endpoint Http//MySnowIPAddress8008 profile SnowballEdge
请注意,对于上述关联,实例ID是“aws ec2 describeinstances”命令的输出,而安全组ID是“describesecuritygroups”命令的输出或第2步中控制台返回的“GroupId”。
结论
本文介绍了与AWS Snowball Edge设备相关的创建和管理安全组的最常用命令。我们探讨了查看、创建和修改安全组的先决条件、工具和命令,以确保在AWS Snowball Edge上部署的EC2实例仅限于授权用户访问。最后引导读者如何通过SSH从单个IP地址限制对EC2实例的访问。如果您想了解更多关于Snowball Edge产品的信息,可以访问 AWS Snow家族 网站上的各种 资源。