mizmarine / hello-serverless-framework

learning serverless framework
0 stars 0 forks source link

learning with tutorial #1

Open mizmarine opened 5 years ago

mizmarine commented 5 years ago
mizmarine commented 5 years ago

getting started https://serverless.com/framework/docs/getting-started/

mizmarine commented 5 years ago

install

npm install -g serverless
mizmarine commented 5 years ago

quick start with aws https://serverless.com/framework/docs/providers/aws/guide/quick-start/

serverless framework は awsによらずマルチクラウド対応なのでした

mizmarine commented 5 years ago

env

(3.6.0_playground) (`・ω・')っ旦 node -v
v11.9.0
(3.6.0_playground) (`・ω・')っ旦 npm -v
6.10.2
(3.6.0_playground) (`・ω・')っ旦 serverless -v
1.48.3 (Enterprise Plugin: 1.3.2, Platform SDK: 2.1.0)
mizmarine commented 5 years ago

プロジェクト作成 なんか自動でモニタリング環境も作ってくれるらしい?のでアカウントつくてみた

(`・ω・')っ旦 serverless

Serverless: No project detected. Do you want to create a new one? Yes
Serverless: What do you want to make? AWS Python
Serverless: What do you want to call this project? echo

Project successfully created in 'echo' folder.

You can monitor, troubleshoot, and test your new service with a free Serverless account.

Serverless: Would you like to enable this? Yes

You are not logged in or you do not have a Serverless account.

Serverless: Do you want to register? Yes
Serverless: email: <mail@example.com>
Serverless: password: [hidden]

Successfully registered your new account

Your project is setup for monitoring, troubleshooting and testing

Deploy your project and monitor, troubleshoot and test it:
- Run “serverless deploy” to deploy your service.
- Run “serverless dashboard” to view the dashboard.
mizmarine commented 5 years ago

デフォルトでは node / python しか選択肢なかったけど 他のruntimeももちろん指定できるっぽい https://serverless.com/framework/docs/providers/aws/cli-reference/create/

Looking to get started with something other than Node or Python? No problem. You can use thecreate command to get started with a variety of other languages.

mizmarine commented 5 years ago

deploy

serverless deploy -v

これやると、serverless.yml の中身をみてよしなにリソースをつくってくれるっぽい っていうか勝手につくってしまうっぽい。笑 cloudformation wrapper って感じやな。

なおデフォルトリージョンは us-east-1 っぽい。。?

mizmarine commented 5 years ago

invoke

serverless invoke -f hello -l
mizmarine commented 5 years ago

log tail -f みたいなかんじだ

serverless logs -f hello -t
mizmarine commented 5 years ago

remove

serverless remove