{"id":626,"date":"2020-04-11T20:09:20","date_gmt":"2020-04-11T11:09:20","guid":{"rendered":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/blog\/2020\/04\/11\/serverless-component-deploy"},"modified":"2020-04-11T20:09:20","modified_gmt":"2020-04-11T11:09:20","slug":"serverless-component-deploy","status":"publish","type":"post","link":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/blog\/2020\/04\/11\/serverless-component-deploy\/","title":{"rendered":"\u30104\u30b9\u30c6\u30c3\u30d7\u3067\u30c7\u30d7\u30ed\u30a4\u3011Serverless Component\u3092\u4f7f\u3063\u3066\u3001\u30b5\u30fc\u30d0\u30ec\u30b9\u74b0\u5883\u306bWebAPI\u3092\u69cb\u7bc9"},"content":{"rendered":"
<\/head><\/p>\n\u30a8\u30f3\u30b8\u30cb\u30a2\u306e\u5185\u5c71\u3067\u3059\u3002\u6700\u8fd1\u306f\u30b3\u30ed\u30ca\u306e\u5f71\u97ff\u3067\u3001\u305a\u3063\u3068\u5bb6\u306b\u7c60\u3082\u3063\u3066\u3044\u307e\u3059\u3002<\/p>\n
\u4eca\u56de\u306f\u3001\u6700\u8fd1\u6b63\u5f0f\u30ea\u30ea\u30fc\u30b9\u3055\u308c\u305fServerless Component\u3092\u4f7f\u3063\u3066\u3001\u30b5\u30fc\u30d0\u30ec\u30b9\u74b0\u5883\u306b\u30c7\u30d7\u30ed\u30a4\u3059\u308b\u65b9\u6cd5\u3092\u3054\u7d39\u4ecb\u3057\u307e\u3059\u3002<\/p>\n
\u8fd1\u5e74\u3001\u30b5\u30fc\u30d0\u30ec\u30b9\u304c\u6ce8\u76ee\u3055\u308c\u3066\u3044\u307e\u3059\u3002\u30b5\u30fc\u30d0\u30ec\u30b9\u306b\u3059\u308b\u3068\u3001\u30b5\u30fc\u30d0\u306e\u7ba1\u7406\u304c\u4e0d\u8981\u306b\u306a\u308a\u3001\u30a2\u30d7\u30ea\u958b\u767a\u306b\u96c6\u4e2d\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u308b\u3068\u8a00\u308f\u308c\u3066\u3044\u307e\u3059\u3002\u30b5\u30fc\u30d0\u30ec\u30b9\u30a2\u30fc\u30ad\u30c6\u30af\u30c1\u30e3\u306b\u3059\u308b\u3068\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u3001\u3055\u307e\u3056\u307e\u306a\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u3092\u7d44\u307f\u5408\u308f\u305b\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n
<\/p>\n
\u5f93\u6765\u306e\u30e2\u30ce\u30ea\u30b7\u30c3\u30af\u306a\u30a2\u30fc\u30ad\u30c6\u30af\u30c1\u30e3\u306b\u6bd4\u3079\u3066\u3001\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u306e\u6570\u304c\u591a\u304f\u306a\u308a\u3001\u5404\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u306b\u5bfe\u3057\u3066\u8a2d\u5b9a\u304c\u5fc5\u8981\u306b\u306a\u308b\u306e\u3067\u3001\u30c7\u30d7\u30ed\u30a4\u3059\u308b\u307e\u3067\u306b\u304c\u304b\u304b\u3063\u3066\u3057\u307e\u3044\u307e\u3059\u3002<\/p>\n
Serverless Component\u306f\u3001\u3053\u306e\u554f\u984c\u3092\u89e3\u6c7a\u3059\u308b\u305f\u3081\u306e\u4ed5\u7d44\u307f\u3067\u3059\u3002<\/p>\n
<\/p>\n
https:\/\/serverless.com\/components\/<\/a><\/p>\n Serverless Component\u306f\u3001Serverless Framework\u3068\u3044\u3046\u30d7\u30ed\u30d3\u30b8\u30e7\u30cb\u30f3\u30b0\u30c4\u30fc\u30eb\u3092\u4ecb\u3057\u3066\u52d5\u4f5c\u3057\u3001\u3053\u306e\u30c4\u30fc\u30eb\u306e\u8a2d\u5b9a\u3092\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u3068\u3044\u3046\u5358\u4f4d\u3067\u518d\u5229\u7528\u53ef\u80fd\u306a\u5f62\u306b\u307e\u3068\u3081\u3066\u3044\u307e\u3059\u3002<\/p>\n \u958b\u767a\u8005\u306f\u3001\u3059\u3067\u306b\u63d0\u4f9b\u3055\u308c\u3066\u3044\u308b\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u3092\u5229\u7528\u3059\u308b\u3053\u3068\u306b\u3088\u3063\u3066\u3001\u308f\u305a\u304b\u306a\u8a2d\u5b9a\u3092\u884c\u3046\u3060\u3051\u3067\u30c7\u30d7\u30ed\u30a4\u3067\u304d\u307e\u3059\u3002<\/p>\n \u4eca\u56de\u306f\u3001Serverless Component\u3067\u3069\u306e\u3088\u3046\u306b\u30c7\u30d7\u30ed\u30a4\u3067\u304d\u308b\u304b\u3092\u3054\u7d39\u4ecb\u3057\u307e\u3059\u3002<\/p>\n \u4eca\u56de\u30b5\u30f3\u30d7\u30eb\u3068\u3057\u3066\u30c7\u30d7\u30ed\u30a4\u3059\u308b\u30a2\u30fc\u30ad\u30c6\u30af\u30c1\u30e3\u306f\u3001\u4ee5\u4e0b\u306e\u3068\u304a\u308a\u3067\u3059\u3002<\/p>\n <\/p>\n \u30ea\u30af\u30a8\u30b9\u30c8\u3067\u6587\u5b57\u5217\u3092\u6e21\u3059\u3068\"Hello, {\u6587\u5b57\u5217}\"\u3092\u8fd4\u3059WebAPI\u3068\u306a\u3063\u3066\u3044\u307e\u3059\u3002AWS\u306eLambda\u3068API Gateway\u3092\u5229\u7528\u3057\u3066\u3044\u307e\u3059\u3002\u4ee5\u4e0b\u306e\u30b9\u30c6\u30c3\u30d7\u306b\u5f93\u3063\u3066\u3044\u304f\u3068\u3001\u3053\u306e\u30b7\u30b9\u30c6\u30e0\u304c\u52d5\u4f5c\u3059\u308b\u72b6\u614b\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n \u4ee5\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\u3067\u3001Serverless Framework\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u307e\u3059\u3002<\/p>\n serverless\u30b3\u30de\u30f3\u30c9\u304c\u4f7f\u3048\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002Serverless Component\u3092\u4f7f\u3046\u305f\u3081\u306b\u306f\u3001\u65b0\u3057\u3044\u30d0\u30fc\u30b8\u30e7\u30f3\u3092\u4f7f\u3046\u5fc5\u8981\u304c\u3042\u308b\u306e\u3067\u3001\u5ff5\u306e\u305f\u3081\u306b\u30d0\u30fc\u30b8\u30e7\u30f3\u3092\u78ba\u8a8d\u3057\u307e\u3059\u3002 \u6b21\u306b\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u3092\u5229\u7528\u3057\u3066\u3001\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002\u4eca\u56de\u306f\u3001\u79c1\u304c\u7528\u610f\u3057\u305f\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u3092\u4f7f\u7528\u3057\u307e\u3059\u3002\u4ee5\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\u3067\u3001\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3092\u4f5c\u6210\u3068\u521d\u671f\u8a2d\u5b9a\u3092\u884c\u3044\u307e\u3059\u3002<\/p>\n AWS\u306b\u30c7\u30d7\u30ed\u30a4\u3059\u308b\u305f\u3081\u306b\u3001\u30a2\u30af\u30bb\u30b9\u30ad\u30fc\u3092\u8a2d\u5b9a\u3057\u307e\u3059\u3002\u30a2\u30af\u30bb\u30b9\u30ad\u30fc\u306e\u767a\u884c\u306e\u65b9\u6cd5\u306b\u3064\u3044\u3066\u306f\u3001\u4ee5\u4e0b\u306e\u30da\u30fc\u30b8\u3092\u53c2\u7167\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n\u4eca\u56de\u30c7\u30d7\u30ed\u30a4\u3059\u308b\u30a2\u30d7\u30ea\u3068\u30a2\u30fc\u30ad\u30c6\u30af\u30c1\u30e3<\/h2>\n
Step.1 Serverless Framework\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<\/h2>\n
$ npm i -g serverless<\/code><\/pre>\n
\n\u4eca\u56de\u306f\u3001\u4ee5\u4e0b\u306e\u30d0\u30fc\u30b8\u30e7\u30f3\u3067\u52d5\u4f5c\u78ba\u8a8d\u3092\u3057\u307e\u3057\u305f\u3002<\/p>\n$ serverless version\nFramework Core: 1.67.3\nPlugin: 3.6.6\nSDK: 2.3.0\nComponents: 2.29.1<\/code><\/pre>\n
Step.2 Serverless Framework\u306e\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3092\u4f5c\u6210\u3059\u308b<\/h2>\n
$ serverless create --template-url https:\/\/github.com\/memememomo\/api-gateway-component-template\/tree\/master\/template\/api-gateway-sample\n$ cd api-gateway-sample\n$ cp .env.sample .env<\/code><\/pre>\n
Step.3 .env\u306b\u30a2\u30af\u30bb\u30b9\u30ad\u30fc\u3092\u8a2d\u5b9a\u3059\u308b<\/h2>\n