Skip to content

hara/soracom-cli-lambda-function

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SORACOM CLI Lambda Function

An AWS Lambda Function to execute SORACOM CLI.

How to deploy

Prerequisite

  1. Installing Docker.
  2. Installing AWS SAM CLI.

Step 1: Create your SORACOM AuthKey

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.

Step 2: Build the function

sam build

Step 3: Deploy the function to your AWS account

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.

How to invoke

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"
  }
}

About

An AWS Lambda Function to execute SORACOM CLI

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published