Skip to content

aws/aws-sagemaker-edge-quick-device-setup

🚨 ALERT: We are retiring Amazon Sagemaker Edge on April 26th, 2024. Use this step-by-step guide to learn about how to continue deploying your models to edge devices. 🚨
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. Run the cli on the device you would like to provision as it will create all the necessary artifacts on the device.

Jump to:

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 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.

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 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 and choose from one of our templates for guidance, bug reports, or feature requests.

Please check for open similar issues before opening another one.

More Resources

Security

See CONTRIBUTING for more information.

License

This project is licensed under the Apache-2.0 License.