Reputation: 43
I am trying to use an Amazon alexa to modify/run a script on my Raspberry Pi. I currently have a custom alexa skill that runs an Amazon lambda function and sends the message to a queue. I then have the raspberry pi constantly looking for updates in the queue.
However, I am looking at a better way to do this. Is it impossible to register my raspberry pi as an IoT device and communicate that way? I am open to any suggestions, let me know if you have any ideas as I am very new to this.
Upvotes: 2
Views: 233
Reputation: 35238
You can actually setup your Raspberry Pi with SSM Manager allowing commands to be run from within AWS onto your Raspberry Pi.
If you set this up on your Pi, your Lambda can then run the send-command which would allow the Lambda to directly send a list of commands to run (such as triggering the execution of script).
An example of calling this from within Boto3 is below
client = boto3.client('ssm')
response = client.send_command(
InstanceIds=[
'i-123456', #Replace this with your remote instance ID
],
DocumentName='AWS-RunShellScript',
Parameters={
'commands': [
'python3 /home/ec2-user/script.py',
]
}
)
Upvotes: 1