{"id":24309,"date":"2023-07-21T17:08:14","date_gmt":"2023-07-21T08:08:14","guid":{"rendered":"https:\/\/www.skyarch.net\/blog\/?p=24309"},"modified":"2023-07-28T11:21:00","modified_gmt":"2023-07-28T02:21:00","slug":"aws-chalice%e3%81%a7efs%e3%83%9e%e3%82%a6%e3%83%b3%e3%83%88%e3%82%92%e5%ae%9f%e6%96%bd%e3%81%99%e3%82%8b%ef%bc%88merge-template%e6%a9%9f%e8%83%bd","status":"publish","type":"post","link":"https:\/\/www.skyarch.net\/blog\/aws-chalice%e3%81%a7efs%e3%83%9e%e3%82%a6%e3%83%b3%e3%83%88%e3%82%92%e5%ae%9f%e6%96%bd%e3%81%99%e3%82%8b%ef%bc%88merge-template%e6%a9%9f%e8%83%bd\/","title":{"rendered":"AWS Chalice\u3067EFS\u30de\u30a6\u30f3\u30c8\u3092\u5b9f\u65bd\u3059\u308b\uff08merge-template\u6a5f\u80fd)"},"content":{"rendered":"<h2>\u76ee\u6b21<\/h2>\n<ul>\n<li><a href=\"#overview\">\u80cc\u666f<\/a><\/li>\n<li><a href=\"#jissou\">\u5b9f\u88c5<\/a><\/li>\n<li><a href=\"#matome\">\u307e\u3068\u3081<\/a><\/li>\n<\/ul>\n<h2 id=\"overview\">\u80cc\u666f<\/h2>\n<p>Chalice\uff08\uff0bCI\/CD\u30d1\u30a4\u30d7\u30e9\u30a4\u30f3\uff09\u3092\u5229\u7528\u3057\u305fAPI\u958b\u767a\u306b\u304a\u3044\u3066\u3001APIGateway\u3084Lambda\u306b\u5bfe\u3059\u308b\u8ffd\u52a0\u8a2d\u5b9a\u3067 chalice \u306e config\u30d5\u30a1\u30a4\u30eb\u304c\u5bfe\u5fdc\u3057\u3066\u3044\u306a\u3044\u70b9\u304c\u3042\u308a\u307e\u3059\u3002<br \/>\n\u500b\u4eba\u7684\u306b\u906d\u9047\u3057\u305f\u7269\u3067\u4f8b\u3048\u3070\u3001EFS\u30de\u30a6\u30f3\u30c8 \u3084 APIGateway\u306e\u30ed\u30b0\u51fa\u529b\u8a2d\u5b9a\u3001\u30ab\u30b9\u30bf\u30e0\u30ec\u30b9\u30dd\u30f3\u30b9\u7b49\u3067\u3059\u3002<\/p>\n<p>\u30c7\u30d7\u30ed\u30a4\u3059\u308b\u5ea6\u306bEFS\u30de\u30a6\u30f3\u30c8\u304c\u5916\u308c\u3066\u3057\u307e\u3046\u7b49\u60b2\u3057\u3044\u601d\u3044\u3092\u3057\u306a\u3044\u3088\u3046\u306b\u3059\u308b\u305f\u3081\u3001\u30b9\u30de\u30fc\u30c8\u306b\u5bfe\u51e6\u3067\u304d\u308b\u3001Chalice \u306e\u3000CloudFormation Support (Template Merge) \u6a5f\u80fd\u306b\u3064\u3044\u3066\u8a18\u8f09\u3057\u307e\u3059\u3002<\/p>\n<p>AWS Chalice \u306e AWS CloudFormation Support<br \/>\n<a href=\"https:\/\/aws.github.io\/chalice\/topics\/cfn.html\" rel=\"noopener\" target=\"_blank\">https:\/\/aws.github.io\/chalice\/topics\/cfn.html<\/a><\/p>\n<p>\u53c2\u8003: Chalice\u306b\u5bfe\u3059\u308b EFS Support\u306e\u30ea\u30af\u30a8\u30b9\u30c8\u65b0\u6a5f\u80fd\u30c1\u30b1\u30c3\u30c8\uff08\u9032\u6357\u7121\u3057\uff09<br \/>\n<a href=\"https:\/\/aws.github.io\/chalice\/topics\/configfile.html\" rel=\"noopener\" target=\"_blank\">https:\/\/aws.github.io\/chalice\/topics\/configfile.html<\/a><\/p>\n<h2 id=\"jissou\">\u5b9f\u88c5<\/h2>\n<p>\u4e0a\u8a18\u3001AWS Chalice \u306e AWS CloudFormation Support\u306e\u5148\u306e\u4f8b\u3067\u306f\u4e0b\u8a18\u306e\u3088\u3046\u306bDynamoDB Table\u306e\u4f5c\u6210\u3084Lambda\u74b0\u5883\u5909\u6570\u8ffd\u52a0\u304c\u30b5\u30f3\u30d7\u30eb\u3068\u3057\u3066\u53d6\u308a\u4e0a\u3052\u3089\u308c\u3066\u3044\u307e\u3059\u3002<br \/>\nDynamoDB Table\u306e\u4f5c\u6210\u306f\u305d\u3082\u305d\u3082CDK\u5074\u3067\u5b9f\u65bd\u3057\u305f\u65b9\u304c...\u7b49\u306e\u8a71\u3082\u3042\u308b\u3068\u601d\u3044\u307e\u3059\u306e\u3067\u8a2d\u8a08\u306f\u3055\u3066\u304a\u304dChalice Prj\u3060\u3051\u3067\u5b8c\u7d50\u3067\u304d\u308b\u3068\u3044\u3046\u4e8b\u306f\u3001\u3042\u308a\u304c\u305f\u3044\u5834\u5408\u3082\u3042\u308b\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<h3>Chalice\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u4e0a\u306e\u30b5\u30f3\u30d7\u30eb<\/h3>\n<p>chalice package\u30b3\u30de\u30f3\u30c9\u306b merge-template \u30aa\u30d7\u30b7\u30e7\u30f3\u3092\u6307\u5b9a<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n$ chalice package --merge-template extras.json out\n<\/pre>\n<p>\u30de\u30fc\u30b8\u3059\u308b\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u5185\u3067\u3001DynamoDB Table\u4f5c\u6210\u3001\u4f5c\u6210\u3057\u305fTable\u540d\u3092Lambda\u74b0\u5883\u5909\u6570\u306b\u8ffd\u52a0\u3059\u308b\u30b5\u30f3\u30d7\u30eb<br \/>\n<a href=\"https:\/\/aws.github.io\/chalice\/topics\/cfn.html\" rel=\"noopener\" target=\"_blank\">https:\/\/aws.github.io\/chalice\/topics\/cfn.html<\/a><\/p>\n<h4>extras.json<\/h4>\n<pre>\n{\n  \"Resources\" : {\n    \"MusicTable\" : {\n      \"Type\" : \"AWS::DynamoDB::Table\",\n      \"Properties\" : {\n        \"TableName\" : \"MusicData\",\n        \"AttributeDefinitions\" : [\n          {\n            \"AttributeName\" : \"Album\",\n            \"AttributeType\" : \"S\"\n          },\n          {\n            \"AttributeName\" : \"Artist\",\n            \"AttributeType\" : \"S\"\n          }\n        ],\n        \"KeySchema\" : [\n          {\n            \"AttributeName\" : \"Album\",\n            \"KeyType\" : \"HASH\"\n          },\n          {\n            \"AttributeName\" : \"Artist\",\n            \"KeyType\" : \"RANGE\"\n          }\n        ],\n        \"ProvisionedThroughput\" : {\n          \"ReadCapacityUnits\" : \"5\",\n          \"WriteCapacityUnits\" : \"5\"\n        }\n      }\n    },\n    \"APIHandler\": {\n      \"Properties\": {\n        \"Environment\": {\n          \"Variables\": {\n            \"MUSIC_TABLE\": {\"Ref\": \"MusicTable\"}\n          }\n        }\n      }\n    }\n  }\n}\n<\/pre>\n<h3>EFS\u30de\u30a6\u30f3\u30c8\u306e\u5b9f\u73fe<\/h3>\n<p>\u672c\u984c\u306eEFS\u30de\u30a6\u30f3\u30c8\u3067\u3059\u304c\u3001\u4e0b\u8a18\u306e\u3088\u3046\u306a\u5f62\u3067 extras.json \u3092\u7528\u610f\u3057\u3000chalice package\u6642\u306b\u5f15\u304d\u6e21\u3057\u3001chalice\u304c\u751f\u6210\u3057\u305f\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u306b\u30de\u30fc\u30b8\u3057\u307e\u3059\u3002<br \/>\n\uff08\u4e00\u5ea6Local\u306a\u308a\u3067\u3001\u751f\u6210\u3055\u308c\u308b\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u3092\u78ba\u8a8d\u3057\u3001\u30ea\u30bd\u30fc\u30b9\u540d\u3092\u3057\u3063\u304b\u308a\u5408\u308f\u305b\u3066\u304b\u3089\u30de\u30fc\u30b8\u3057\u307e\u3057\u3087\u3046\uff01\uff09<\/p>\n<h4>extras.json<\/h4>\n<pre>\n{\n  \"Resources\" : {\n    \"APIHandler\": {\n      \"Properties\": {\n        \"FileSystemConfigs\": [\n          {\n            \"Arn\": \"arn:aws:elasticfilesystem:ap-northeast-1:YOUR_ACCOUNT_ID:access-point\/fsap-XXXX\",\n            \"LocalMountPath\": \"\/mnt\/xxxx\"\n          }\n        ]\n      }\n    }\n  }\n}\n<\/pre>\n<h4>APIGateway\u306e\u30ed\u30b0\u5410\u304d\u51fa\u3057\u8a2d\u5b9a\u3068\u5171\u306b\u30d0\u30fc\u30b8\u30e7\u30f3<\/h4>\n<pre>\n{\n  \"Resources\" : {\n    \"APIHandler\": {\n      \"Properties\": {\n        \"FileSystemConfigs\": [\n          {\n            \"Arn\": \"arn:aws:elasticfilesystem:ap-northeast-1:YOUR_ACCOUNT_ID:access-point\/fsap-XXXX\",\n            \"LocalMountPath\": \"\/mnt\/xxxx\"\n          }\n        ]\n      }\n    },\n    \"RestAPI\" : {\n      \"Properties\": {\n        \"MethodSettings\": [\n          {\n            \"ResourcePath\": \"\/*\",\n            \"HttpMethod\": \"*\",\n            \"LoggingLevel\": \"INFO\",\n            \"DataTraceEnabled\": false,\n            \"MetricsEnabled\": false\n          }\n        ]\n      }\n    }\n  }\n}\n<\/pre>\n<p>CodeBuild\u5185\u3067chalice package\u3001\u751f\u6210\u3055\u308c\u305fSAM Template\u751f\u6210\u3092\u3059\u308b\u30b1\u30fc\u30b9\u3082\u591a\u3044\u3068\u601d\u3044\u307e\u3059\u306e\u3067\u3001\u305d\u306e\u5834\u5408\u306b\u306f\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9\u3068\u306f\u540c\u4e00\u3067\u3001CodeBuild\u74b0\u5883\u5909\u6570\u306b ENVIRONMENT_NAME \u3092\u5b9a\u7fa9\u3057\u3001\u74b0\u5883\u5225\u3067\u30d5\u30a1\u30a4\u30eb\u3092\u5206\u3051\u308b\u7b49\u3067\u5bfe\u5fdc\u3057\u307e\u3059\u3002<\/p>\n<h4>CodeBuild Config<\/h4>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nchalice package --stage ${ENVIRONMENT_NAME} --merge-template .chalice\/extras-${ENVIRONMENT_NAME}.json .\/package\n<\/pre>\n<h2 id=\"matome\">\u307e\u3068\u3081<\/h2>\n<p>\u975e\u5e38\u306b\u4fbf\u5229\u306a AWS Chalice \u3067\u901a\u5e38\u306f .chalice\/config.json \u3067\u4e8b\u8db3\u308a\u307e\u3059\u304c\u3001\u75d2\u3044\u6240\u306b\u624b\u304c\u5c4a\u304b\u306a\u3044\u5834\u5408\u306fmerge-template\u6a5f\u80fd\u3092\u5229\u7528\u3057\u3064\u3064\u3001 config\u5185\u3067\u306e\u5bfe\u5fdc\u3092\u671f\u5f85\u3057\u307e\u3057\u3087\u3046\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u76ee\u6b21 \u80cc\u666f \u5b9f\u88c5 \u307e\u3068\u3081 \u80cc\u666f Chalice\uff08\uff0bCI\/CD\u30d1\u30a4\u30d7\u30e9\u30a4\u30f3\uff09\u3092\u5229\u7528\u3057\u305fAPI\u958b\u767a\u306b\u304a\u3044\u3066\u3001APIGateway\u3084Lambda\u306b\u5bfe\u3059\u308b\u8ffd\u52a0\u8a2d\u5b9a\u3067 chalice \u306e config\u30d5\u30a1\u30a4\u30eb\u304c\u5bfe\u5fdc\u3057\u3066\u3044\u306a\u3044\u70b9\u304c\u3042&#8230;<\/p>\n","protected":false},"author":2,"featured_media":23164,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_locale":"ja","_original_post":"https:\/\/www.skyarch.net\/blog\/?p=24309","footnotes":""},"categories":[20,518,276],"tags":[],"class_list":{"0":"post-24309","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-aws","8":"category-ci-cd","9":"category-serverless","10":"ja"},"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.skyarch.net\/blog\/wp-json\/wp\/v2\/posts\/24309","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.skyarch.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.skyarch.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.skyarch.net\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.skyarch.net\/blog\/wp-json\/wp\/v2\/comments?post=24309"}],"version-history":[{"count":6,"href":"https:\/\/www.skyarch.net\/blog\/wp-json\/wp\/v2\/posts\/24309\/revisions"}],"predecessor-version":[{"id":24334,"href":"https:\/\/www.skyarch.net\/blog\/wp-json\/wp\/v2\/posts\/24309\/revisions\/24334"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.skyarch.net\/blog\/wp-json\/wp\/v2\/media\/23164"}],"wp:attachment":[{"href":"https:\/\/www.skyarch.net\/blog\/wp-json\/wp\/v2\/media?parent=24309"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.skyarch.net\/blog\/wp-json\/wp\/v2\/categories?post=24309"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.skyarch.net\/blog\/wp-json\/wp\/v2\/tags?post=24309"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}