- Install nodebrew for controll node.js version reference
- Use
v6.10.3
that AWS Lambda supports
$ nodebrew install-binary v6.10.3
$ nodebrew use v6.10.3
$ node -v
v6.10.3
$ cd bike-share-api
$ npm install
$ node execute-local.js ports your_bike_share_member_id your_bike_share_password 1
# => [ { ParkingEntID: 'TYO',
# ParkingID: '10092',
# ParkingLat: '35.658911',
# ParkingLon: '139.792531',
# portNameJa: 'H1-01.豊洲IHIビル前(晴海通り)',
# portNameEn: 'H1-01.Toyosu IHI biru Mae',
# availableCount: 3 },
See here
$ brew install python3
accessKey.csv
will be downloaded
See AWS document for details.
$ pip install awscli
$ aws configure
# AWS Access Key ID [None]:your_access_key_id
# AWS Secret Access Key [None]:your_secret_access_key
# Default region name [None]: ap-northeast-1
# Default output format [None]:json
$ npm install -g serverless
$ sls -v
1.27.2
$ sls create --template aws-nodejs
$ sls deploy -v
# You can see endpoint URL in log
$ curl -s -d '{"MemberID":"your_bike_share_member_id","Password":"your_bike_share_member_id","AreaId":"4"}' https://your_endpoint.execute-api.ap-northeast-1.amazonaws.com/dev/ports