Manage Raspberry Pi devices using AWS Systems Manager
What is AWS Systems Manager?
AWS Systems Manager gives you visibility and control of your infrastructure on AWS. Systems Manager provides a unified user interface so you can view operational data from multiple AWS services, and then automate operational tasks across your AWS resources.
What is Raspberry Pi?
Raspberry Pi is a small and affordable computer that you can use to learn programming.
AWS Systems Manager supports the Raspbian operating system. Customers can manage Raspberry Pi devices just like any other Linux server.
When you have an environment that consists of servers running on AWS, on-premises hardware and devices such as Raspberry Pi it can be challenging to manage them on different interfaces. It would be better to have a single interface through which you can gain operational insights, manage, and carry out administrative tasks.
With AWS Systems Manager, you can manage servers running on AWS, in your on-premises data center, and devices such as Raspberry Pi through a single interface. Systems Manager securely communicates with a lightweight agent installed on your servers and devices to execute management tasks. This helps you manage resources for Windows, Linux, and Raspbian operating systems.
Setting up a Raspberry Pi device
To manage a Raspberry Pi device using AWS Systems Manager, the device should be running on Raspbian or one of the operating systems supported by AWS Systems Manager, and it should be connected to the internet.
- Follow these instructions for your initial setup:
- Installing the operating system (OS):
- Raspbian is the recommended OS for normal use on a Raspberry Pi. You can download and install the Raspbian OS on the SD card using a Mac or desktop. Here are the steps for Installing Raspbian.
- Internet connection:
- After the OS is installed on the SD card, you have to enable internet connectivity on the Raspberry Pi device. Open the raspi-config tool and choose Network Options.
Connecting Raspberry Pi device to AWS Systems Manager
AWS Systems Manager lets you remotely and securely manage your raspberry pi devices. To connect your Raspberry Pi device to AWS Systems Manager, you should first Create an IAM Service Role for a Hybrid Environment.
Once the IAM Service role is created you will Create a Managed-Instance Activation for a Hybrid Environment. In this process you will select the IAM Service Role that you created in step 1
After you click on create activation, you will be presented with the following message on successful creation of new activation.
Make note of the activation code and activation ID. You will need it in step 3.
Log in to your Raspberry Pi device and perform the steps listed under “On Raspbian” at Install SSM Agent on Servers and VMs in a Linux Hybrid Environment. Following these steps will download the SSM Agent to the device and register the device using the activation code and ID generated in Step 2.
sudo curl https://s3.amazonaws.com/ec2-downloads-windows/SSMAgent/latest/debian_arm/amazon-ssm-agent.deb -o /tmp/ssm/amazon-ssm-agent.deb
sudo dpkg -i /tmp/ssm/amazon-ssm-agent.deb
sudo service amazon-ssm-agent stop
sudo amazon-ssm-agent -register -code “activation-code” -id “activation-id” -region “region”
sudo service amazon-ssm-agent start
You will see the following message upon successful registration of the instance.
After you have registered your Raspberry Pi device with AWS System Manager, you have visibility and control of the device from Systems Manager. Under Managed instances you will see Raspberry Pi listed as an instance. Choose the instance to get more details. Within the instance under the Inventory tab you will see all the applications installed on the instance.
AWS Systems Manager provides you safe, secure remote management of your instances at scale without logging into your servers, replacing the need for bastion hosts, SSH, or remote PowerShell. After you have Raspberry Pi listed in managed instances you can execute commands remotely using Run Command within AWS Systems Manager.
You can find more details on sending a command using Run Command from the AWS Management Console, in the documentation.
All actions taken with Systems Manager are recorded by AWS CloudTrail, which allows you to audit changes throughout your environment.
About the author
Rajakumar Sampathkumar is a Sr. Technical Account Manager, specializing in Operations Management, AWS Management tools, and architecting resilient solutions to best achieve the customer’s business requirements. In his spare time, he is a passionate author and likes to spend quality time with his family and nature.