| :rotating_light: **ALERT**: We are retiring Amazon Sagemaker Edge on April 26th, 2024. Use this [step-by-step guide]( https://docs.aws.amazon.com/sagemaker/latest/dg/edge-eol.html) to learn about how to continue deploying your models to edge devices. :rotating_light:| | --- | | ⚠ **WARNING**: This tool is meant for development/testing use only. We don't recommend the use of this tool for production! ⚠ | | --- | # aws-sagemaker-egde-quick-device-setup This package provides a command line interface to easily onboard device with [SageMaker Edge](https://aws.amazon.com/sagemaker/edge/). Run the cli on the device you would like to provision as it will create all the necessary artifacts on the device. Jump to: - [Installation ](#installation) - [Configuration ](#configuration) - [Permissions ](#permissions) - [Basic Commands ](#basic-commands) - [Sample ](#sample) - [Getting Help](#getting-help) - [More Resources](#more-resource) This README is for aws-sagemaker-edge-quick-device-setup version 0.0.1 Installation ------------ `aws-sagemaker-edge-quick-device-setup` is written in golang. You can also generate the binary directly from the source using `go build` Optionally there is a build script to generate binaries and shasums for the relevant OS/architecture combination We support out of the the box distributions for known OS and architectures. Check out [Releases](https://github.com/aws/aws-sagemaker-edge-quick-device-setup/releases) for latest distributions. `bash ./build.sh {OS} {ARCH}` Configuration ------------- Before using the cli, you need to configure your AWS credentials. Go to https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-configure.html to learn about how to configure aws credentials. Since the required IAM policy is fairly permissive and the credentials are only neede during setup, we recommend to use [temporary credentials](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_use-resources.html). Permissions ----------- In order to invoke the CLI to create required resources in cloud the user/role must have required permission. You can create/attach a policy containing the following permissions. ``` { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "iam:GetRole", "iam:AttachRolePolicy", "iam:CreatePolicy", "iam:PassRole", "iam:GetPolicy", "iam:CreateRole", "iam:ListAttachedRolePolicies", "iot:GetPolicy", "iot:CreateThing", "iot:AttachPolicy", "iot:AttachThingPrincipal", "iot:DescribeThing", "iot:CreatePolicy", "iot:CreateThingType", "iot:CreateKeysAndCertificate", "iot:DescribeThingType", "iot:DescribeEndpoint", "s3:CreateBucket", "sagemaker:DescribeDeviceFleet", "sagemaker:RegisterDevices", "sagemaker:UpdateDevices", "sagemaker:CreateDeviceFleet", "sagemaker:DescribeDevice", "sagemaker:AddTags" ], "Resource": "*" }, { "Effect": "Allow", "Action": "s3:GetObject", "Resource": "arn:aws:s3:::sagemaker-edge-release-store-*/*" } ] } ``` Also attach ` SagemakerFullAccess` policy to the user/role. Basic Commands -------------- The CLI command has the following structure: (Replace OS , ARCH with os, architecture of choice) ``` # If built from source, change into bin directory of repo to access binary. $ cd bin/ $ aws-sagemaker-edge-quick-device-setup-{OS}-{ARCH} --[options] # Eg: for linux $ aws-sagemaker-edge-quick-device-setup-linux-amd64 --options ``` Following are all the arguments supported by the cli. The important ones ``` -accelerator string Name of accelerator (optional). -account string AWS AccountId (required). -agentDirectory string Local path to store agent (default "/home/ubuntu/aws-sagemaker-edge-quick-device-setup/aws-sagemaker-edge-quick-device-setup/demo-agent") -arch string Name of device architecture (optional with distribution binary). -deviceFleet string Name of the device fleet (required). -deviceFleetBucket string Bucket to store device related data (optional/autogenerated). -deviceFleetRole string Name of the role for the device fleet (optional/autogenerated). -deviceName string Name of the device (required). -dist Print distribution information. -enableDB Enable DB library for metrics backup and deployment with agent binary. -enableDeployment Enable deployment library with agent binary. -iotThingName string IOT thing name for the device (optional/autogenerated). -iotThingType string Iot thing type for the device (optional/autogenerated). -os string Name of operating system (optional with distribution binary). -region string AWS Region. (default "us-west-2") -s3FolderPrefix string S3 prefix to store captured data (optional/autogenerated). -version Print the version of aws-sagemaker-edge-quick-device-setup ``` To view help documentation, use one of the following: ``` $ aws-sagemaker-edge-quick-device-setup-{OS}-{ARCH} --help ``` To get the version of the cli: ``` $ aws-sagemaker-edge-quick-device-setup-{OS}-{ARCH} --version ``` Sample ------ If your device is linux amd64(x86_64). You could use one of the pre built distribution [aws-sagemaker-edge-quick-device-setup-linux-amd64](https://github.com/aws/aws-sagemaker-edge-quick-device-setup/releases/download/v0.0.1/aws-sagemaker-edge-quick-device-setup-linux-amd64) to setup the device. For distributions OS and architecture are hardcoded into the binaries. **NOTE**: `deviceName` and `deviceFleet` are expected to be lower case. If upper case names are given, the tool converts them to lower case equivalent. ``` $ aws-sagemaker-edge-quick-device-setup-{OS}-{ARCH} --deviceFleet test-fleet --deviceName test-device --account AWS_ACCOUNT_ID ``` Getting Help ------------ The best way to interact with our team is through GitHub. You can [open an issue](https://github.com/aws/aws-sagemaker-edge-quick-device-setup/issues/new/choose) and choose from one of our templates for guidance, bug reports, or feature requests. Please check for open similar [issues](https://github.com/aws/aws-sagemaker-edge-quick-device-setup/issues/) before opening another one. More Resources -------------- - [Changelog](https://github.com/aws/aws-cli/blob/develop/CHANGELOG.rst) [Reference](https://docs.aws.amazon.com/cli/latest/reference/) - [Amazon Web Services Discussion Forums](https://forums.aws.amazon.com/) - [AWS Support](https://console.aws.amazon.com/support/home#/) ## Security See [CONTRIBUTING](CONTRIBUTING.md#security-issue-notifications) for more information. ## License This project is licensed under the Apache-2.0 License.