{"id":9976,"date":"2023-03-20T16:25:10","date_gmt":"2023-03-20T08:25:10","guid":{"rendered":"http:\/\/123.57.164.21\/?p=9976"},"modified":"2023-03-20T16:25:10","modified_gmt":"2023-03-20T08:25:10","slug":"aws-api%e7%bd%91%e5%85%b3","status":"publish","type":"post","link":"https:\/\/92it.top\/?p=9976","title":{"rendered":"AWS API\u7f51\u5173"},"content":{"rendered":"\n<p><strong>API\u7f51\u5173<\/strong><\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<ul><li>API\u7f51\u5173\u662f\u7531\u4e00\u7cfb\u5217Lambda\u51fd\u6570\u7ec4\u6210\u7684\u7f51\u5173\uff0c\u8fd9\u4e9b\u51fd\u6570\u53ef\u521b\u5efa\u65e0\u670d\u52a1\u5668\u5b66\u4e60\u7ba1\u7406\u7cfb\u7edf\u3002<\/li><li>API Gateway\u662f\u4e00\u9879\u5b8c\u5168\u6258\u7ba1\u7684\u670d\u52a1\uff0c\u4f7f\u5f00\u53d1\u4eba\u5458\u53ef\u4ee5\u8f7b\u677e\u5730\u4ee5\u4efb\u610f\u89c4\u6a21\u53d1\u5e03\uff0c\u7ef4\u62a4\uff0c\u76d1\u89c6\u548c\u4fdd\u62a4API\u3002<\/li><li>\u5728AWS\u7ba1\u7406\u63a7\u5236\u53f0\u4e2d\u5355\u51fb\u51e0\u4e0b\uff0c\u60a8\u53ef\u4ee5\u521b\u5efa\u4e00\u4e2aAPI\uff0c\u5145\u5f53\u5e94\u7528\u7a0b\u5e8f\u4ece\u540e\u7aef\u670d\u52a1(\u4f8b\u5982\u5728Amazon Elastic Compute Cloud\u4e0a\u8fd0\u884c\u7684\u5e94\u7528\u7a0b\u5e8f)\u8bbf\u95ee\u6570\u636e\uff0c\u4e1a\u52a1\u903b\u8f91\u6216\u529f\u80fd\u7684\u201c\u524d\u95e8\u201d( Amazon EC2)\uff0c\u5728AWS Lambda\u6216\u4efb\u4f55Web\u5e94\u7528\u7a0b\u5e8f\u4e0a\u8fd0\u884c\u7684\u4ee3\u7801\u3002<\/li><li>\u5982\u679c\u60a8\u7684\u6d4f\u89c8\u5668\u6b63\u5728\u5bf9API Gateway\u8fdb\u884cAPI\u8c03\u7528\uff0c\u5219API Gateway\u4f1a\u5c06\u8fd9\u4e9b\u8c03\u7528\u8def\u7531\u5230Lambda\u3002<\/li><\/ul>\n\n\n\n<p><strong>API\u7f51\u5173\u7684\u4f53\u7cfb\u7ed3\u6784<\/strong><\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/123.57.164.21\/wp-content\/uploads\/2023\/03\/image-138.png\" alt=\"\" class=\"wp-image-9977\" width=\"305\" height=\"210\" srcset=\"https:\/\/92it.top\/wp-content\/uploads\/2023\/03\/image-138.png 1002w, https:\/\/92it.top\/wp-content\/uploads\/2023\/03\/image-138-300x207.png 300w, https:\/\/92it.top\/wp-content\/uploads\/2023\/03\/image-138-768x530.png 768w, https:\/\/92it.top\/wp-content\/uploads\/2023\/03\/image-138-830x573.png 830w, https:\/\/92it.top\/wp-content\/uploads\/2023\/03\/image-138-230x159.png 230w, https:\/\/92it.top\/wp-content\/uploads\/2023\/03\/image-138-350x242.png 350w, https:\/\/92it.top\/wp-content\/uploads\/2023\/03\/image-138-480x331.png 480w\" sizes=\"(max-width: 305px) 100vw, 305px\" \/><\/figure><\/div>\n\n\n\n<p>\u5047\u8bbe\u6211\u4eec\u8ba9\u901a\u8fc7\u624b\u673a\u6216\u7b14\u8bb0\u672c\u7535\u8111\u64cd\u4f5c\u7684\u7528\u6237\u5bf9API\u7f51\u5173\u8fdb\u884c\u4e86API\u8c03\u7528\u3002 API Gateway\u4f1a\u89e6\u53d1Lambda\u51fd\u6570\u6216EC2\u5185\u90e8\u7684\u51fd\u6570\u3002<\/p>\n\n\n\n<p><strong>\u4ec0\u4e48\u662fAPI\u7f13\u5b58?<\/strong><\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<ul><li>\u5728Amazon API Gateway\u4e2d\uff0c\u60a8\u53ef\u4ee5\u542f\u7528API\u7f13\u5b58\u6765\u7f13\u5b58\u7ec8\u7aef\u8282\u70b9\u7684\u54cd\u5e94\u3002<\/li><li>API\u7f13\u5b58\u53ef\u4ee5\u51cf\u5c11\u5bf9\u60a8\u7684\u7aef\u70b9\u7684\u8c03\u7528\u6b21\u6570\uff0c\u8fd8\u53ef\u4ee5\u6539\u5584\u5bf9API\u7684\u8bf7\u6c42\u7684\u5ef6\u8fdf\u3002<\/li><li>\u542f\u7528API\u7f13\u5b58\u540e\uff0cAPI\u7f51\u5173\u4f1a\u4ee5\u6307\u5b9a\u7684\u751f\u5b58\u65f6\u95f4(\u4ee5\u79d2\u4e3a\u5355\u4f4d)\u7f13\u5b58\u6765\u81ea\u7aef\u70b9\u7684\u54cd\u5e94\u3002 API\u7f51\u5173\u901a\u8fc7\u4ece\u7f13\u5b58\u4e2d\u67e5\u627e\u54cd\u5e94\u800c\u4e0d\u662f\u5411\u7aef\u70b9\u53d1\u51fa\u8bf7\u6c42\u6765\u54cd\u5e94\u8bf7\u6c42\u3002<\/li><\/ul>\n\n\n\n<p><strong>API\u7f13\u5b58\u7684\u4f53\u7cfb\u7ed3\u6784<\/strong><\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/123.57.164.21\/wp-content\/uploads\/2023\/03\/image-139.png\" alt=\"\" class=\"wp-image-9978\" width=\"316\" height=\"230\" srcset=\"https:\/\/92it.top\/wp-content\/uploads\/2023\/03\/image-139.png 928w, https:\/\/92it.top\/wp-content\/uploads\/2023\/03\/image-139-300x219.png 300w, https:\/\/92it.top\/wp-content\/uploads\/2023\/03\/image-139-768x561.png 768w, https:\/\/92it.top\/wp-content\/uploads\/2023\/03\/image-139-830x606.png 830w, https:\/\/92it.top\/wp-content\/uploads\/2023\/03\/image-139-550x400.png 550w, https:\/\/92it.top\/wp-content\/uploads\/2023\/03\/image-139-230x168.png 230w, https:\/\/92it.top\/wp-content\/uploads\/2023\/03\/image-139-350x256.png 350w, https:\/\/92it.top\/wp-content\/uploads\/2023\/03\/image-139-480x351.png 480w\" sizes=\"(max-width: 316px) 100vw, 316px\" \/><\/figure><\/div>\n\n\n\n<p>\u5047\u8bbe\u6211\u4eec\u5df2\u7ecf\u8ba9\u7528\u6237\u5bf9API Gateway\u8fdb\u884cAPI\u8c03\u7528\u3002 API\u7f51\u5173\u89e6\u53d1Lambda\u51fd\u6570\uff0c\u7136\u540eLambda\u51fd\u6570\u5c06\u54cd\u5e94\u53d1\u9001\u56deAPI\u7f51\u5173\u3002\u73b0\u5728\uff0c\u53e6\u4e00\u4e2a\u7528\u6237\u6765\u4e86\uff0c\u5e76\u5bf9API\u7f51\u5173\u8fdb\u884c\u4e86\u76f8\u540c\u7684API\u8c03\u7528\uff0c\u7136\u540e\u6211\u4eec\u6253\u5f00\u4e86\u7f13\u5b58\u548c\u751f\u5b58\u65f6\u95f4(TTL)\u3002\u5047\u8bbeTTL\u4e3a60\u79d2\u3002\u56e0\u6b64\uff0c\u54cd\u5e94\u5728API\u7f51\u5173\u5185\u505c\u7559\u4e8660\u79d2\u949f\u3002\u73b0\u5728\uff0c\u8981\u6ee1\u8db3\u53e6\u4e00\u4e2a\u7528\u6237\u7684\u8bf7\u6c42\uff0c\u60a8\u65e0\u9700\u8c03\u7528Lambda\u51fd\u6570\uff0c\u56e0\u4e3a\u8be5\u8bf7\u6c42\u7684\u54cd\u5e94\u5df2\u88ab\u7f13\u5b58\u3002\u8fd9\u6837\uff0c\u6211\u4eec\u53ef\u4ee5\u4ece\u6700\u7ec8\u7528\u6237\u90a3\u91cc\u83b7\u5f97\u66f4\u5feb\u7684\u54cd\u5e94\u3002<\/p>\n\n\n\n<p><strong>API\u7f51\u5173\u7684\u529f\u80fd<\/strong><\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/123.57.164.21\/wp-content\/uploads\/2023\/03\/image-140-1024x711.png\" alt=\"\" class=\"wp-image-9979\" width=\"361\" height=\"250\" srcset=\"https:\/\/92it.top\/wp-content\/uploads\/2023\/03\/image-140-1024x711.png 1024w, https:\/\/92it.top\/wp-content\/uploads\/2023\/03\/image-140-300x208.png 300w, https:\/\/92it.top\/wp-content\/uploads\/2023\/03\/image-140-768x533.png 768w, https:\/\/92it.top\/wp-content\/uploads\/2023\/03\/image-140-830x577.png 830w, https:\/\/92it.top\/wp-content\/uploads\/2023\/03\/image-140-230x160.png 230w, https:\/\/92it.top\/wp-content\/uploads\/2023\/03\/image-140-350x243.png 350w, https:\/\/92it.top\/wp-content\/uploads\/2023\/03\/image-140-480x333.png 480w, https:\/\/92it.top\/wp-content\/uploads\/2023\/03\/image-140.png 1120w\" sizes=\"(max-width: 361px) 100vw, 361px\" \/><\/figure><\/div>\n\n\n\n<ul><li><strong>\u6210\u672c\u6548\u76ca<\/strong>\u662f\u975e\u5e38\u4f4e\u7684\u6210\u672c\u548c\u6548\u7387\u4f5c\u4e3aAPI\u7f51\u5173\u63d0\u4f9b\u4e86API\u8bf7\u6c42\u5206\u5c42\u5b9a\u4ef7\u6a21\u5f0f\u3002 API\u8bf7\u6c42\u7684\u4ef7\u683c\u4f4e\u81f3\u6bcf\u767e\u4e07\u4e2a\u8bf7\u6c421.51\u7f8e\u5143\uff0c\u60a8\u8fd8\u53ef\u4ee5\u901a\u8fc7\u51cf\u5c11\u8bf7\u6c42\u6570\u6765\u964d\u4f4e\u6210\u672c\u3002<\/li><li><strong>\u53ef\u6269\u5c55\u6027<\/strong>\u60a8\u4e0d\u5fc5\u62c5\u5fc3\u8ba9EC2\u670d\u52a1\u6216\u81ea\u52a8<strong>\u6269\u5c55<\/strong>\u7ec4\u54cd\u5e94API\u8bf7\u6c42\u3002 API\u7f51\u5173\u4f1a\u81ea\u52a8\u7f29\u653e\u3002<\/li><li><strong>\u7f13\u5b58\u548c\u9650\u5236<\/strong>\u7f13\u5b58\u662fAPI\u7f51\u5173\u7684\u6700\u91cd\u8981\u529f\u80fd\u3002\u7f13\u5b58\u7528\u4e8e\u7f13\u5b58\u7aef\u70b9\u7684\u54cd\u5e94\uff0c\u4ece\u800c\u6539\u5584\u5bf9API\u7684\u8bf7\u6c42\u7684\u5ef6\u8fdf\u3002\u8fd9\u4e5f\u662f\u51b3\u5b9a\u670d\u52a1\u4ef7\u683c\u7684\u4e3b\u8981\u56e0\u7d20\u3002\u60a8\u8fd8\u53ef\u4ee5\u9632\u6b62API\u7f51\u5173\u7684\u5b89\u5168\u98ce\u9669\u3002\u5982\u679c\u8981\u9632\u6b62\u5bf9API\u7f51\u5173\u7684\u6b3a\u8bc8\u6027API\u8c03\u7528\u6cdb\u6ee5\uff0c\u5219\u53ef\u4ee5\u914d\u7f6e\u9650\u5236\u670d\u52a1\uff0c\u8be5\u670d\u52a1\u53ef\u4ee5\u9650\u5236\u8bf7\u6c42\u4ee5\u9632\u6b62\u653b\u51fb\u3002<\/li><li><strong>\u7075\u6d3b<\/strong>\u8981\u5b9e\u73b0API\u7f51\u5173\uff0c\u60a8\u65e0\u9700\u542f\u52a8EC2\u5b9e\u4f8b\u6216\u8bbe\u7f6e\u7f51\u5173\u8f6f\u4ef6\u3002\u53ef\u4ee5\u901a\u8fc7AWS\u7ba1\u7406\u63a7\u5236\u53f0\u5728\u51e0\u5206\u949f\u5185\u5b9e\u73b0API\u7f51\u5173\u3002<\/li><li><strong>\u5c06\u8981\u8fde\u63a5<\/strong>\u7684<strong>CloudWatch<\/strong> Amazon API Gateway\u4e0e\u4f5c\u4e3a\u76d1\u89c6\u670d\u52a1\u7684CloudWatch\u670d\u52a1\u96c6\u6210\u5728\u4e00\u8d77\u3002\u8be5\u5de5\u5177\u7528\u4e8e\u76d1\u89c6\u4f20\u5165API\u8c03\u7528\uff0c\u5ef6\u8fdf\u548c\u9519\u8bef\u7684\u6307\u6807\u3002<\/li><li><strong>\u5b89\u5168\u6027<\/strong>\u60a8\u53ef\u4ee5\u6388\u6743\u5bf9API\u7684\u8bbf\u95ee\u3002 API\u7f51\u5173\u7528\u4e8e\u901a\u8fc7\u6267\u884c\u5404\u79cd\u6388\u6743\u9009\u9879(\u4f8b\u5982Lambda\u51fd\u6570\u548c\u8eab\u4efd\u8bbf\u95ee\u7ba1\u7406\u670d\u52a1(IAM))\u6765\u9a8c\u8bc1\u4f20\u5165\u7684\u8bf7\u6c42\u3002 IAM\u4e0e\u7f51\u5173\u96c6\u6210\u5728\u4e00\u8d77\uff0c\u8be5\u7f51\u5173\u63d0\u4f9b\u8bf8\u5982AWS\u51ed\u8bc1\u4e4b\u7c7b\u7684\u5de5\u5177\uff0c\u5373\u8bbf\u95eeAPI\u7684\u8bbf\u95ee\u548c\u79d8\u5bc6\u5bc6\u94a5\u3002 Lambda\u51fd\u6570\u7528\u4e8e\u9a8c\u8bc1\u4ee4\u724c\uff0c\u5982\u679c\u6210\u529f\u9a8c\u8bc1\u4e86\u4ee4\u724c\uff0c\u5219\u5c06\u6388\u4e88\u5bf9API\u7684\u8bbf\u95ee\u6743\u9650\u3002<\/li><\/ul>\n","protected":false},"excerpt":{"rendered":"<p>API\u7f51\u5173 API\u7f51\u5173\u662f\u7531\u4e00\u7cfb\u5217Lambda\u51fd\u6570\u7ec4\u6210\u7684\u7f51\u5173\uff0c\u8fd9\u4e9b\u51fd\u6570\u53ef\u521b\u5efa\u65e0\u670d\u52a1\u5668\u5b66\u4e60\u7ba1\u7406\u7cfb\u7edf\u3002 API Ga [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1,9],"tags":[],"_links":{"self":[{"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/posts\/9976"}],"collection":[{"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/92it.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=9976"}],"version-history":[{"count":1,"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/posts\/9976\/revisions"}],"predecessor-version":[{"id":9980,"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/posts\/9976\/revisions\/9980"}],"wp:attachment":[{"href":"https:\/\/92it.top\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=9976"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/92it.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=9976"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/92it.top\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=9976"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}