本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。
配置和使用 Snowball Edge 客户端
Snowball Edge Client 是一个命令行界面 (CLI) 工具 AWS ,你可以用它来处理 Snowball Edge 或 Snowball Edge 集群。您可以使用客户端解锁 Snowball Edge 或设备集群、设置 Snowball Edge、启动和停止设备上的服务,以及将数据传输到设备或从设备传输数据。Snowball Edge 客户端与在 Linux、macOS 和 Windows 操作系统上运行的计算机兼容。
主题
下载并安装 Snowball Edge 客户端
您可以从 AWS Snowball Edge 资源
按照以下说明安装和配置客户端。
为 Snowball Edge 客户端配置配置文件
每次你为 Snowball Edge 客户端运行命令时,都需要提供清单文件、解锁码和 Snowball Edge 的 IP 地址。您可以使用命令将清单文件路径、29 个字符的解锁码和端点(Snowball Edge 的 IP 地址)存储为配置文件,而不必在每次运行configure
命令时都提供这些信息。配置完成后,您可以使用 Snowball Edge 客户端命令,在命令中包括配置文件名称,而不必为每个命令手动输入这些值。在配置了 Snowball Edge 客户端之后,信息将以纯文本的 JSON 格式保存到
。确保您的环境已配置为允许创建此文件。home
directory
/.aws/snowball/config/snowball-edge.config
重要
可访问配置文件的任何人都可以访问 Snowball Edge 设备或集群上的数据。管理此文件的本地访问控制是您的管理责任之一。
您也可以 AWS OpsHub 使用创建个人资料。在中创建的配置文件可用 AWS OpsHub 于 Snowball Edge 客户端,在中 AWS OpsHub 创建的配置文件可用于 Snowball Edge 客户端。有关更多信息,请参阅管理配置文件。
创建配置文件
在操作系统的命令行界面中输入命令。
profile-name
参数的值是配置文件的名称。以后在运行 Snowball Edge 客户端命令时提供此参数。snowballEdge configure --profile
profile-name
Snowball Edge 客户端会提示您输入每个参数。出现提示时,输入您的环境和 Snowball Edge 的信息。
注意
endpoint
参数的值是 Snowball Edge 的 IP 地址,开头为。https://
您可以在设备前部的 LCD 屏幕上找到 Snowball Edge 设备的 IP 地址。例
configure
命令的输出Configuration will stored at home directory\.aws\snowball\config\snowball-edge.config Snowball Edge Manifest Path:
/Path/to/manifest/file
Unlock Code:29 character unlock code
Default Endpoint:https://192.0.2.0
Snowball Edge 客户端会检查清单文件的解锁码是否正确。如果不匹配,则命令会停止且不会创建配置文件。检查解锁码和清单文件,然后再次运行此命令。
要使用配置文件,请在命令语法前包括 --profile profile-name
。
如果您使用的是多个独立的 Snowball Edge,则可以为每个 Snowball Edge 创建一个配置文件。要创建另一个配置文件,请再次运行 configure
命令,为 --profile
参数提供不同的值,然后提供另一台设备的信息。
例 示例 snowball-edge.config
文件
此示例显示一个包含三个配置文件的配置文件:SnowDevice1profile
、SnowDevice2profile
和 SnowDevice3profile
。
{"version":1,"profiles": { "SnowDevice1profile": { "name":"SnowDevice1profile", "jobId":"JID12345678-136f-45b4-b5c2-847db8adc749", "unlockCode":"db223-12345-dbe46-44557-c7cc2", "manifestPath":"C:\\Users\\Administrator\\.aws\\ops-hub\\manifest\\JID12345678-136f-45b4-b5c2-847db8adc749_manifest-1670622989203.bin", "defaultEndpoint":"https://10.16.0.1", "isCluster":false, "deviceIps":[] }, }, "SnowDevice2profile": { "name":"SnowDevice2profile", "jobId":"JID12345678-fdb2-436a-a4ff-7c510dec1bae", "unlockCode":"b893b-54321-0f65c-6c5e1-7f748", "manifestPath":"C:\\Users\\Administrator\\.aws\\ops-hub\\manifest\\JID12345678-fdb2-436a-a4ff-7c510dec1bae_manifest-1670623746908.bin", "defaultEndpoint":"https://10.16.0.2", "isCluster":false, "deviceIps":[] }, "SnowDevice3profile": { "name":"SnowDevice3profile", "jobId":"JID12345678-c384-4a5e-becd-ab5f38888463", "unlockCode":"64c89-13524-4d054-13d93-c1b80", "manifestPath":"C:\\Users\\Administrator\\.aws\\ops-hub\\manifest\\JID12345678-c384-4a5e-becd-ab5f38888463_manifest-1670623999136.bin", "defaultEndpoint":"https://10.16.0.3", "isCluster":false, "deviceIps":[] } }
要编辑或删除配置文件,请在文本编辑器中编辑配置文件。
要编辑配置文件,请执行以下操作
-
在文本编辑器中,从
打开home directory
\.aws\snowball\configsnowball-edge.config
。注意
确保您的环境已配置为允许读取和写入此文件。
-
根据需要编辑文件。例如,要更改与配置文件关联的 Snowball Edge 的 IP 地址,请更改该
defaultEndpoint
条目。 -
保存并关闭文件。
要删除配置文件,请执行以下操作
-
使用文本编辑器,从
打开home directory
\.aws\snowball\configsnowball-edge.config
。注意
确保您的环境已配置为允许读取和写入此文件。
-
删除包含配置文件名称的行、配置文件名称后的大括号
{
}
以及括号内的内容。 -
保存并关闭文件。
查找 Snowball Edge 客户端版本
使用 version
命令查看 Snowball Edge 命令行界面(CLI)客户端的版本。
用法
snowballEdge version
示例输出
Snowball Edge client version: 1.2.0 Build 661
获取 Snowball Edge 的凭证
使用snowballEdge list-access-keys
和snowballEdge
get-secret-access-key
命令,您可以在 Snowball Edge AWS 账户 上获取您的管理员用户的凭据。您可以使用这些证书创建 AWS Identity and Access Management (IAM 用户)和角色,并在使用 AWS CLI 或与 AWS SDK 配合使用时对您的请求进行身份验证。这些凭证仅与 Snowball Edge 的单个作业相关联,且仅可用于设备或设备集群。设备或设备集群在 AWS Cloud中并不具有任何 IAM 权限。
注意
如果你在 Snowball Edge 上使用,则在配置 CLI 时必须使用这些证书。 AWS CLI 有关为配置凭据的信息 AWS CLI,请参阅《AWS Command Line Interface 用户指南》 AWS CLI中的配置。
用法(已配置 Snowball Edge 客户端)
snowballEdge list-access-keys
例 输出
{ "AccessKeyIds" : [ "AKIAIOSFODNN7EXAMPLE" ] }
用法(已配置 Snowball Edge 客户端)
snowballEdge get-secret-access-key --access-key-id
Access Key
例 输出
[snowballEdge] aws_access_key_id = AKIAIOSFODNN7EXAMPLE aws_secret_access_key = wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
在 Snowball Edge 上启动服务
Snowball Edge 设备支持多个服务。其中包括计算实例、网络文件系统 (NFS) 接口、Snow 设备管理和 AWS IoT Greengrass。Amazon S3 适配器服务 EC2 AWS STS、Amazon 和 IAM 是默认启动的,无法停止或重新启动。但是,NFS 接口 Snow Device Management 和, AWS IoT Greengrass 可以通过在start-service
命令中使用其服务 ID 来启动。要获取每个服务的服务 ID,您可以使用 list-services
命令。
运行此命令之前,请创建一个虚拟网络接口以绑定到您要启动的服务。有关更多信息,请参阅 在 Snowball Edge 上创建虚拟网络接口。
snowballEdge start-service --profile
profile-name
--service-idservice_id
--virtual-network-interface-arnsvirtual-network-interface-arn
例 start-service
命令的输出
Starting the AWS service on your Snowball Edge. You can determine the status of the AWS service using the describe-service command.
在 Snowball Edge 上停止服务
要停止在 Snowball Edge 上运行的服务,你可以使用命令。stop-service
Amazon S3 适配器 EC2 AWS STS、亚马逊和 IAM 服务无法停止。
警告
如果在将剩余的缓冲数据写入设备之前停止网络文件系统(NFS)服务,则会丢失数据。有关使用 NFS 服务的更多信息,请参阅 管理 Snowball Edge 上的 NFS 接口。
注意
在 Snowball Edge 服务上停止 Amazon S3 兼容存储将禁止访问设备或集群上存储在 S3 存储桶中的数据。当 Snowball Edge 上与 Amazon S3 兼容的存储再次启动时,访问权限就会恢复。对于在 Snowball Edge 上启用了与 Amazon S3 兼容存储的设备,建议在 Snowball Edge 设备开机后启动该服务。请参阅本指南中的设置 Snowball Edge。
snowballEdge stop-service --profile
profile-name
--service-idservice_id
例 stop-service
命令的输出
Stopping the AWS service on your Snowball Edge. You can determine the status of the AWS service using the describe-service command.
从 Snowball Edge 查看和下载日志
当您在本地数据中心和 Snowball Edge 之间传输数据时,系统将会自动生成日志。如果您在将数据传输到设备的过程中遇到意外错误,则可以使用以下命令将日志副本保存到本地服务器。
有三个与日志相关的命令:
-
list-logs
:返回 JSON 格式的日志列表。此列表报告日志的大小(以字节为单位)、日志的 ARN、日志的服务 ID 和日志的类型。用法
snowballEdge list-logs --profile
profile-name
例
list-logs
命令的输出{ "Logs" : [ { "LogArn" : "arn:aws:snowball-device:::log/s3-storage-JIEXAMPLE2f-1234-4953-a7c4-dfEXAMPLE709", "LogType" : "SUPPORT", "ServiceId" : "s3", "EstimatedSizeBytes" : 53132614 }, { "LogArn" : "arn:aws:snowball-device:::log/fileinterface-JIDEXAMPLEf-1234-4953-a7c4-dfEXAMPLE709", "LogType" : "CUSTOMER", "ServiceId" : "fileinterface", "EstimatedSizeBytes" : 4446 }] }
-
get-log
:从 Snowball Edge 将特定日志副本下载到指定路径的设备上。CUSTOMER
日志保存为.zip
格式,并且可解压缩此类型的日志以查看其内容。SUPPORT
日志已加密,只能由 AWS 支持工程师读取。您可以选择为日志指定名称和路径。用法
snowballEdge get-log --profile
profile-name
--log-arn arn:aws:snowball-device:::log/fileinterface-JIDEXAMPLEf-1234-4953-a7c4-dfEXAMPLE709例
get-log
命令的输出Logs are being saved to download/path/snowball-edge-logs-1515EXAMPLE88.bin
-
get-support-logs
:从 Snowball Edge 将所有SUPPORT
类型的日志副本下载到指定路径的服务器上。用法
snowballEdge get-support-logs --profile
profile-name
例
get-support-logs
命令的输出Logs are being saved to download/path/snowball-edge-logs-1515716135711.bin
重要
CUSTOMER
类型可能包含有关您自己的数据的敏感信息。为了保护此潜在敏感信息,我们强烈建议您在用完这些日志之后将其删除。
查看 Snowball Edge 的状态
你可以使用命令确定 Snowball Edge 的状态和总体生命值。describe-device
snowballEdge describe-device --profile
profile-name
例 describe-device
命令的输出
{ "DeviceId": "JID-EXAMPLE12345-123-456-7-890", "UnlockStatus": { "State": "UNLOCKED" }, "ActiveNetworkInterface": { "IpAddress": "192.0.2.0" }, "PhysicalNetworkInterfaces": [ { "PhysicalNetworkInterfaceId": "s.ni-EXAMPLEd9ecbf03e3", "PhysicalConnectorType": "RJ45", "IpAddressAssignment": "STATIC", "IpAddress": "0.0.0.0", "Netmask": "0.0.0.0", "DefaultGateway": "192.0.2.1", "MacAddress": "EX:AM:PL:E0:12:34" }, { "PhysicalNetworkInterfaceId": "s.ni-EXAMPLE4c3840068f", "PhysicalConnectorType": "QSFP", "IpAddressAssignment": "STATIC", "IpAddress": "0.0.0.0", "Netmask": "0.0.0.0", "DefaultGateway": "192.0.2.2", "MacAddress": "EX:AM:PL:E0:56:78" }, { "PhysicalNetworkInterfaceId": "s.ni-EXAMPLE0a3a6499fd", "PhysicalConnectorType": "SFP_PLUS", "IpAddressAssignment": "DHCP", "IpAddress": "192.168.1.231", "Netmask": "255.255.255.0", "DefaultGateway": "192.0.2.3", "MacAddress": "EX:AM:PL:E0:90:12" } ] }
查看 Snowball Edge 上运行的服务的状态
可以使用 describe-service
命令确定 Snowball Edge 设备上运行的服务的状态和整体运行状况。可以首先运行 list-services
命令来查看哪些服务正在运行。
-
list-services
用法
snowballEdge list-services --profile
profile-name
例
list-services
命令的输出{ "ServiceIds" : [ "greengrass", "fileinterface", "s3", "ec2", "s3-snow" ] }
-
describe-service
此命令返回服务的状态值。它还包括状态信息,这些信息有助于解决您使用服务时可能遇到的问题。这些状态如下所示。
-
ACTIVE
:服务正在运行且可供使用。 -
ACTIVATING
:服务正在启动,但是还不能使用。 -
DEACTIVATING
:服务正处于关闭过程中。 -
DEGRADED
— 对于 Snowball Edge 上与 Amazon S3 兼容的存储,此状态表示集群中的一个或多个磁盘或设备已关闭。Snowball Edge 服务上与 Amazon S3 兼容的存储不间断运行,但您应该在集群法定人数丢失之前恢复或更换受影响的设备,以最大限度地降低数据丢失的风险。请参阅本指南中的集群概述。 -
INACTIVE
:服务未运行,无法使用。
用法
snowballEdge describe-service --profile
profile-name
--service-idservice-id
例
describe-service
命令的输出{ "ServiceId": "s3", "Status": { "State": "ACTIVE" }, "Storage": { "TotalSpaceBytes": 99608745492480, "FreeSpaceBytes": 99608744468480 }, "Endpoints": [ { "Protocol": "http", "Port": 8080, "Host": "192.0.2.0" }, { "Protocol": "https", "Port": 8443, "Host": "192.0.2.0", "CertificateAssociation": { "CertificateArn": "arn:aws:snowball-device:::certificate/6d955EXAMPLEdb71798146EXAMPLE3f0" } } ] }
例 Snowball Edge 服务输出上兼容亚马逊 S3 的存储
describe-service
命令为service-id
参数的s3-snow
值提供以下输出。{ "ServiceId" : "s3-snow", "Autostart" : false, "Status" : { "State" : "ACTIVE" }, "ServiceCapacities" : [ { "Name" : "S3 Storage", "Unit" : "Byte", "Used" : 640303104, "Available" : 219571981512 } ], "Endpoints" : [ { "Protocol" : "https", "Port" : 443, "Host" : "10.0.2.123", "CertificateAssociation" : { "CertificateArn" : "arn:aws:snowball-device:::certificate/a65ba817f2c5ac9683fc3bc1ae123456" }, "Description" : "s3-snow bucket API endpoint", "DeviceId" : "JID6ebd4c50-c3a1-4b16-b32c-b254f9b7f2dc", "Status" : { "State" : "ACTIVE" } }, { "Protocol" : "https", "Port" : 443, "Host" : "10.0.3.202", "CertificateAssociation" : { "CertificateArn" : "arn:aws:snowball-device:::certificate/a65ba817f2c5ac9683fc3bc1ae123456" }, "Description" : "s3-snow object API endpoint", "DeviceId" : "JID6ebd4c50-c3a1-4b16-b32c-b254f9b7f2dc", "Status" : { "State" : "ACTIVE" } }, { "Protocol" : "https", "Port" : 443, "Host" : "10.0.3.63", "CertificateAssociation" : { "CertificateArn" : "arn:aws:snowball-device:::certificate/a65ba817f2c5ac9683fc3bc1ae123456" }, "Description" : "s3-snow bucket API endpoint", "DeviceId" : "JID2a1e0deb-38b1-41f8-b904-a396c62da70d", "Status" : { "State" : "ACTIVE" } }, { "Protocol" : "https", "Port" : 443, "Host" : "10.0.2.243", "CertificateAssociation" : { "CertificateArn" : "arn:aws:snowball-device:::certificate/a65ba817f2c5ac9683fc3bc1ae123456" }, "Description" : "s3-snow object API endpoint", "DeviceId" : "JID2a1e0deb-38b1-41f8-b904-a396c62da70d", "Status" : { "State" : "ACTIVE" } }, { "Protocol" : "https", "Port" : 443, "Host" : "10.0.2.220", "CertificateAssociation" : { "CertificateArn" : "arn:aws:snowball-device:::certificate/a65ba817f2c5ac9683fc3bc1ae123456" }, "Description" : "s3-snow bucket API endpoint", "DeviceId" : "JIDcc45fa8f-b994-4ada-a821-581bc35d8645", "Status" : { "State" : "ACTIVE" } }, { "Protocol" : "https", "Port" : 443, "Host" : "10.0.2.55", "CertificateAssociation" : { "CertificateArn" : "arn:aws:snowball-device:::certificate/a65ba817f2c5ac9683fc3bc1ae123456" }, "Description" : "s3-snow object API endpoint", "DeviceId" : "JIDcc45fa8f-b994-4ada-a821-581bc35d8645", "Status" : { "State" : "ACTIVE" } }, { "Protocol" : "https", "Port" : 443, "Host" : "10.0.3.213", "CertificateAssociation" : { "CertificateArn" : "arn:aws:snowball-device:::certificate/a65ba817f2c5ac9683fc3bc1ae123456" }, "Description" : "s3-snow bucket API endpoint", "DeviceId" : "JID4ec68543-d974-465f-b81d-89832dd502db", "Status" : { "State" : "ACTIVE" } }, { "Protocol" : "https", "Port" : 443, "Host" : "10.0.3.144", "CertificateAssociation" : { "CertificateArn" : "arn:aws:snowball-device:::certificate/a65ba817f2c5ac9683fc3bc1ae123456" }, "Description" : "s3-snow object API endpoint", "DeviceId" : "JID4ec68543-d974-465f-b81d-89832dd502db", "Status" : { "State" : "ACTIVE" } }, { "Protocol" : "https", "Port" : 443, "Host" : "10.0.2.143", "CertificateAssociation" : { "CertificateArn" : "arn:aws:snowball-device:::certificate/a65ba817f2c5ac9683fc3bc1ae123456" }, "Description" : "s3-snow bucket API endpoint", "DeviceId" : "JID6331b8b5-6c63-4e01-b3ca-eab48b5628d2", "Status" : { "State" : "ACTIVE" } }, { "Protocol" : "https", "Port" : 443, "Host" : "10.0.3.224", "CertificateAssociation" : { "CertificateArn" : "arn:aws:snowball-device:::certificate/a65ba817f2c5ac9683fc3bc1ae123456" }, "Description" : "s3-snow object API endpoint", "DeviceId" : "JID6331b8b5-6c63-4e01-b3ca-eab48b5628d2", "Status" : { "State" : "ACTIVE" } } ] }
-
查看 Snowball Edge 功能的状态
要列出 Snowball Edge 上可用功能的状态,请使用命令。describe-features
RemoteManagementState
会指示 Snow 设备管理的状态并返回以下状态之一:
INSTALLED_ONLY
:该特征已安装但未启用。INSTALLED_AUTOSTART
— 该功能已启用,设备在开机 AWS 区域 时将尝试连接到该功能。NOT_INSTALLED
:该设备不支持该特征,或者设备在该特征发布之前已投入使用。
用法
snowballEdge describe-features --profile
profile-name
例 describe-features
命令的输出
{ "RemoteManagementState" : String }
为 Snowball Edge 设置时间服务器
您可以使用 Snowball Edge 客户端命令查看当前的网络时间协议(NTP)配置,并选择服务器或对等节点来提供时间。在设备处于锁定和解锁状态时,您均可使用 Snowball Edge 客户端命令。
您有责任提供安全的 NTP 时间服务器。要设置设备连接到哪些 NTP 时间服务器,请使用 update-time-servers
命令。
检查 Snowball Edge 的时间来源
要查看设备当前连接到哪些 NTP 时间源,请使用 describe-time-sources
命令。
snowballEdge describe-time-sources --profile
profile-name
例 describe-time-sources
命令的输出
{ "Sources" : [ { "Address" : "172.31.2.71", "State" : "LOST", "Type" : "PEER", "Stratum" : 10 }, { "Address" : "172.31.3.203", "State" : "LOST", "Type" : "PEER", "Stratum" : 10 }, { "Address" : "172.31.0.178", "State" : "LOST", "Type" : "PEER", "Stratum" : 10 }, { "Address" : "172.31.3.178", "State" : "LOST", "Type" : "PEER", "Stratum" : 10 }, { "Address" : "216.239.35.12", "State" : "CURRENT", "Type" : "SERVER", "Stratum" : 1 } ] }
describe-time-sources
命令将返回时间源状态的列表。每个时间源状态都包含 Address
、State
、Type
和 Stratum
字段。以下是这些字段的含义。
-
Address
:时间源的 DNS 名称/IP 地址 -
State
:设备与该时间源之间的当前连接状态。有五种可能的状态:-
CURRENT
:当前正在使用时间源来同步时间。 -
COMBINED
:时间源与当前源合并。 -
EXCLUDED
:合并算法排除了时间源。 -
LOST
:与时间源的连接已断开。 -
UNACCEPTABLE
:无效的时间源,其中组合算法被视为虚假或变化过大
-
-
Type
:NTP 时间源可以是服务器或对等设备。可以通过update-time-servers
命令设置服务器。对等设备只能是集群中的其他 Snowball Edge 设备,并在集群关联时自动设置。 -
Stratum
:此字段显示源的阶层。阶层 1 表示具有本地连接的参考时钟的源。与阶层 1 源同步的源位于阶层 2。与阶层 2 源同步的源位于阶层 3,依此类推。
NTP 时间源可以是服务器或对等设备。服务器可以由用户使用 update-time-servers
命令进行设置,而对等设备只能是集群中的其他 Snowball Edge 设备。示例输出在 5 个设备组成的集群中的 Snowball Edge 上调用了 describe-time-sources
。输出包含 4 个对等设备和 1 个服务器。对等设备的阶层为 10,而服务器的阶层为 1。因此,服务器被选为当前时间源。
更新时间服务器
使用update-time-servers
命令和时间服务器地址将 Snowball Edge 配置为使用 NTP 服务器或对等体进行 NTP。
snowballEdge update-time-servers --profile
profile-name
time-server-address
注意
update-time-servers
命令将覆盖以前的 NTP 时间服务器设置。
例 update-time-servers
命令的输出
Updating time servers now.
获取用于验证 Snowball Edge NFC 标签的二维码
您可以使用此命令生成特定于设备的 QR 代码,以便与 AWS Snowball Edge Verification App 一起使用。有关 NFC 验证的更多信息,请参阅验证 NFC 标签。
用法
snowballEdge get-app-qr-code --output-file
~/downloads/snowball-qr-code.png
例 输出
QR code is saved to
~/downloads/snowball-qr-code.png
更新 MTU 大小
使用update-mtu-size
命令修改 Snowball Edge 设备物理接口的最大传输单位 (MTU) 的大小(以字节为单位)。所有与此物理网络接口关联的虚拟网络接口和直接网络接口都将配置为具有相同的 MTU 大小。
注意
最小 MTU 大小为 1500 字节,最大大小为 9216 字节。
您可以使用describe-device
命令检索这些接口的物理网络接口 IDs 和当前 MTU 大小。有关更多信息,请参阅 查看 Snowball Edge 的状态。
可以使用 descibe-direct-network-interface
和 describe-virtual-network-interface
命令检索这些接口的当前 MTU 大小。
用法
snowballEdge update-mtu-size --physical-network-interface-id
physical-network-interface-id
--mtu-sizesize-in-bytes
例 update-mtu-size
输出
{ "PhysicalNetworkInterface": { "PhysicalNetworkInterfaceId": "s.ni-8c1f891d7f5b87cfe", "PhysicalConnectorType": "SFP_PLUS", "IpAddressAssignment": "DHCP", "IpAddress": "192.0.2.0", "Netmask": "255.255.255.0", "DefaultGateway": "192.0.2.255", "MacAddress": "8A:2r:5G:9p:6Q:4s", "MtuSize": "5743" } }