{"id":47587,"date":"2023-11-27T16:14:02","date_gmt":"2023-05-07T05:14:13","guid":{"rendered":"https:\/\/www.silicloud.com\/zh\/blog\/%e4%bd%bf%e7%94%a8-black-belt-online-seminar-%e5%ad%a6%e4%b9%a0%e7%9a%84%e5%86%85%e5%ae%b9%ef%bc%8c%e5%b0%86-aws-appsync-%e6%94%be%e5%9c%a8%e4%b8%ad%e5%bf%83%ef%bc%8c%e8%bf%9b%e8%a1%8c%e6%80%bb\/"},"modified":"2024-05-04T11:02:55","modified_gmt":"2024-05-04T03:02:55","slug":"%e4%bd%bf%e7%94%a8-black-belt-online-seminar-%e5%ad%a6%e4%b9%a0%e7%9a%84%e5%86%85%e5%ae%b9%ef%bc%8c%e5%b0%86-aws-appsync-%e6%94%be%e5%9c%a8%e4%b8%ad%e5%bf%83%ef%bc%8c%e8%bf%9b%e8%a1%8c%e6%80%bb","status":"publish","type":"post","link":"https:\/\/www.silicloud.com\/zh\/blog\/%e4%bd%bf%e7%94%a8-black-belt-online-seminar-%e5%ad%a6%e4%b9%a0%e7%9a%84%e5%86%85%e5%ae%b9%ef%bc%8c%e5%b0%86-aws-appsync-%e6%94%be%e5%9c%a8%e4%b8%ad%e5%bf%83%ef%bc%8c%e8%bf%9b%e8%a1%8c%e6%80%bb\/","title":{"rendered":"\u4f7f\u7528 Black Belt Online Seminar \u5b66\u4e60\u7684\u5185\u5bb9\uff0c\u5c06 AWS AppSync \u653e\u5728\u4e2d\u5fc3\uff0c\u8fdb\u884c\u603b\u7ed3"},"content":{"rendered":"<p>\u8003\u8651\u4f7f\u7528AWS AppSync\u65f6\uff0c\u53c2\u8003\u4e86\u3010AWS Black Belt Online Seminar\u3011\u5173\u4e8eAWS AppSync\u7684\u5185\u5bb9\uff0c\u8bb0\u5f55\u4e86\u53ef\u4ee5\u505a\u7684\u4e8b\u60c5\u3002<\/p>\n<h2>AWS AppSync\u662f\u4ec0\u4e48\uff1f<\/h2>\n<p>\u53ef\u4ee5\u7acb\u5373\u5f00\u59cb\u4f7f\u7528GraphQL\u7684\u6258\u7ba1\u670d\u52a1\u3002<\/p>\n<h2>AWS AppSync\u7684\u7279\u70b9\u662f\u4ec0\u4e48\uff1f<\/h2>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">GraphQL\u306e\u30de\u30cd\u30fc\u30b8\u30c9\u30b5\u30fc\u30d3\u30b9<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">\u30a2\u30ab\u30a6\u30f3\u30c8\u306eDataSource\u306b\u63a5\u7d9a<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">\u30c7\u30fc\u30bf\u540c\u671f\u3001\u30ea\u30a2\u30eb\u30bf\u30a4\u30e0\u3001\u30aa\u30d5\u30e9\u30a4\u30f3\u6a5f\u80fd\u3092\u4fdd\u6301\u3057\u3066\u3044\u308b\u3053\u3068<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">GraphQL\u30d5\u30a1\u30b5\u30fc\u30c9\uff08\u8907\u96d1\u306a\u5185\u90e8\u51e6\u7406\u3092\u610f\u8b58\u3055\u305b\u308b\u3053\u3068\u306a\u304f\u5229\u7528\u8005\u306b\u30b7\u30f3\u30d7\u30eb\u306a\u30a4\u30f3\u30bf\u30d5\u30a7\u30fc\u30b9\u3092\u63d0\u4f9b\u3059\u308b\u30d1\u30bf\u30fc\u30f3\uff09\u3067\u3042\u308b\u3053\u3068<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">\u7af6\u5408\u306e\u691c\u51fa\u3068\u89e3\u6c7a<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u3068\u3057\u3066API Key, IAM, Cognito, OIDC\u304c\u5229\u7528\u53ef\u80fd<\/ul>\n<h2>\u5f00\u53d1\u8005\u9762\u4e34\u7684\u95ee\u9898\u89e3\u51b3<\/h2>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">\u30ea\u30a2\u30eb\u30bf\u30a4\u30e0\u30b3\u30e9\u30dc\u30ec\u30fc\u30b7\u30e7\u30f3<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">\u540c\u671f\u3092\u8003\u616e\u3057\u305f\u30aa\u30d5\u30e9\u30a4\u30f3\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">\u5fc5\u8981\u306a\u30c7\u30fc\u30bf\u306e\u307f\u306e\u53d6\u5f97<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">\u8907\u6570\u306e\u30c7\u30fc\u30bf\u30bd\u30fc\u30b9\u3078\u306e\u30a2\u30af\u30bb\u30b9<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u3092\u5229\u7528\u3057\u305f\u30a2\u30af\u30bb\u30b9\u5236\u5fa1<\/ul>\n<h2>\u7528\u4f8b<\/h2>\n<p>\u5728AWS AppSync\u4e2d\u5b58\u5728\u4e09\u4e2a\u4e3b\u8981\u7684\u5e94\u7528\u573a\u666f\u3002<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">\u30ea\u30a2\u30eb\u30bf\u30a4\u30e0<\/ul>\n<\/li>\n<\/ul>\n<p>\u6700\u65b0\u306e\u60c5\u5831\u3092\u30a6\u30a9\u30c3\u30c1\u3059\u308b\u30c0\u30c3\u30b7\u30e5\u30dc\u30fc\u30c9<br \/>\n\u307b\u307c\u30ea\u30a2\u30eb\u30bf\u30a4\u30e0\u3067\u30c7\u30fc\u30bf\u3092\u66f4\u65b0<\/p>\n<p>\u30b3\u30e9\u30dc\u30ec\u30fc\u30b7\u30e7\u30f3<\/p>\n<p>\u8907\u6570\u30e6\u30fc\u30b6\u304c\u5171\u540c\u7de8\u96c6\u3092\u884c\u3046\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3<br \/>\n\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u3001\u753b\u50cf\u3001\u30c6\u30ad\u30b9\u30c8\u30e1\u30c3\u30bb\u30fc\u30b8\u7b49\u3001\u69d8\u3005\u306a\u30b3\u30f3\u30c6\u30f3\u30c4\u30bf\u30a4\u30d7\u3092\u81ea\u52d5\u66f4\u65b0<\/p>\n<p>\u30bd\u30fc\u30b7\u30e3\u30eb\u30e1\u30c7\u30a3\u30a2<\/p>\n<p>\u30bd\u30fc\u30b7\u30e3\u30eb\u30e1\u30c7\u30a3\u30a2\u3084\u30c1\u30e3\u30c3\u30c8<br \/>\n\u8907\u6570\u30e6\u30fc\u30b6\u9593\u3067\u306e\u30e1\u30c3\u30bb\u30fc\u30b8\u30f3\u30b0\u7ba1\u7406\u3092\u30b5\u30dd\u30fc\u30c8<br \/>\n\u30aa\u30d5\u30e9\u30a4\u30f3\u6642\u3067\u3082\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u64cd\u4f5c\u3067\u304d\u3001\u518d\u63a5\u7d9a\u6642\u306b\u81ea\u52d5Sync<\/p>\n<h2>AWS AppSync\u7684\u6982\u5ff5<\/h2>\n<p>AWS App Sync Client\uff1a\u8a8d\u8a3c\u3001\u30aa\u30d5\u30e9\u30a4\u30f3\u30ed\u30b8\u30c3\u30af\u306a\u3069\u3092\u542b\u3093\u3060Client<\/p>\n<p>Resolver\uff1a\u30ea\u30af\u30a8\u30b9\u30c8\/ \u30ec\u30b9\u30dd\u30f3\u30b9\u306e\u51e6\u7406\u3092\u8a18\u8ff0\u3059\u308b\u95a2\u6570<\/p>\n<p>Data Source\uff1aDynamoDB\/ Lambda\/ Aurora Serverless\uff08RDS\uff09\/ Elasticsearch\/ HTTP Endpoint.\uff08DynamoDB\u3092\u5229\u7528\u3059\u308b\u4eba\u304c\u591a\u3044\uff09<br \/>\nIdentity\uff1aGraphQL Proxy\u3078\u306e\u30ea\u30af\u30a8\u30b9\u30c8\u8a8d\u8a3c<br \/>\nGraphQL Proxy\uff1a\u30ea\u30af\u30a8\u30b9\u30c8\u306e\u30de\u30c3\u30d4\u30f3\u30b0\u3001\u30b3\u30f3\u30d5\u30ea\u30af\u30c8\u306e\u30cf\u30f3\u30c9\u30ea\u30f3\u30b0\u3001\u30a2\u30af\u30bb\u30b9\u30b3\u30f3\u30c8\u30ed\u30fc\u30eb<br \/>\nOperation\uff1aQuery\/ Mutation\/ Subscription\u306a\u3069GraphQL\u306e\u30aa\u30da\u30ec\u30fc\u30b7\u30e7\u30f3<\/p>\n<h2>\u5feb\u901f\u539f\u578b\u5236\u4f5c<\/h2>\n<p>AppSync\u7684\u8bd5\u9a8c\u6b65\u9aa4\u4e3a\uff1a\u6a21\u5f0f\u5b9a\u4e49 \u2192 \u4e0e\u6570\u636e\u6e90\u7684\u8fde\u63a5 \u2192 \u5ba2\u6237\u7aef\u914d\u7f6e\u3002<\/p>\n<h3>Schema\u7684\u5b9a\u4e49<\/h3>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">\u30b9\u30ad\u30fc\u30de\u306f\u30b5\u30fc\u30d0\u306e\u6a5f\u80fd\u3092\u8a18\u8ff0\u3057\u3001\u30af\u30a8\u30ea\u304c\u6709\u52b9\u304b\u900f\u904e\u3092\u5224\u65ad\u3059\u308b\u305f\u3081\u306b\u4f7f\u308f\u308c\u308b\u3002<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">GraphQL API\u306f1\u3064\u306eGraphQL Schema\u3067\u5b9a\u7fa9\u3055\u308c\u3001SDL\uff08Schema Definition Language\uff09\u306b\u3088\u3063\u3066\u8a18\u8ff0\u3055\u308c\u308b<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">Schema\u306e\u66f8\u304d\u65b9<\/ul>\n<pre class=\"post-pre\"><code><span class=\"n\">type<\/span> <span class=\"n\">Query<\/span> <span class=\"p\">{<\/span>\r\n  <span class=\"err\">#<\/span> <span class=\"err\">\u30b9\u30ab\u30e9\u30fc\u578b\u3001\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u578b\u3001\u5217\u6319\u578b\u3092\u5229\u7528\u53ef\u80fd<\/span> \r\n  <span class=\"err\">#<\/span> <span class=\"err\">\u30ea\u30b9\u30c8\u304c\u89d2\u304b\u3063\u3053\u3067\u8868\u73fe<\/span>\r\n  <span class=\"n\">getTodos<\/span><span class=\"o\">:<\/span><span class=\"p\">[<\/span><span class=\"n\">Todo<\/span><span class=\"p\">]<\/span>\r\n<span class=\"p\">}<\/span>\r\n<span class=\"n\">typeTodo<\/span> <span class=\"p\">{<\/span>\r\n  <span class=\"err\">#<\/span> <span class=\"n\">Not<\/span> <span class=\"n\">Null<\/span><span class=\"err\">\u306f\u611f\u5606\u7b26\u3067\u8868\u73fe<\/span>\r\n  <span class=\"n\">id<\/span><span class=\"o\">:<\/span><span class=\"n\">ID<\/span><span class=\"err\">!<\/span>\r\n  <span class=\"n\">name<\/span><span class=\"o\">:<\/span><span class=\"n\">String<\/span>\r\n  <span class=\"n\">description<\/span><span class=\"o\">:<\/span><span class=\"n\">String<\/span>\r\n  <span class=\"n\">status<\/span><span class=\"o\">:<\/span><span class=\"n\">TodoStatus<\/span>\r\n<span class=\"p\">}<\/span>\r\n<span class=\"kd\">enum<\/span> <span class=\"n\">TodoStatus<\/span><span class=\"p\">{<\/span>\r\n  <span class=\"n\">done<\/span>\r\n  <span class=\"n\">pending<\/span>\r\n<span class=\"p\">}<\/span>\r\n<\/code><\/pre>\n<h3>\u4e0e\u6570\u636e\u6e90\u7684\u8fde\u63a5<\/h3>\n<p>\u5173\u4e8e\u8fde\u63a5\u6570\u636e\u6e90\u548cAppSync\u7684\u89e3\u6790\u5668<\/p>\n<h4>\u5173\u4e8eResolver\u6620\u5c04\u6a21\u677f<\/h4>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">\u30de\u30c3\u30d4\u30f3\u30b0\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u306f\u3001GraphQL\u30ea\u30af\u30a8\u30b9\u30c8\u3092\u30c7\u30fc\u30bf\u30bd\u30fc\u30b9\u306e\u547d\u4ee4\u306b\u5909\u63db\u3059\u308b\u65b9\u6cd5\u3068\u30c7\u30fc\u30bf\u30bd\u30fc\u30b9\u304b\u3089\u306e\u5fdc\u7b54\u3092GraphQL\u30ec\u30b9\u30dd\u30f3\u30b9\u306b\u5909\u63db\u3059\u308b\u65b9\u6cd5\u3092\u5b9a\u7fa9\u3059\u308b\u3002<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">Resolver\u30de\u30c3\u30d4\u30f3\u30b0\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u306f\u3001VTL\uff08Velocity Template Language\uff09\u306b\u3088\u3063\u3066\u8a18\u8ff0\u3055\u308c\u308b\u3002<\/ul>\n<h4>\u4f7f\u7528\u89e3\u6790\u5668\u6620\u5c04\u6a21\u677f\u8fdb\u884c\u64cd\u4f5c\u7684\u793a\u4f8b\u3002<\/h4>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">\u30a2\u30af\u30bb\u30b9\u30b3\u30f3\u30c8\u30ed\u30fc\u30eb<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">\u65b0\u898f\u30a2\u30a4\u30c6\u30e0\u306e\u30c7\u30d5\u30a9\u30eb\u30c8\u5024<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">\u5165\u529b\u306e\u30d0\u30ea\u30c7\u30fc\u30b7\u30e7\u30f3\u3001\u30d5\u30a9\u30fc\u30de\u30c3\u30c8<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">\u30c7\u30fc\u30bf\u306e\u5909\u63db\u3068\u6574\u5f62<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">\u30ea\u30b9\u30c8\u3001\u30de\u30c3\u30d7\u306e\u52a0\u5de5<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">\u30e6\u30fc\u30b6\u30fcID\u306b\u57fa\u3065\u3044\u305f\u30ec\u30b9\u30dd\u30f3\u30b9\u306e\u30d5\u30a3\u30eb\u30bf\u30ea\u30f3\u30b0\/ \u5909\u66f4<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\u8907\u96d1\u306a\u6a29\u9650\u30c1\u30a7\u30c3\u30af<\/ul>\n<h4>\u4e24\u79cd\u6620\u5c04\u6a21\u677f<\/h4>\n<p>\u5728\u6620\u5c04\u6a21\u677f\u4e2d\uff0c\u6709\u4e24\u79cd\u7c7b\u578b\uff0c\u4e00\u79cd\u7528\u4e8e\u8bf7\u6c42\uff08Request\uff09\uff0c\u4e00\u79cd\u7528\u4e8e\u54cd\u5e94\uff08Response\uff09\u3002<\/p>\n<h5>\u8bf7\u63d0\u4f9b\u4e00\u4e2a\u7528\u4e8e\u8bf7\u6c42\u7684\u6a21\u677f\uff08\u5c06\u8bf7\u6c42\u8f6c\u5316\u4e3a\u6570\u636e\u6e90\u547d\u4ee4\uff09\u3002<\/h5>\n<p>\u8fd9\u4e2a\u82f9\u679c\u662f\u7ea2\u8272\u7684\u3002<\/p>\n<pre class=\"post-pre\"><code>{\r\n  \"version\" : \"2017-02-28\",\r\n  \"operation\" : \"GetItem\",\r\n  \"key\" : {\r\n    \"id\" : {\"S\" : \"${context.atguments.id}\"}\r\n  }\r\n}\r\n<\/code><\/pre>\n<h5>\u54cd\u5e94\u6a21\u677f\uff08\u6570\u636e\u6e90\u54cd\u5e94 -&gt; GraphQL \u54cd\u5e94\uff09<\/h5>\n<p>\u5982\u679c\u9ed8\u8ba4\u8fd4\u56de\u7684\u60c5\u51b5\u4e0b\uff1a<\/p>\n<pre class=\"post-pre\"><code>$ utils.toJson($context.result)\r\n<\/code><\/pre>\n<p>\u5982\u679c\u8981\u6574\u5408\u6570\u636e\uff1a<\/p>\n<pre class=\"post-pre\"><code>{\r\n  \"id\" : ${context.data.id},\r\n  \"title\" : \"${context.data.theTitle}\",\r\n  \"content\" : \"${context.data.body1} ${context.data.body2}\"\r\n}\r\n<\/code><\/pre>\n<h4>\u5730\u56fe\u6a21\u677f\u7684\u63cf\u8ff0\u65b9\u6cd5 de<\/h4>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">AppSync\u4e0a\u306e\u30a8\u30c7\u30a3\u30bf\u3067\u76f4\u63a5\u8a18\u8ff0<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">No-code GraphQL API Builder\u3092\u5229\u7528<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">\u8a18\u8ff0\u3057\u305fSchema\u304b\u3089\u30ea\u30be\u30eb\u30d0\u30de\u30c3\u30d4\u30f3\u30b0\u3092\u76f4\u63a5\u30b8\u30a7\u30cd\u30ec\u30fc\u30c8<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\u65e2\u5b58\u306eDynamoDB\u3092\u30c7\u30fc\u30bf\u30bd\u30fc\u30b9\u3068\u3057\u3066\u6307\u5b9a\u3057\u305f\u5834\u5408\u3001\u305d\u306e\u30c6\u30fc\u30d6\u30eb\u5b9a\u7fa9\u304b\u3089\u30de\u30c3\u30d4\u30f3\u30b0\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u3092\u30b8\u30a7\u30cd\u30ec\u30fc\u30c8<\/ul>\n<h3>\u5ba2\u6237\u8bbe\u7f6e<\/h3>\n<h4>\u4e0eGraphQL Endpoint\u7684\u8fde\u63a5\u4fe1\u606f<\/h4>\n<p>\u4f7f\u7528API\u5bc6\u94a5\u7684\u793a\u4f8b<\/p>\n<pre class=\"post-pre\"><code>export default {\r\n    \"graphqlEndpoint\": \"https*\/\/**.appsync-api.**.amazon.com\/graphql\",\r\n    \"region\": \"us-east-1\",\r\n    \"authenticationType\": \"API_KEY\",\r\n    \"apiKey\": \"***\"\r\n}\r\n<\/code><\/pre>\n<h4>\u5ba2\u6237\u7684\u5404\u79cd\u8bbe\u7f6e\u793a\u4f8b<\/h4>\n<p>\u5ba2\u6237\u914d\u7f6e\u7684\u793a\u4f8b<\/p>\n<pre class=\"post-pre\"><code>const client = new AWSAppSyncClient({\r\nurl: awsconfig.ENDPOINT,\r\nregion: AWS.config.region,\r\nauth: { type: AUTH_TYPE.AWS_IAM, credentials: Auth.currendCredentials() }\r\n})\r\nconst WithProvider = () =&gt; (\r\n    &lt;ApolloProvider client={client}&gt;\r\n        &lt;Rehydrated&gt;\r\n            &lt;AppWithData \/&gt; \u81ea\u52d5\u3067\u30aa\u30d5\u30e9\u30a4\u30f3\u5229\u7528\u304c\u53ef\u80fd\u306b\r\n        &lt;\/Rehydrated&gt;\r\n    &lt;\/ApolloProvider&gt;\r\n);\r\n<\/code><\/pre>\n<p>\u203b \u4ea6\u53ef\u901a\u8fc7AWS Amplify\u76f4\u63a5\u6ce8\u5165\u3002 \u5728\u6b64\u60c5\u51b5\u4e0b\uff0c\u8fd8\u5c06\u521b\u5efa\u4e00\u4e2a\u53ef\u79bb\u7ebf\u4f7f\u7528\u7684\u6a21\u677f\u3002<\/p>\n<h4>\u5ba2\u6237\u7aef\u8eab\u4efd\u9a8c\u8bc1\u793a\u4f8b<\/h4>\n<p>\u4f7f\u7528API\u5bc6\u94a5\u8fdb\u884c\u8eab\u4efd\u9a8c\u8bc1\u7684\u6a21\u677f\u914d\u7f6e\u793a\u4f8b\u3002<\/p>\n<pre class=\"post-pre\"><code>\/\/ API Key\r\nconst client = new AWSAppSyncClient({\r\n    url: awsconfig.ENDPOINT,\r\n    region: awsconfig.REGION,\r\n    auth: {type: AUTH_TYPE.API_KEY, apiKey: awsconfig.apiKey}\r\n});\r\n<\/code><\/pre>\n<p>IAM\u8a8d\u8bc1\u7684\u4f8b\u5b50<\/p>\n<pre class=\"post-pre\"><code>\/\/ IAM\u8a8d\u8a3c\r\nauth: { type: AUTH_TYPE.AWS_IAM,\r\n    credentials: Auth.currentCredentials()\r\n}\r\n<\/code><\/pre>\n<p>Cognito\u8ba4\u8bc1\u7684\u4f8b\u5b50<\/p>\n<pre class=\"post-pre\"><code>auth: { type: AUTH_TYPE.AMAZON_COGNITO_USER_POOLS,\r\n    jwtToken: Auth.currentSession().accessToken.jwtToken\r\n} \r\n<\/code><\/pre>\n<h2>\u54ea\u4e2a\u66f4\u597d\uff0cAPI\u7f51\u5173\u8fd8\u662f\u4e0d\u5b58\u5728\u4e8e\u89c6\u9891\u4e2d\u7684\uff1f<\/h2>\n<p>API\u7f51\u5173\u53ef\u4ee5\u901a\u8fc7\u4e00\u4e2aAPI\u63d0\u4f9b\u591a\u4e2a\u7ec8\u70b9\uff0c\u800cAppSync\u53ea\u80fd\u63d0\u4f9b\u4e00\u4e2a\u7ec8\u70b9\u6765\u63a5\u6536GraphQL\u4ee3\u7801\u3002<\/p>\n<p>\u6839\u636e\u7528\u4f8b\u6765\u51b3\u5b9a\u4f7f\u7528GraphQL\u8fd8\u662f\u4f7f\u7528REST\uff0c\u603b\u7ed3\u8d77\u6765\uff0c\u4f7f\u7528GraphQL\u65f6\u5e94\u9009\u62e9AppSync\uff0c\u800c\u4f7f\u7528REST\u65f6\u5219\u5e94\u9009\u62e9API Gateway\u3002<\/p>\n<h2>\u6536\u8d39<\/h2>\n<div>\n<div class=\"post-table\">\n\u4fa1\u683c\u30af\u30a8\u30ea\u3068\u30c7\u30fc\u30bf\u5909\u66f4\u64cd\u4f5c$4.00 \/ 100\u4e07\u4ef6\u30ea\u30a2\u30eb\u30bf\u30a4\u30e0\u66f4\u65b0$2.00 \/ 100\u4e07\u4ef6\u30ea\u30a2\u30eb\u30bf\u30a4\u30e0\u66f4\u65b0 \u63a5\u7d9a\u6642\u9593\uff08\u5206\uff09$0.08 \/ 100\u4e07\u5206<\/div>\n<\/div>\n<h2>\u8bf7\u63d0\u4f9b\u4e0b\u5217\u53e5\u5b50\u7684\u4e2d\u6587\u672c\u5730\u5316\u91ca\u4e49\uff0c\u4ec5\u9700\u4e00\u79cd\u9009\u62e9\uff1a<\/h2>\n<p>&#8211; \u53c2\u8003<\/p>\n<ul class=\"post-ul\">AppSync VS APIGateway \u4e21\u8005\u306e\u9055\u3044\u3092\u30b9\u30bf\u30fc\u30c8\u30a2\u30c3\u30d7CTO\u304c\u672c\u6c17\u3067\u8003\u3048\u3066\u307f\u305f\uff01<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>\u8003\u8651\u4f7f\u7528AWS AppSync\u65f6\uff0c\u53c2\u8003\u4e86\u3010AWS Black Belt Online Seminar\u3011\u5173\u4e8eAW [&hellip;]<\/p>\n","protected":false},"author":10,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-47587","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v21.5 (Yoast SEO v21.5) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u4f7f\u7528 Black Belt Online Seminar \u5b66\u4e60\u7684\u5185\u5bb9\uff0c\u5c06 AWS AppSync \u653e\u5728\u4e2d\u5fc3\uff0c\u8fdb\u884c\u603b\u7ed3 - Blog - Silicon Cloud<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.silicloud.com\/zh\/blog\/\u4f7f\u7528-black-belt-online-seminar-\u5b66\u4e60\u7684\u5185\u5bb9\uff0c\u5c06-aws-appsync-\u653e\u5728\u4e2d\u5fc3\uff0c\u8fdb\u884c\u603b\/\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u4f7f\u7528 Black Belt Online Seminar \u5b66\u4e60\u7684\u5185\u5bb9\uff0c\u5c06 AWS AppSync \u653e\u5728\u4e2d\u5fc3\uff0c\u8fdb\u884c\u603b\u7ed3\" \/>\n<meta property=\"og:description\" content=\"\u8003\u8651\u4f7f\u7528AWS AppSync\u65f6\uff0c\u53c2\u8003\u4e86\u3010AWS Black Belt Online Seminar\u3011\u5173\u4e8eAW [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.silicloud.com\/zh\/blog\/\u4f7f\u7528-black-belt-online-seminar-\u5b66\u4e60\u7684\u5185\u5bb9\uff0c\u5c06-aws-appsync-\u653e\u5728\u4e2d\u5fc3\uff0c\u8fdb\u884c\u603b\/\" \/>\n<meta property=\"og:site_name\" content=\"Blog - Silicon Cloud\" \/>\n<meta property=\"article:published_time\" content=\"2023-05-07T05:14:13+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-05-04T03:02:55+00:00\" \/>\n<meta name=\"author\" content=\"\u5b87, \u534e\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"\u5b87, \u534e\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e4%bd%bf%e7%94%a8-black-belt-online-seminar-%e5%ad%a6%e4%b9%a0%e7%9a%84%e5%86%85%e5%ae%b9%ef%bc%8c%e5%b0%86-aws-appsync-%e6%94%be%e5%9c%a8%e4%b8%ad%e5%bf%83%ef%bc%8c%e8%bf%9b%e8%a1%8c%e6%80%bb\/\",\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e4%bd%bf%e7%94%a8-black-belt-online-seminar-%e5%ad%a6%e4%b9%a0%e7%9a%84%e5%86%85%e5%ae%b9%ef%bc%8c%e5%b0%86-aws-appsync-%e6%94%be%e5%9c%a8%e4%b8%ad%e5%bf%83%ef%bc%8c%e8%bf%9b%e8%a1%8c%e6%80%bb\/\",\"name\":\"\u4f7f\u7528 Black Belt Online Seminar \u5b66\u4e60\u7684\u5185\u5bb9\uff0c\u5c06 AWS AppSync \u653e\u5728\u4e2d\u5fc3\uff0c\u8fdb\u884c\u603b\u7ed3 - Blog - Silicon Cloud\",\"isPartOf\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#website\"},\"datePublished\":\"2023-05-07T05:14:13+00:00\",\"dateModified\":\"2024-05-04T03:02:55+00:00\",\"author\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/513018e4e121d3add1b7c5de8be21458\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e4%bd%bf%e7%94%a8-black-belt-online-seminar-%e5%ad%a6%e4%b9%a0%e7%9a%84%e5%86%85%e5%ae%b9%ef%bc%8c%e5%b0%86-aws-appsync-%e6%94%be%e5%9c%a8%e4%b8%ad%e5%bf%83%ef%bc%8c%e8%bf%9b%e8%a1%8c%e6%80%bb\/#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.silicloud.com\/zh\/blog\/%e4%bd%bf%e7%94%a8-black-belt-online-seminar-%e5%ad%a6%e4%b9%a0%e7%9a%84%e5%86%85%e5%ae%b9%ef%bc%8c%e5%b0%86-aws-appsync-%e6%94%be%e5%9c%a8%e4%b8%ad%e5%bf%83%ef%bc%8c%e8%bf%9b%e8%a1%8c%e6%80%bb\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e4%bd%bf%e7%94%a8-black-belt-online-seminar-%e5%ad%a6%e4%b9%a0%e7%9a%84%e5%86%85%e5%ae%b9%ef%bc%8c%e5%b0%86-aws-appsync-%e6%94%be%e5%9c%a8%e4%b8%ad%e5%bf%83%ef%bc%8c%e8%bf%9b%e8%a1%8c%e6%80%bb\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.silicloud.com\/zh\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u4f7f\u7528 Black Belt Online Seminar \u5b66\u4e60\u7684\u5185\u5bb9\uff0c\u5c06 AWS AppSync \u653e\u5728\u4e2d\u5fc3\uff0c\u8fdb\u884c\u603b\u7ed3\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#website\",\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/\",\"name\":\"Blog - Silicon Cloud\",\"description\":\"\",\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/513018e4e121d3add1b7c5de8be21458\",\"name\":\"\u5b87, \u534e\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/63cd45cbc05a35fc4ff7637a163c83c4962ef58d27472726c3a3e0c9c5194f0f?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/63cd45cbc05a35fc4ff7637a163c83c4962ef58d27472726c3a3e0c9c5194f0f?s=96&d=mm&r=g\",\"caption\":\"\u5b87, \u534e\"},\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/author\/yuhua\/\"},{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e4%bd%bf%e7%94%a8-black-belt-online-seminar-%e5%ad%a6%e4%b9%a0%e7%9a%84%e5%86%85%e5%ae%b9%ef%bc%8c%e5%b0%86-aws-appsync-%e6%94%be%e5%9c%a8%e4%b8%ad%e5%bf%83%ef%bc%8c%e8%bf%9b%e8%a1%8c%e6%80%bb\/#local-main-organization-logo\",\"url\":\"\",\"contentUrl\":\"\",\"caption\":\"Blog - Silicon Cloud\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"\u4f7f\u7528 Black Belt Online Seminar \u5b66\u4e60\u7684\u5185\u5bb9\uff0c\u5c06 AWS AppSync \u653e\u5728\u4e2d\u5fc3\uff0c\u8fdb\u884c\u603b\u7ed3 - Blog - Silicon Cloud","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.silicloud.com\/zh\/blog\/\u4f7f\u7528-black-belt-online-seminar-\u5b66\u4e60\u7684\u5185\u5bb9\uff0c\u5c06-aws-appsync-\u653e\u5728\u4e2d\u5fc3\uff0c\u8fdb\u884c\u603b\/","og_locale":"zh_CN","og_type":"article","og_title":"\u4f7f\u7528 Black Belt Online Seminar \u5b66\u4e60\u7684\u5185\u5bb9\uff0c\u5c06 AWS AppSync \u653e\u5728\u4e2d\u5fc3\uff0c\u8fdb\u884c\u603b\u7ed3","og_description":"\u8003\u8651\u4f7f\u7528AWS AppSync\u65f6\uff0c\u53c2\u8003\u4e86\u3010AWS Black Belt Online Seminar\u3011\u5173\u4e8eAW [&hellip;]","og_url":"https:\/\/www.silicloud.com\/zh\/blog\/\u4f7f\u7528-black-belt-online-seminar-\u5b66\u4e60\u7684\u5185\u5bb9\uff0c\u5c06-aws-appsync-\u653e\u5728\u4e2d\u5fc3\uff0c\u8fdb\u884c\u603b\/","og_site_name":"Blog - Silicon Cloud","article_published_time":"2023-05-07T05:14:13+00:00","article_modified_time":"2024-05-04T03:02:55+00:00","author":"\u5b87, \u534e","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"\u5b87, \u534e","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"1 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.silicloud.com\/zh\/blog\/%e4%bd%bf%e7%94%a8-black-belt-online-seminar-%e5%ad%a6%e4%b9%a0%e7%9a%84%e5%86%85%e5%ae%b9%ef%bc%8c%e5%b0%86-aws-appsync-%e6%94%be%e5%9c%a8%e4%b8%ad%e5%bf%83%ef%bc%8c%e8%bf%9b%e8%a1%8c%e6%80%bb\/","url":"https:\/\/www.silicloud.com\/zh\/blog\/%e4%bd%bf%e7%94%a8-black-belt-online-seminar-%e5%ad%a6%e4%b9%a0%e7%9a%84%e5%86%85%e5%ae%b9%ef%bc%8c%e5%b0%86-aws-appsync-%e6%94%be%e5%9c%a8%e4%b8%ad%e5%bf%83%ef%bc%8c%e8%bf%9b%e8%a1%8c%e6%80%bb\/","name":"\u4f7f\u7528 Black Belt Online Seminar \u5b66\u4e60\u7684\u5185\u5bb9\uff0c\u5c06 AWS AppSync \u653e\u5728\u4e2d\u5fc3\uff0c\u8fdb\u884c\u603b\u7ed3 - Blog - Silicon Cloud","isPartOf":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/#website"},"datePublished":"2023-05-07T05:14:13+00:00","dateModified":"2024-05-04T03:02:55+00:00","author":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/513018e4e121d3add1b7c5de8be21458"},"breadcrumb":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/%e4%bd%bf%e7%94%a8-black-belt-online-seminar-%e5%ad%a6%e4%b9%a0%e7%9a%84%e5%86%85%e5%ae%b9%ef%bc%8c%e5%b0%86-aws-appsync-%e6%94%be%e5%9c%a8%e4%b8%ad%e5%bf%83%ef%bc%8c%e8%bf%9b%e8%a1%8c%e6%80%bb\/#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.silicloud.com\/zh\/blog\/%e4%bd%bf%e7%94%a8-black-belt-online-seminar-%e5%ad%a6%e4%b9%a0%e7%9a%84%e5%86%85%e5%ae%b9%ef%bc%8c%e5%b0%86-aws-appsync-%e6%94%be%e5%9c%a8%e4%b8%ad%e5%bf%83%ef%bc%8c%e8%bf%9b%e8%a1%8c%e6%80%bb\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.silicloud.com\/zh\/blog\/%e4%bd%bf%e7%94%a8-black-belt-online-seminar-%e5%ad%a6%e4%b9%a0%e7%9a%84%e5%86%85%e5%ae%b9%ef%bc%8c%e5%b0%86-aws-appsync-%e6%94%be%e5%9c%a8%e4%b8%ad%e5%bf%83%ef%bc%8c%e8%bf%9b%e8%a1%8c%e6%80%bb\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.silicloud.com\/zh\/blog\/"},{"@type":"ListItem","position":2,"name":"\u4f7f\u7528 Black Belt Online Seminar \u5b66\u4e60\u7684\u5185\u5bb9\uff0c\u5c06 AWS AppSync \u653e\u5728\u4e2d\u5fc3\uff0c\u8fdb\u884c\u603b\u7ed3"}]},{"@type":"WebSite","@id":"https:\/\/www.silicloud.com\/zh\/blog\/#website","url":"https:\/\/www.silicloud.com\/zh\/blog\/","name":"Blog - Silicon Cloud","description":"","inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/513018e4e121d3add1b7c5de8be21458","name":"\u5b87, \u534e","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/63cd45cbc05a35fc4ff7637a163c83c4962ef58d27472726c3a3e0c9c5194f0f?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/63cd45cbc05a35fc4ff7637a163c83c4962ef58d27472726c3a3e0c9c5194f0f?s=96&d=mm&r=g","caption":"\u5b87, \u534e"},"url":"https:\/\/www.silicloud.com\/zh\/blog\/author\/yuhua\/"},{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.silicloud.com\/zh\/blog\/%e4%bd%bf%e7%94%a8-black-belt-online-seminar-%e5%ad%a6%e4%b9%a0%e7%9a%84%e5%86%85%e5%ae%b9%ef%bc%8c%e5%b0%86-aws-appsync-%e6%94%be%e5%9c%a8%e4%b8%ad%e5%bf%83%ef%bc%8c%e8%bf%9b%e8%a1%8c%e6%80%bb\/#local-main-organization-logo","url":"","contentUrl":"","caption":"Blog - Silicon Cloud"}]}},"_links":{"self":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/47587","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/users\/10"}],"replies":[{"embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/comments?post=47587"}],"version-history":[{"count":2,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/47587\/revisions"}],"predecessor-version":[{"id":97939,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/47587\/revisions\/97939"}],"wp:attachment":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/media?parent=47587"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/categories?post=47587"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/tags?post=47587"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}