An AWS Lambda Function to execute SORACOM CLI.
- Installing Docker.
- Installing AWS SAM CLI.
Generate a new SORACOM AuthKey and save it to AWS Secrets Manager.
aws secretsmanager create-secret \
--name "soracom-cli/profile/default" \
--secret-string file://authkey.json
Contents of authkey.json
:
{
"AUTH_KEY_ID": "keyId-xxxxxxxxxx",
"AUTH_KEY": "secret-xxxxxxxxxx"
}
Copy ARN of the created secret. You will use ARN in step 3.
sam build
sam deploy --guided
Follow the on-screen prompts.
- Input ARN of your secret for
SoracomAuthKeySecretName
parameter. - You can use default or custom values for other parameters.
If you deployed your function with default function name (soracom-cli
):
aws lambda invoke --function-name soracom-cli \
--payload file://payload.json
Contents of payload.json
:
{
"command": "sims list"
}
For commands that consumes request body:
aws lambda invoke --function-name soracom-cli \
--payload file://payload-with-body.json
Contents of payload-with-body.json
:
{
"command": "auth",
"body": {
"operatorId": "OPXXXXXXXXXX",
"password": "p@$$w0rd",
"userName": "SORACOMAPI"
}
}