1.6 Cloud 9에서 배포하기

앞서 8.x 버전의 Node.js를 설치했다면 dev-dependency에 설치된 서버리스 명령어를 바로 사용할 수 있습니다. Node.js가 6.x 버전인 경우 serverless를 Global로 설치해야 합니다. 이미 Node.js 8.x를 설치했으므로 다음 명령어는 넘어가겠습니다.

설치가 끝나면 이제 배포를 합니다. package.json에 script에 serverless deploy를 넣었기 때문에 다음과 같이 배포하면 됩니다.

ec2-user:~/environment/serverless-todo-demo/serverless-api (master) $ npm run \
                                                                   deploy

Serverless: Packaging service...
Serverless: Excluding development dependencies...
Serverless: Uploading CloudFormation file to S3...
Serverless: Uploading artifacts...
Serverless: Uploading service .zip file to S3 (8.02 MB)...
Serverless: Validating template...
Serverless: Updating Stack...
Serverless: Checking Stack update progress...
..............
Serverless: Stack update finished...
Service Information
service: ServerlessHandsOn
stage: dev
region: ap-northeast-2
stack: ServerlessHandsOn-dev
api keys:
 None
endpoints:
 ANY - https://YOUR_CLOUD_FRONT_URL/dev/{proxy+}
functions:
 serverlessHandsOn: ServerlessHandsOn-dev-serverlessHandsOn
Serverless: 'Too many requests' received, sleeping 5 seconds
Serverless: 'Too many requests' received, sleeping 5 seconds


배포 이후에는 URL에 접속해 실제로 동작하는지 확인합니다.

ec2-user:~/environment/serverless-todo-demo/serverless-api (master) $ curl \
                                        https://YOUR_CLOUD_FRONT_URL/dev/{proxy+}


[]