{"id":666,"date":"2020-08-18T10:00:00","date_gmt":"2020-08-18T01:00:00","guid":{"rendered":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/blog\/2020\/08\/18\/synthetics-with-cfn"},"modified":"2020-08-18T10:00:00","modified_gmt":"2020-08-18T01:00:00","slug":"synthetics-with-cfn","status":"publish","type":"post","link":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/blog\/2020\/08\/18\/synthetics-with-cfn\/","title":{"rendered":"Amazon CloudWatch Synthetics\u3092CloudFormation\u3067\u69cb\u7bc9\u3059\u308b"},"content":{"rendered":"
<\/p>\n
\u6bce\u65e5\u30ea\u30f3\u30b0\u30d5\u30a3\u30c3\u30c8\u30a2\u30c9\u30d9\u30f3\u30c1\u30e3\u30fc\u751f\u6d3b\u3067\u5f90\u3005\u306b\u4f53\u578b\u304c\u5909\u5316\u3057\u3066\u304d\u307e\u3057\u305f\u3001
\n\u3084\u3063\u3055\u3093\u3067\u3059\u3002<\/p>\n
Amazon CloudWatch Synthetics\uff08\u4ee5\u4e0b\u3001Synthetics\uff09\u3092CloudFormation\u3067\u69cb\u7bc9\u3057\u3066\u307f\u307e\u3057\u305f\u306e\u3067\u3001\u69cb\u7bc9\u3059\u308b\u969b\u306e\u30d2\u30f3\u30c8\u306a\u3069\u3092\u66f8\u304d\u7db4\u3063\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n
<\/p>\n
Synthetics\u306fREST API, URL, \u30a6\u30a7\u30d6\u30b5\u30a4\u30c8\u30b3\u30f3\u30c6\u30f3\u30c4\u3092\u76e3\u8996\u3059\u308b\u305f\u3081\u306e\u30b5\u30fc\u30d3\u30b9\u3067\u3059\u3002CloudWatch \u30a2\u30e9\u30fc\u30e0\u3068\u9023\u643a\u3057\u3001\u76e3\u8996\u7d50\u679c\u306b\u554f\u984c\u304c\u3042\u308c\u3070\u30a2\u30e9\u30fc\u30c8\u3092\u767a\u3059\u308b\u3053\u3068\u304c\u53ef\u80fd\u3067\u3059\u3002VPC\u30aa\u30d7\u30b7\u30e7\u30f3\u304c\u7528\u610f\u3055\u308c\u3066\u304a\u308a\u3001VPC\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u5185\u306b\u9589\u3058\u305f\u30b3\u30f3\u30c6\u30f3\u30c4\u3092\u76e3\u8996\u3067\u304d\u307e\u3059\u3002<\/p>\n
Synthetics\u306f\u6bd4\u8f03\u7684\u65b0\u3057\u3044\u30b5\u30fc\u30d3\u30b9\u3067\u3042\u308b\u305f\u3081\u3001\u30cf\u30de\u308a\u3069\u3053\u308d\u304c\u591a\u3044\u3067\u3059\u3002CloudFormation\u3067\u30ea\u30bd\u30fc\u30b9\u3092\u69cb\u7bc9\u3059\u308b\u306b\u3042\u305f\u3063\u3066\u306e\u30d2\u30f3\u30c8\u3092\u5171\u6709\u3057\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n
Synthetics\u306f\u8907\u6570\u306eAWS\u30ea\u30bd\u30fc\u30b9\u3092\u7d44\u307f\u5408\u308f\u305b\u305f\u30b5\u30fc\u30d3\u30b9<\/strong>\u306b\u306a\u308a\u307e\u3059\u3002 Synthetics\u306fLambda\u3092\u547c\u3073\u51fa\u3057\u3001Lambda\u306f\u30ec\u30a4\u30e4\u30fc\u306b\u4fdd\u7ba1\u3055\u308c\u305f\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u5b9f\u884c\u3057\u307e\u3059\u306e\u3067\u3001Lambda\u306f\u6c4e\u7528\u7684\u306aSynthetics\u7528\u30ea\u30bd\u30fc\u30b9\u306b\u306a\u308a\u3001\u30e6\u30fc\u30b6\u30fc\u304c\u4f5c\u6210\u3057\u305f\u30b9\u30af\u30ea\u30d7\u30c8\u306e\u5b9f\u4f53\u306f\u30ec\u30a4\u30e4\u30fc\u306b\u4fdd\u7ba1\u3055\u308c\u3066\u3044\u307e\u3059\u3002<\/p>\n CloudFormation\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u3067\u30e6\u30fc\u30b6\u30fc\u4f5c\u6210\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u6307\u5b9a\u3059\u308b\u65b9\u6cd5\u306f\u4ee5\u4e0b\u306e2\u7a2e\u985e\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n \u5177\u4f53\u7684\u306b\u306f\u3001\u4ee5\u4e0b\u306e\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u69cb\u6210\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n \u6b63\u3057\u3044\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u69cb\u6210\u3067\u306a\u3044\u3068\u3001\u30cf\u30f3\u30c9\u30e9\u30fc\u304c\u898b\u3064\u304b\u3089\u306a\u3044\u65e8\u306e\u30a8\u30e9\u30fc\u304c\u767a\u751f\u3057\u3066\u3057\u307e\u3044\u307e\u3059\u3002<\/p>\n Lambda\u30cf\u30f3\u30c9\u30e9\u30fc\u306e\u6307\u5b9a\u65b9\u6cd5\u306f \u3053\u306e\u5834\u5408\u306bLambda\u306e\u30cf\u30f3\u30c9\u30e9\u30fc\u306f\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n \u6b63\u3057\u304fLambda\u30cf\u30f3\u30c9\u30e9\u30fc\u3092\u6307\u5b9a\u3057\u306a\u3044\u3068\u30c7\u30d7\u30ed\u30a4\u5f8c\u306b\u30cf\u30f3\u30c9\u30e9\u30fc\u304c\u898b\u3064\u304b\u3089\u306a\u3044\u3068\u3044\u3046\u30a8\u30e9\u30fc\u304c\u767a\u751f\u3057\u3066\u3057\u307e\u3044\u307e\u3059\u3002<\/p>\n \u4e0a\u8a18\u6c17\u3092\u4ed8\u3051\u308b\u7b87\u6240\u3092\u53cd\u6620\u3057\u305fYAML\u30d5\u30a1\u30a4\u30eb\u306f\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n YAML\u4f8b\uff1a<\/p>\n CloudFormation\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u306f\u3001\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u30d5\u30a1\u30a4\u30eb\u306b\u5909\u66f4\u304c\u306a\u3044\u3068\u66f4\u65b0\u304c\u306a\u3044\u3068\u5224\u5b9a\u3055\u308c\u3066\u3057\u307e\u3044\u307e\u3059\u3002\u3067\u306f\u3001CloudFormation\u3067\u30e6\u30fc\u30b6\u30fc\u4f5c\u6210\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u66f4\u65b0\u3059\u308b\u306b\u306f\u3069\u3046\u3059\u308c\u3070\u3088\u3044\u306e\u304b\u3068\u3044\u3044\u307e\u3059\u3068\u3001 \u30e6\u30fc\u30b6\u30fc\u4f5c\u6210\u30b9\u30af\u30ea\u30d7\u30c8\u306e\u66f4\u65b0\u30d5\u30a1\u30a4\u30eb\u3092S3\u306b\u914d\u7f6e\u3059\u308b\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u7d44\u3093\u3067\u3001\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u30d5\u30a1\u30a4\u30eb\u306e S3Key\u3092\u66f4\u65b0\u3057\u305f\u5834\u5408\u306e\u8a18\u8ff0\u4f8b\uff1a<\/p>\n Synthetics\u306f\u307e\u3060\u307e\u3060\u904b\u7528\u7cfb\u306e\u30ca\u30ec\u30c3\u30b8\u304c\u4e16\u306b\u51fa\u3066\u3044\u306a\u3044\u611f\u899a\u304c\u3042\u308a\u307e\u3059\u3002\u5c11\u3057\u3067\u3082\u904b\u7528\u306e\u305f\u3081\u306e\u30ce\u30a6\u30cf\u30a6\u53ce\u96c6\u306e\u4e00\u52a9\u3068\u306a\u308c\u3070\u5e78\u3044\u3067\u3059\u3002<\/p>\n","protected":false},"excerpt":{"rendered":" \u6bce\u65e5\u30ea\u30f3\u30b0\u30d5\u30a3\u30c3\u30c8\u30a2\u30c9\u30d9\u30f3\u30c1\u30e3\u30fc\u751f\u6d3b\u3067\u5f90\u3005\u306b\u4f53\u578b\u304c\u5909\u5316\u3057\u3066\u304d\u307e\u3057\u305f\u3001 \u3084\u3063\u3055\u3093\u3067\u3059\u3002 Amazon CloudWatch Synthetics\uff08\u4ee5\u4e0b\u3001Synthetics\uff09\u3092CloudFormation\u3067\u69cb\u7bc9\u3057\u3066\u307f\u307e\u3057\u305f\u306e\u3067\u3001\u69cb\u7bc9\u3059\u308b\u969b\u306e\u30d2\u30f3\u30c8\u306a\u3069\u3092\u66f8\u304d\u7db4\u3063\u3066\u3044\u304d\u307e\u3059\u3002 Synthetics\u3068\u306f Synthetics\u306fREST API, URL, \u30a6\u30a7\u30d6\u30b5\u30a4\u30c8\u30b3\u30f3\u30c6\u30f3\u30c4\u3092\u76e3\u8996\u3059\u308b\u305f\u3081\u306e\u30b5\u30fc\u30d3\u30b9\u3067\u3059 […]<\/p>\n","protected":false},"author":8,"featured_media":684,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[13],"tags":[],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/posts\/666"}],"collection":[{"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/users\/8"}],"replies":[{"embeddable":true,"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/comments?post=666"}],"version-history":[{"count":0,"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/posts\/666\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/"}],"wp:attachment":[{"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/media?parent=666"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/categories?post=666"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/tags?post=666"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}
\n\u4ee5\u4e0b\u306e\u30ea\u30bd\u30fc\u30b9\u304c\u4f5c\u6210\u3055\u308c\u307e\u3059\u3002<\/p>\n\n
2. \u30e6\u30fc\u30b6\u30fc\u4f5c\u6210\u30b9\u30af\u30ea\u30d7\u30c8\u3092CloudFormation\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u3067\u6307\u5b9a\u3059\u308b\u65b9\u6cd5<\/h3>\n
\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u69cb\u6210\u3092\u5b88\u308b<\/h4>\n
\n
\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u306b\u30b3\u30fc\u30c9\u3092\u76f4\u66f8\u304d\u3059\u308b<\/code> \u3053\u3068\u306f\u904b\u7528\u4e0a\u3042\u307e\u308a\u5229\u7528\u3057\u306a\u3044\u3068\u601d\u3044\u307e\u3059\u306e\u3067\u3001
S3\u30d0\u30b1\u30c3\u30c8\u3068\u30ad\u30fc\u540d\u3092\u6307\u5b9a\u3059\u308b<\/code> \u65b9\u6cd5\u3092\u898b\u3066\u3044\u304d\u307e\u3057\u3087\u3046\u3002S3\u30d0\u30b1\u30c3\u30c8\u306e\u5834\u5408\u306f\u5727\u7e2e\u3055\u308c\u305fzip\u30d5\u30a1\u30a4\u30eb\u3092\u6307\u5b9a\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002zip\u30d5\u30a1\u30a4\u30eb\u306b\u30e6\u30fc\u30b6\u30fc\u4f5c\u6210\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u683c\u7d0d\u3059\u308c\u3070\u3088\u3044\u306e\u3067\u3059\u304c\u3001 \u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u69cb\u6210<\/em> \u3092\u610f\u8b58\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002Lambda\u30ec\u30a4\u30e4\u30fc\u3067\u5229\u7528\u3055\u308c\u308b\u3053\u3068\u3092\u610f\u8b58\u3057\u305f\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u69cb\u6210\u3067\u3042\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n
zip\u30d5\u30a1\u30a4\u30eb\n\u2514 nodejs\n \u2514 node_modules\n \u2514 \u30e6\u30fc\u30b6\u30fc\u4f5c\u6210\u30b9\u30af\u30ea\u30d7\u30c8\u30d5\u30a1\u30a4\u30eb<\/code><\/pre>\n
Lambda\u30cf\u30f3\u30c9\u30e9\u30fc\u3092\u6b63\u3057\u304f\u6307\u5b9a\u3059\u308b<\/h4>\n
\u30e6\u30fc\u30b6\u30fc\u4f5c\u6210\u30b9\u30af\u30ea\u30d7\u30c8\u30d5\u30a1\u30a4\u30eb\u306e\u30d5\u30a1\u30a4\u30eb\u540d.\u30cf\u30f3\u30c9\u30e9\u30fc\u540d<\/code> \u306b\u306a\u308a\u307e\u3059\u3002\u4f8b\u3048\u3070\u3001\u30d5\u30a1\u30a4\u30eb\u540d\u304c
apiCanaryBlueprint.js<\/code> \u3001\u30cf\u30f3\u30c9\u30e9\u30fc\u540d\u304c
handler<\/code> \u3060\u3068\u3057\u307e\u3059\u3002\u3053\u306e\u6642\u306e\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9\u306f\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u30a4\u30e1\u30fc\u30b8\u3067\u3059\u3002<\/p>\n
const apiCanaryBlueprint = async function () {\n \/\/ \u51e6\u7406\u5185\u5bb9\n};\n\nexports.handler = async () => {\n return await apiCanaryBlueprint();\n};<\/code><\/pre>\n
apiCanaryBlueprint.handler<\/code><\/pre>\n
YAML\u306e\u30b5\u30f3\u30d7\u30eb<\/h4>\n
AWSTemplateFormatVersion: '2010-09-09'\nResources:\n Synthetics:\n Type: AWS::Synthetics::Canary\n Properties:\n ArtifactS3Location: s3:\/\/test-artifact-bucket\n Code: {Handler: apiCanaryBlueprint.handler, S3Bucket: test-bucket, S3Key: file.zip}\n ExecutionRoleArn: 'arn:aws:iam::xxxxxxxxxxxx:role\/service-role\/role-name'\n Name: cfncanarytest\n RuntimeVersion: syn-1.0\n Schedule: {Expression: 'rate(30 minute)', DurationInSeconds: 3600}\n StartCanaryAfterCreation: false<\/code><\/pre>\n
\u30e6\u30fc\u30b6\u30fc\u4f5c\u6210\u30b9\u30af\u30ea\u30d7\u30c8\u3092CloudFormation\u3067\u66f4\u65b0\u3059\u308b\u65b9\u6cd5<\/h4>\n
S3Key<\/code> \u3082\u5909\u66f4\u3059\u308b<\/strong> \u3068\u3044\u3046\u624b\u6bb5\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n
Code: {Handler: apiCanaryBlueprint.handler, S3Bucket: test-bucket, S3Key: file_updated_20200818.zip}<\/code><\/pre>\n
Synthetics\u5b8c\u5168\u306b\u7406\u89e3\u3057\u305f<\/h2>\n