カテゴリー
Raspberry Pi

Raspberry Pi で AWS Lambda との WebSocket Chat サンプル・プログラムをインストールする

Raspberry Piで、AWS API Gateway + Lambda用Websocketサンプル・アプリsimple-websockets-chat-appをインストールする方法について説明します。

1. Raspberry PiへAWS SAMをインストールする

simple-websockets-chat-appを 簡単にセットアップするために、AWS SAMをインストールします。
少し、SAMのインストールに手間がかかります。下記のインストール方法を参考にしてください。

2. サンプル・アプリsimple-websockets-chat-appをインストールする

以下の手順でサンプル・アプリをダウンロードし、インストールします。「bucketname」の部分には、 AWS SAMのインストール時に設定したS3 bucket名を入力してください。

pi@raspberrypi:~ $ cd
pi@raspberrypi:~ $ git clone https://github.com/aws-samples/simple-websockets-chat-app.git
 Cloning into 'simple-websockets-chat-app'…
pi@raspberrypi:~ $ cd simple-websockets-chat-app/
pi@raspberrypi:~/simple-websockets-chat-app $ sam package --template-file template.yaml --output-template-file output.yaml --s3-bucket bucketname
 pi@raspberrypi:~/simple-websockets-chat-app $ aws cloudformation deploy --template-file output.yaml --stack-name websocket --capabilities CAPABILITY_IAM