serverless frameworkの使い方について記載(v4.5)
1.サービス作成
$sls
Serverless ϟ Framework
Welcome to Serverless Framework V.4
Create a new project by selecting a Template to generate scaffolding for a specific use-case.
? Select A Template: …
❯ AWS / Node.js / HTTP API
AWS / Node.js / Express API
AWS / Node.js / Express API with DynamoDB
AWS / Node.js / Scheduled Task
AWS / Node.js / Simple Function
AWS / Python / HTTP API
AWS / Python / Flask API
AWS / Python / Flask API with DynamoDB
AWS / Python / Scheduled Task
AWS / Python / Simple Function
AWS / Compose / Serverless + Cloudformation + SAM
2.名前の指定
? Name Your Project: › api-lambda
3.認証方法指定
Serverless Frameworkのサイトで認証
? Serverless Framework V4 CLI is free for developers and organizations making less than $2 million annually, but requires an account or a license key.
Please login/register or enter your license key: …
❯ Login/Register
Get A License
Enter A License Key
Explain Licensing Basics
4.appの作成(Serverless Framework上で接続数を確認するためのもの。企業の売上によっては課金対象になる)
✔ Create Or Select An Existing App: · Create A New App
✔ Name Your New App: · test-app
5.AWSの認証方式を聞かれるので指定
ブラウザ認証、localのcredentialファイルしてい など
⠼ Checking credentialserror resolving aws account id
No valid AWS Credentials were found in your environment variables or on your machine. Serverless Framework needs these to access your AWS account and deploy resources to it. Choose an option below to set up AWS Credentials.
✔ AWS Credentials Set-Up Method:
6.完成
作成したディレクトリに入ってコマンド実行すればdeployできる
sls deploy -r {region}
以上