id
stringlengths
8
78
source
stringclasses
743 values
chunk_id
int64
1
5.05k
text
stringlengths
593
49.7k
apigateway-dg-252
apigateway-dg.pdf
252
SHA1: D6:9B:56:11:48:F0:1C:77:C5:45:78:C1:09:26:DF:5B:85:69:76:AD SHA256: CB:B5:22:D7:B7:F1:27:AD:6A:01:13:86:5B:DF:1C:D4:10:2E:7D:07:59:AF:63:5A:7C:F4:72:0D:C9:63:C5:3B Alias name: globalsignrootca SHA1: B1:BC:96:8B:D4:F4:9D:62:2A:A8:9A:81:F2:15:01:52:A4:1D:82:9C SHA256: EB:D4:10:40:E4:BB:3E:C7:42:C9:E3:81:D3:1E:F2:A4:1A:48:B6:68:5C:96:E7:CE:F3:C1:DF:6C:D4:33:1C:99 Alias name: globalsignrootcar2 SHA1: 75:E0:AB:B6:13:85:12:27:1C:04:F8:5F:DD:DE:38:E4:B7:24:2E:FE SHA256: CA:42:DD:41:74:5F:D0:B8:1E:B9:02:36:2C:F9:D8:BF:71:9D:A1:BD:1B:1E:FC:94:6F:5B:4C:99:F4:2C:1B:9E Alias name: globalsignrootcar3 SHA1: D6:9B:56:11:48:F0:1C:77:C5:45:78:C1:09:26:DF:5B:85:69:76:AD SHA256: CB:B5:22:D7:B7:F1:27:AD:6A:01:13:86:5B:DF:1C:D4:10:2E:7D:07:59:AF:63:5A:7C:F4:72:0D:C9:63:C5:3B Alias name: globalsignrootcar6 SHA1: 80:94:64:0E:B5:A7:A1:CA:11:9C:1F:DD:D5:9F:81:02:63:A7:FB:D1 Client certificates 931 Amazon API Gateway SHA256: Developer Guide 2C:AB:EA:FE:37:D0:6C:A2:2A:BA:73:91:C0:03:3D:25:98:29:52:C4:53:64:73:49:76:3A:3A:B5:AD:6C:CF:69 Alias name: godaddyclass2ca SHA1: 27:96:BA:E6:3F:18:01:E2:77:26:1B:A0:D7:77:70:02:8F:20:EE:E4 SHA256: C3:84:6B:F2:4B:9E:93:CA:64:27:4C:0E:C6:7C:1E:CC:5E:02:4F:FC:AC:D2:D7:40:19:35:0E:81:FE:54:6A:E4 Alias name: godaddyrootcertificateauthorityg2 SHA1: 47:BE:AB:C9:22:EA:E8:0E:78:78:34:62:A7:9F:45:C2:54:FD:E6:8B SHA256: 45:14:0B:32:47:EB:9C:C8:C5:B4:F0:D7:B5:30:91:F7:32:92:08:9E:6E:5A:63:E2:74:9D:D3:AC:A9:19:8E:DA Alias name: godaddyrootg2ca SHA1: 47:BE:AB:C9:22:EA:E8:0E:78:78:34:62:A7:9F:45:C2:54:FD:E6:8B SHA256: 45:14:0B:32:47:EB:9C:C8:C5:B4:F0:D7:B5:30:91:F7:32:92:08:9E:6E:5A:63:E2:74:9D:D3:AC:A9:19:8E:DA Alias name: gtsrootr1 SHA1: E1:C9:50:E6:EF:22:F8:4C:56:45:72:8B:92:20:60:D7:D5:A7:A3:E8 SHA256: 2A:57:54:71:E3:13:40:BC:21:58:1C:BD:2C:F1:3E:15:84:63:20:3E:CE:94:BC:F9:D3:CC:19:6B:F0:9A:54:72 Alias name: gtsrootr2 SHA1: D2:73:96:2A:2A:5E:39:9F:73:3F:E1:C7:1E:64:3F:03:38:34:FC:4D SHA256: C4:5D:7B:B0:8E:6D:67:E6:2E:42:35:11:0B:56:4E:5F:78:FD:92:EF:05:8C:84:0A:EA:4E:64:55:D7:58:5C:60 Alias name: gtsrootr3 SHA1: 30:D4:24:6F:07:FF:DB:91:89:8A:0B:E9:49:66:11:EB:8C:5E:46:E5 SHA256: 15:D5:B8:77:46:19:EA:7D:54:CE:1C:A6:D0:B0:C4:03:E0:37:A9:17:F1:31:E8:A0:4E:1E:6B:7A:71:BA:BC:E5 Alias name: gtsrootr4 SHA1: 2A:1D:60:27:D9:4A:B1:0A:1C:4D:91:5C:CD:33:A0:CB:3E:2D:54:CB SHA256: 71:CC:A5:39:1F:9E:79:4B:04:80:25:30:B3:63:E1:21:DA:8A:30:43:BB:26:66:2F:EA:4D:CA:7F:C9:51:A4:BD Alias name: hellenicacademicandresearchinstitutionseccrootca2015 SHA1: 9F:F1:71:8D:92:D5:9A:F3:7D:74:97:B4:BC:6F:84:68:0B:BA:B6:66 SHA256: 44:B5:45:AA:8A:25:E6:5A:73:CA:15:DC:27:FC:36:D2:4C:1C:B9:95:3A:06:65:39:B1:15:82:DC:48:7B:48:33 Alias name: hellenicacademicandresearchinstitutionsrootca2011 SHA1: FE:45:65:9B:79:03:5B:98:A1:61:B5:51:2E:AC:DA:58:09:48:22:4D SHA256: BC:10:4F:15:A4:8B:E7:09:DC:A5:42:A7:E1:D4:B9:DF:6F:05:45:27:E8:02:EA:A9:2D:59:54:44:25:8A:FE:71 Alias name: hellenicacademicandresearchinstitutionsrootca2015 SHA1: 01:0C:06:95:A6:98:19:14:FF:BF:5F:C6:B0:B6:95:EA:29:E9:12:A6 SHA256: A0:40:92:9A:02:CE:53:B4:AC:F4:F2:FF:C6:98:1C:E4:49:6F:75:5E:6D:45:FE:0B:2A:69:2B:CD:52:52:3F:36 Alias name: hongkongpostrootca1 SHA1: D6:DA:A8:20:8D:09:D2:15:4D:24:B5:2F:CB:34:6E:B2:58:B2:8A:58 Client certificates 932 Amazon API Gateway SHA256: Developer Guide F9:E6:7D:33:6C:51:00:2A:C0:54:C6:32:02:2D:66:DD:A2:E7:E3:FF:F1:0A:D0:61:ED:31:D8:BB:B4:10:CF:B2 Alias name: hongkongpostrootca3 SHA1: 58:A2:D0:EC:20:52:81:5B:C1:F3:F8:64:02:24:4E:C2:8E:02:4B:02 SHA256: 5A:2F:C0:3F:0C:83:B0:90:BB:FA:40:60:4B:09:88:44:6C:76:36:18:3D:F9:84:6E:17:10:1A:44:7F:B8:EF:D6 Alias name: identrustcommercialrootca1 SHA1: DF:71:7E:AA:4A:D9:4E:C9:55:84:99:60:2D:48:DE:5F:BC:F0:3A:25 SHA256: 5D:56:49:9B:E4:D2:E0:8B:CF:CA:D0:8A:3E:38:72:3D:50:50:3B:DE:70:69:48:E4:2F:55:60:30:19:E5:28:AE Alias name: identrustpublicsectorrootca1 SHA1: BA:29:41:60:77:98:3F:F4:F3:EF:F2:31:05:3B:2E:EA:6D:4D:45:FD SHA256: 30:D0:89:5A:9A:44:8A:26:20:91:63:55:22:D1:F5:20:10:B5:86:7A:CA:E1:2C:78:EF:95:8F:D4:F4:38:9F:2F Alias name: isrgrootx1 SHA1: CA:BD:2A:79:A1:07:6A:31:F2:1D:25:36:35:CB:03:9D:43:29:A5:E8 SHA256: 96:BC:EC:06:26:49:76:F3:74:60:77:9A:CF:28:C5:A7:CF:E8:A3:C0:AA:E1:1A:8F:FC:EE:05:C0:BD:DF:08:C6 Alias name: izenpecom SHA1: 2F:78:3D:25:52:18:A7:4A:65:39:71:B5:2C:A2:9C:45:15:6F:E9:19 SHA256: 25:30:CC:8E:98:32:15:02:BA:D9:6F:9B:1F:BA:1B:09:9E:2D:29:9E:0F:45:48:BB:91:4F:36:3B:C0:D4:53:1F Alias name: keynectisrootca SHA1: 9C:61:5C:4D:4D:85:10:3A:53:26:C2:4D:BA:EA:E4:A2:D2:D5:CC:97 SHA256: 42:10:F1:99:49:9A:9A:C3:3C:8D:E0:2B:A6:DB:AA:14:40:8B:DD:8A:6E:32:46:89:C1:92:2D:06:97:15:A3:32 Alias name: microseceszignorootca2009 SHA1: 89:DF:74:FE:5C:F4:0F:4A:80:F9:E3:37:7D:54:DA:91:E1:01:31:8E SHA256: 3C:5F:81:FE:A5:FA:B8:2C:64:BF:A2:EA:EC:AF:CD:E8:E0:77:FC:86:20:A7:CA:E5:37:16:3D:F3:6E:DB:F3:78 Alias name: mozillacert0.pem SHA1: 97:81:79:50:D8:1C:96:70:CC:34:D8:09:CF:79:44:31:36:7E:F4:74 SHA256: A5:31:25:18:8D:21:10:AA:96:4B:02:C7:B7:C6:DA:32:03:17:08:94:E5:FB:71:FF:FB:66:67:D5:E6:81:0A:36 Alias name: mozillacert1.pem SHA1: 23:E5:94:94:51:95:F2:41:48:03:B4:D5:64:D2:A3:A3:F5:D8:8B:8C SHA256: B4:41:0B:73:E2:E6:EA:CA:47:FB:C4:2F:8F:A4:01:8A:F4:38:1D:C5:4C:FA:A8:44:50:46:1E:ED:09:45:4D:E9 Alias name: mozillacert10.pem SHA1: 5F:3A:FC:0A:8B:64:F6:86:67:34:74:DF:7E:A9:A2:FE:F9:FA:7A:51 SHA256: 21:DB:20:12:36:60:BB:2E:D4:18:20:5D:A1:1E:E7:A8:5A:65:E2:BC:6E:55:B5:AF:7E:78:99:C8:A2:66:D9:2E Alias name: mozillacert100.pem SHA1: 58:E8:AB:B0:36:15:33:FB:80:F7:9B:1B:6D:29:D3:FF:8D:5F:00:F0 Client certificates 933 Amazon API Gateway SHA256: Developer Guide 49:E7:A4:42:AC:F0:EA:62:87:05:00:54:B5:25:64:B6:50:E4:F4:9E:42:E3:48:D6:AA:38:E0:39:E9:57:B1:C1 Alias name: mozillacert101.pem SHA1: 99:A6:9B:E6:1A:FE:88:6B:4D:2B:82:00:7C:B8:54:FC:31:7E:15:39 SHA256: 62:F2:40:27:8C:56:4C:4D:D8:BF:7D:9D:4F:6F:36:6E:A8:94:D2:2F:5F:34:D9:89:A9:83:AC:EC:2F:FF:ED:50 Alias name: mozillacert102.pem SHA1: 96:C9:1B:0B:95:B4:10:98:42:FA:D0:D8:22:79:FE:60:FA:B9:16:83 SHA256: EE:C5:49:6B:98:8C:E9:86:25:B9:34:09:2E:EC:29:08:BE:D0:B0:F3:16:C2:D4:73:0C:84:EA:F1:F3:D3:48:81 Alias name: mozillacert103.pem SHA1: 70:C1:8D:74:B4:28:81:0A:E4:FD:A5:75:D7:01:9F:99:B0:3D:50:74 SHA256: 3C:FC:3C:14:D1:F6:84:FF:17:E3:8C:43:CA:44:0C:00:B9:67:EC:93:3E:8B:FE:06:4C:A1:D7:2C:90:F2:AD:B0 Alias name: mozillacert104.pem SHA1: 4F:99:AA:93:FB:2B:D1:37:26:A1:99:4A:CE:7F:F0:05:F2:93:5D:1E SHA256: 1C:01:C6:F4:DB:B2:FE:FC:22:55:8B:2B:CA:32:56:3F:49:84:4A:CF:C3:2B:7B:E4:B0:FF:59:9F:9E:8C:7A:F7 Alias name: mozillacert105.pem SHA1: 77:47:4F:C6:30:E4:0F:4C:47:64:3F:84:BA:B8:C6:95:4A:8A:41:EC SHA256: F0:9B:12:2C:71:14:F4:A0:9B:D4:EA:4F:4A:99:D5:58:B4:6E:4C:25:CD:81:14:0D:29:C0:56:13:91:4C:38:41 Alias name: mozillacert106.pem SHA1: E7:A1:90:29:D3:D5:52:DC:0D:0F:C6:92:D3:EA:88:0D:15:2E:1A:6B SHA256: D9:5F:EA:3C:A4:EE:DC:E7:4C:D7:6E:75:FC:6D:1F:F6:2C:44:1F:0F:A8:BC:77:F0:34:B1:9E:5D:B2:58:01:5D Alias name: mozillacert107.pem SHA1: 8E:1C:74:F8:A6:20:B9:E5:8A:F4:61:FA:EC:2B:47:56:51:1A:52:C6 SHA256: F9:6F:23:F4:C3:E7:9C:07:7A:46:98:8D:5A:F5:90:06:76:A0:F0:39:CB:64:5D:D1:75:49:B2:16:C8:24:40:CE Alias name: mozillacert108.pem SHA1: B1:BC:96:8B:D4:F4:9D:62:2A:A8:9A:81:F2:15:01:52:A4:1D:82:9C SHA256: EB:D4:10:40:E4:BB:3E:C7:42:C9:E3:81:D3:1E:F2:A4:1A:48:B6:68:5C:96:E7:CE:F3:C1:DF:6C:D4:33:1C:99 Alias name: mozillacert109.pem SHA1: B5:61:EB:EA:A4:DE:E4:25:4B:69:1A:98:A5:57:47:C2:34:C7:D9:71 SHA256: E2:3D:4A:03:6D:7B:70:E9:F5:95:B1:42:20:79:D2:B9:1E:DF:BB:1F:B6:51:A0:63:3E:AA:8A:9D:C5:F8:07:03 Alias name: mozillacert11.pem SHA1: 05:63:B8:63:0D:62:D7:5A:BB:C8:AB:1E:4B:DF:B5:A8:99:B2:4D:43 SHA256: 3E:90:99:B5:01:5E:8F:48:6C:00:BC:EA:9D:11:1E:E7:21:FA:BA:35:5A:89:BC:F1:DF:69:56:1E:3D:C6:32:5C Alias name: mozillacert110.pem SHA1: 93:05:7A:88:15:C6:4F:CE:88:2F:FA:91:16:52:28:78:BC:53:64:17 Client certificates 934 Amazon API Gateway SHA256: Developer Guide 9A:6E:C0:12:E1:A7:DA:9D:BE:34:19:4D:47:8A:D7:C0:DB:18:22:FB:07:1D:F1:29:81:49:6E:D1:04:38:41:13 Alias name: mozillacert111.pem SHA1: 9C:BB:48:53:F6:A4:F6:D3:52:A4:E8:32:52:55:60:13:F5:AD:AF:65 SHA256: 59:76:90:07:F7:68:5D:0F:CD:50:87:2F:9F:95:D5:75:5A:5B:2B:45:7D:81:F3:69:2B:61:0A:98:67:2F:0E:1B Alias name: mozillacert112.pem SHA1: 43:13:BB:96:F1:D5:86:9B:C1:4E:6A:92:F6:CF:F6:34:69:87:82:37 SHA256: DD:69:36:FE:21:F8:F0:77:C1:23:A1:A5:21:C1:22:24:F7:22:55:B7:3E:03:A7:26:06:93:E8:A2:4B:0F:A3:89 Alias name: mozillacert113.pem SHA1: 50:30:06:09:1D:97:D4:F5:AE:39:F7:CB:E7:92:7D:7D:65:2D:34:31 SHA256: 6D:C4:71:72:E0:1C:BC:B0:BF:62:58:0D:89:5F:E2:B8:AC:9A:D4:F8:73:80:1E:0C:10:B9:C8:37:D2:1E:B1:77 Alias name: mozillacert114.pem SHA1: 51:C6:E7:08:49:06:6E:F3:92:D4:5C:A0:0D:6D:A3:62:8F:C3:52:39 SHA256: B0:BF:D5:2B:B0:D7:D9:BD:92:BF:5D:4D:C1:3D:A2:55:C0:2C:54:2F:37:83:65:EA:89:39:11:F5:5E:55:F2:3C Alias name: mozillacert115.pem SHA1: 59:0D:2D:7D:88:4F:40:2E:61:7E:A5:62:32:17:65:CF:17:D8:94:E9 SHA256: 91:E2:F5:78:8D:58:10:EB:A7:BA:58:73:7D:E1:54:8A:8E:CA:CD:01:45:98:BC:0B:14:3E:04:1B:17:05:25:52 Alias name: mozillacert116.pem SHA1: 2B:B1:F5:3E:55:0C:1D:C5:F1:D4:E6:B7:6A:46:4B:55:06:02:AC:21 SHA256: F3:56:BE:A2:44:B7:A9:1E:B3:5D:53:CA:9A:D7:86:4A:CE:01:8E:2D:35:D5:F8:F9:6D:DF:68:A6:F4:1A:A4:74 Alias name: mozillacert117.pem SHA1: D4:DE:20:D0:5E:66:FC:53:FE:1A:50:88:2C:78:DB:28:52:CA:E4:74 SHA256: 16:AF:57:A9:F6:76:B0:AB:12:60:95:AA:5E:BA:DE:F2:2A:B3:11:19:D6:44:AC:95:CD:4B:93:DB:F3:F2:6A:EB Alias name: mozillacert118.pem SHA1: 7E:78:4A:10:1C:82:65:CC:2D:E1:F1:6D:47:B4:40:CA:D9:0A:19:45 SHA256: 5F:0B:62:EA:B5:E3:53:EA:65:21:65:16:58:FB:B6:53:59:F4:43:28:0A:4A:FB:D1:04:D7:7D:10:F9:F0:4C:07 Alias name: mozillacert119.pem SHA1: 75:E0:AB:B6:13:85:12:27:1C:04:F8:5F:DD:DE:38:E4:B7:24:2E:FE SHA256: CA:42:DD:41:74:5F:D0:B8:1E:B9:02:36:2C:F9:D8:BF:71:9D:A1:BD:1B:1E:FC:94:6F:5B:4C:99:F4:2C:1B:9E Alias name: mozillacert12.pem SHA1: A8:98:5D:3A:65:E5:E5:C4:B2:D7:D6:6D:40:C6:DD:2F:B1:9C:54:36 SHA256: 43:48:A0:E9:44:4C:78:CB:26:5E:05:8D:5E:89:44:B4:D8:4F:96:62:BD:26:DB:25:7F:89:34:A4:43:C7:01:61 Alias name: mozillacert120.pem SHA1: DA:40:18:8B:91:89:A3:ED:EE:AE:DA:97:FE:2F:9D:F5:B7:D1:8A:41 Client certificates 935 Amazon API Gateway SHA256: Developer Guide CF:56:FF:46:A4:A1:86:10:9D:D9:65:84:B5:EE:B5:8A:51:0C:42:75:B0:E5:F9:4F:40:BB:AE:86:5E:19:F6:73 Alias name: mozillacert121.pem SHA1: CC:AB:0E:A0:4C:23:01:D6:69:7B:DD:37:9F:CD:12:EB:24:E3:94:9D SHA256: 8C:72:09:27:9A:C0:4E:27:5E:16:D0:7F:D3:B7:75:E8:01:54:B5:96:80:46:E3:1F:52:DD:25:76:63:24:E9:A7 Alias name: mozillacert122.pem SHA1: 02:FA:F3:E2:91:43:54:68:60:78:57:69:4D:F5:E4:5B:68:85:18:68 SHA256: 68:7F:A4:51:38:22:78:FF:F0:C8:B1:1F:8D:43:D5:76:67:1C:6E:B2:BC:EA:B4:13:FB:83:D9:65:D0:6D:2F:F2 Alias name: mozillacert123.pem SHA1: 2A:B6:28:48:5E:78:FB:F3:AD:9E:79:10:DD:6B:DF:99:72:2C:96:E5 SHA256: 07:91:CA:07:49:B2:07:82:AA:D3:C7:D7:BD:0C:DF:C9:48:58:35:84:3E:B2:D7:99:60:09:CE:43:AB:6C:69:27 Alias name: mozillacert124.pem SHA1: 4D:23:78:EC:91:95:39:B5:00:7F:75:8F:03:3B:21:1E:C5:4D:8B:CF SHA256: 80:95:21:08:05:DB:4B:BC:35:5E:44:28:D8:FD:6E:C2:CD:E3:AB:5F:B9:7A:99:42:98:8E:B8:F4:DC:D0:60:16 Alias name: mozillacert125.pem SHA1: B3:1E:B1:B7:40:E3:6C:84:02:DA:DC:37:D4:4D:F5:D4:67:49:52:F9 SHA256: 73:C1:76:43:4F:1B:C6:D5:AD:F4:5B:0E:76:E7:27:28:7C:8D:E5:76:16:C1:E6:E6:14:1A:2B:2C:BC:7D:8E:4C Alias name: mozillacert126.pem SHA1: 25:01:90:19:CF:FB:D9:99:1C:B7:68:25:74:8D:94:5F:30:93:95:42 SHA256: AF:8B:67:62:A1:E5:28:22:81:61:A9:5D:5C:55:9E:E2:66:27:8F:75:D7:9E:83:01:89:A5:03:50:6A:BD:6B:4C Alias name: mozillacert127.pem SHA1: DE:28:F4:A4:FF:E5:B9:2F:A3:C5:03:D1:A3:49:A7:F9:96:2A:82:12 SHA256: FF:85:6A:2D:25:1D:CD:88:D3:66:56:F4:50:12:67:98:CF:AB:AA:DE:40:79:9C:72:2D:E4:D2:B5:DB:36:A7:3A Alias name: mozillacert128.pem SHA1: A9:E9:78:08:14:37:58:88:F2:05:19:B0:6D:2B:0D:2B:60:16:90:7D SHA256: CA:2D:82:A0:86:77:07:2F:8A:B6:76:4F:F0:35:67:6C:FE:3E:5E:32:5E:01:21:72:DF:3F:92:09:6D:B7:9B:85 Alias name: mozillacert129.pem SHA1: E6:21:F3:35:43:79:05:9A:4B:68:30:9D:8A:2F:74:22:15:87:EC:79 SHA256: A0:45:9B:9F:63:B2:25:59:F5:FA:5D:4C:6D:B3:F9:F7:2F:F1:93:42:03:35:78:F0:73:BF:1D:1B:46:CB:B9:12 Alias name: mozillacert13.pem SHA1: 06:08:3F:59:3F:15:A1:04:A0:69:A4:6B:A9:03:D0:06:B7:97:09:91 SHA256: 6C:61:DA:C3:A2:DE:F0:31:50:6B:E0:36:D2:A6:FE:40:19:94:FB:D1:3D:F9:C8:D4:66:59:92:74:C4:46:EC:98 Alias name: mozillacert130.pem SHA1: E5:DF:74:3C:B6:01:C4:9B:98:43:DC:AB:8C:E8:6A:81:10:9F:E4:8E Client certificates 936 Amazon API Gateway SHA256: Developer Guide F4:C1:49:55:1A:30:13:A3:5B:C7:BF:FE:17:A7:F3:44:9B:C1:AB:5B:5A:0A:E7:4B:06:C2:3B:90:00:4C:01:04 Alias name: mozillacert131.pem SHA1: 37:9A:19:7B:41:85:45:35:0C:A6:03:69:F3:3C:2E:AF:47:4F:20:79 SHA256: A0:23:4F:3B:C8:52:7C:A5:62:8E:EC:81:AD:5D:69:89:5D:A5:68:0D:C9:1D:1C:B8:47:7F:33:F8:78:B9:5B:0B Alias name: mozillacert132.pem SHA1: 39:21:C1:15:C1:5D:0E:CA:5C:CB:5B:C4:F0:7D:21:D8:05:0B:56:6A SHA256: 77:40:73:12:C6:3A:15:3D:5B:C0:0B:4E:51:75:9C:DF:DA:C2:37:DC:2A:33:B6:79:46:E9:8E:9B:FA:68:0A:E3 Alias name: mozillacert133.pem SHA1: 85:B5:FF:67:9B:0C:79:96:1F:C8:6E:44:22:00:46:13:DB:17:92:84 SHA256: 7D:3B:46:5A:60:14:E5:26:C0:AF:FC:EE:21:27:D2:31:17:27:AD:81:1C:26:84:2D:00:6A:F3:73:06:CC:80:BD Alias name: mozillacert134.pem SHA1: 70:17:9B:86:8C:00:A4:FA:60:91:52:22:3F:9F:3E:32:BD:E0:05:62 SHA256: 69:FA:C9:BD:55:FB:0A:C7:8D:53:BB:EE:5C:F1:D5:97:98:9F:D0:AA:AB:20:A2:51:51:BD:F1:73:3E:E7:D1:22 Alias name: mozillacert135.pem SHA1: 62:52:DC:40:F7:11:43:A2:2F:DE:9E:F7:34:8E:06:42:51:B1:81:18 SHA256: D8:E0:FE:BC:1D:B2:E3:8D:00:94:0F:37:D2:7D:41:34:4D:99:3E:73:4B:99:D5:65:6D:97:78:D4:D8:14:36:24 Alias name: mozillacert136.pem SHA1: D1:EB:23:A4:6D:17:D6:8F:D9:25:64:C2:F1:F1:60:17:64:D8:E3:49 SHA256: D7:A7:A0:FB:5D:7E:27:31:D7:71:E9:48:4E:BC:DE:F7:1D:5F:0C:3E:0A:29:48:78:2B:C8:3E:E0:EA:69:9E:F4 Alias name: mozillacert137.pem SHA1: 4A:65:D5:F4:1D:EF:39:B8:B8:90:4A:4A:D3:64:81:33:CF:C7:A1:D1 SHA256: BD:81:CE:3B:4F:65:91:D1:1A:67:B5:FC:7A:47:FD:EF:25:52:1B:F9:AA:4E:18:B9:E3:DF:2E:34:A7:80:3B:E8 Alias name: mozillacert138.pem SHA1: E1:9F:E3:0E:8B:84:60:9E:80:9B:17:0D:72:A8:C5:BA:6E:14:09:BD SHA256: 3F:06:E5:56:81:D4:96:F5:BE:16:9E:B5:38:9F:9F:2B:8F:F6:1E:17:08:DF:68:81:72:48:49:CD:5D:27:CB:69 Alias name: mozillacert139.pem SHA1: DE:3F:40:BD:50:93:D3:9B:6C:60:F6:DA:BC:07:62:01:00:89:76:C9 SHA256: A4:5E:DE:3B:BB:F0:9C:8A:E1:5C:72:EF:C0:72:68:D6:93:A2:1C:99:6F:D5:1E:67:CA:07:94:60:FD:6D:88:73 Alias name: mozillacert14.pem SHA1: 5F:B7:EE:06:33:E2:59:DB:AD:0C:4C:9A:E6:D3:8F:1A:61:C7:DC:25 SHA256: 74:31:E5:F4:C3:C1:CE:46:90:77:4F:0B:61:E0:54:40:88:3B:A9:A0:1E:D0:0B:A6:AB:D7:80:6E:D3:B1:18:CF Alias name: mozillacert140.pem SHA1: CA:3A:FB:CF:12:40:36:4B:44:B2:16:20:88:80:48:39:19:93:7C:F7 Client certificates 937 Amazon API Gateway SHA256: Developer Guide 85:A0:DD:7D:D7:20:AD:B7:FF:05:F8:3D:54:2B:20:9D:C7:FF:45:28:F7:D6:77:B1:83:89:FE:A5:E5:C4:9E:86 Alias name: mozillacert141.pem SHA1: 31:7A:2A:D0:7F:2B:33:5E:F5:A1:C3:4E:4B:57:E8:B7:D8:F1:FC:A6 SHA256: 58:D0:17:27:9C:D4:DC:63:AB:DD:B1:96:A6:C9:90:6C:30:C4:E0:87:83:EA:E8:C1:60:99:54:D6:93:55:59:6B Alias name: mozillacert142.pem SHA1: 1F:49:14:F7:D8:74:95:1D:DD:AE:02:C0:BE:FD:3A:2D:82:75:51:85 SHA256: 18:F1:FC:7F:20:5D:F8:AD:DD:EB:7F:E0:07:DD:57:E3:AF:37:5A:9C:4D:8D:73:54:6B:F4:F1:FE:D1:E1:8D:35 Alias name: mozillacert143.pem SHA1: 36:B1:2B:49:F9:81:9E:D7:4C:9E:BC:38:0F:C6:56:8F:5D:AC:B2:F7 SHA256: E7:5E:72:ED:9F:56:0E:EC:6E:B4:80:00:73:A4:3F:C3:AD:19:19:5A:39:22:82:01:78:95:97:4A:99:02:6B:6C Alias name: mozillacert144.pem SHA1: 37:F7:6D:E6:07:7C:90:C5:B1:3E:93:1A:B7:41:10:B4:F2:E4:9A:27 SHA256: 79:08:B4:03:14:C1:38:10:0B:51:8D:07:35:80:7F:FB:FC:F8:51:8A:00:95:33:71:05:BA:38:6B:15:3D:D9:27 Alias name: mozillacert145.pem SHA1: 10:1D:FA:3F:D5:0B:CB:BB:9B:B5:60:0C:19:55:A4:1A:F4:73:3A:04 SHA256: D4:1D:82:9E:8C:16:59:82:2A:F9:3F:CE:62:BF:FC:DE:26:4F:C8:4E:8B:95:0C:5F:F2:75:D0:52:35:46:95:A3 Alias name: mozillacert146.pem SHA1: 21:FC:BD:8E:7F:6C:AF:05:1B:D1:B3:43:EC:A8:E7:61:47:F2:0F:8A SHA256: 48:98:C6:88:8C:0C:FF:B0:D3:E3:1A:CA:8A:37:D4:E3:51:5F:F7:46:D0:26:35:D8:66:46:CF:A0:A3:18:5A:E7 Alias name: mozillacert147.pem SHA1: 58:11:9F:0E:12:82:87:EA:50:FD:D9:87:45:6F:4F:78:DC:FA:D6:D4 SHA256: 85:FB:2F:91:DD:12:27:5A:01:45:B6:36:53:4F:84:02:4A:D6:8B:69:B8:EE:88:68:4F:F7:11:37:58:05:B3:48 Alias name: mozillacert148.pem SHA1: 04:83:ED:33:99:AC:36:08:05:87:22:ED:BC:5E:46:00:E3:BE:F9:D7 SHA256: 6E:A5:47:41:D0:04:66:7E:ED:1B:48:16:63:4A:A3:A7:9E:6E:4B:96:95:0F:82:79:DA:FC:8D:9B:D8:81:21:37 Alias name: mozillacert149.pem SHA1: 6E:3A:55:A4:19:0C:19:5C:93:84:3C:C0:DB:72:2E:31:30:61:F0:B1 SHA256: 0C:25:8A:12:A5:67:4A:EF:25:F2:8B:A7:DC:FA:EC:EE:A3:48:E5:41:E6:F5:CC:4E:E6:3B:71:B3:61:60:6A:C3 Alias name: mozillacert15.pem SHA1: 74:20:74:41:72:9C:DD:92:EC:79:31:D8:23:10:8D:C2:81:92:E2:BB SHA256: 0F:99:3C:8A:EF:97:BA:AF:56:87:14:0E:D5:9A:D1:82:1B:B4:AF:AC:F0:AA:9A:58:B5:D5:7A:33:8A:3A:FB:CB Alias name: mozillacert150.pem SHA1: 33:9B:6B:14:50:24:9B:55:7A:01:87:72:84:D9:E0:2F:C3:D2:D8:E9 Client certificates 938 Amazon API Gateway SHA256: Developer Guide EF:3C:B4:17:FC:8E:BF:6F:97:87:6C:9E:4E:CE:39:DE:1E:A5:FE:64:91:41:D1:02:8B:7D:11:C0:B2:29:8C:ED Alias name: mozillacert151.pem SHA1: AC:ED:5F:65:53:FD:25:CE:01:5F:1F:7A:48:3B:6A:74:9F:61:78:C6 SHA256: 7F:12:CD:5F:7E:5E:29:0E:C7:D8:51:79:D5:B7:2C:20:A5:BE:75:08:FF:DB:5B:F8:1A:B9:68:4A:7F:C9:F6:67 Alias name: mozillacert16.pem SHA1: DA:C9:02:4F:54:D8:F6:DF:94:93:5F:B1:73:26:38:CA:6A:D7:7C:13 SHA256: 06:87:26:03:31:A7:24:03:D9:09:F1:05:E6:9B:CF:0D:32:E1:BD:24:93:FF:C6:D9:20:6D:11:BC:D6:77:07:39 Alias name: mozillacert17.pem SHA1: 40:54:DA:6F:1C:3F:40:74:AC:ED:0F:EC:CD:DB:79:D1:53:FB:90:1D SHA256: 76:7C:95:5A:76:41:2C:89:AF:68:8E:90:A1:C7:0F:55:6C:FD:6B:60:25:DB:EA:10:41:6D:7E:B6:83:1F:8C:40 Alias name: mozillacert18.pem SHA1: 79:98:A3:08:E1:4D:65:85:E6:C2:1E:15:3A:71:9F:BA:5A:D3:4A:D9 SHA256: 44:04:E3:3B:5E:14:0D:CF:99:80:51:FD:FC:80:28:C7:C8:16:15:C5:EE:73:7B:11:1B:58:82:33:A9:B5:35:A0 Alias name: mozillacert19.pem SHA1: B4:35:D4:E1:11:9D:1C:66:90:A7:49:EB:B3:94:BD:63:7B:A7:82:B7 SHA256: C4:70:CF:54:7E:23:02:B9:77:FB:29:DD:71:A8:9A:7B:6C:1F:60:77:7B:03:29:F5:60:17:F3:28:BF:4F:6B:E6 Alias name: mozillacert2.pem SHA1: 22:D5:D8:DF:8F:02:31:D1:8D:F7:9D:B7:CF:8A:2D:64:C9:3F:6C:3A SHA256: 69:DD:D7:EA:90:BB:57:C9:3E:13:5D:C8:5E:A6:FC:D5:48:0B:60:32:39:BD:C4:54:FC:75:8B:2A:26:CF:7F:79 Alias name: mozillacert20.pem SHA1: D8:C5:38:8A:B7:30:1B:1B:6E:D4:7A:E6:45:25:3A:6F:9F:1A:27:61 SHA256: 62:DD:0B:E9:B9:F5:0A:16:3E:A0:F8:E7:5C:05:3B:1E:CA:57:EA:55:C8:68:8F:64:7C:68:81:F2:C8:35:7B:95 Alias name: mozillacert21.pem SHA1: 9B:AA:E5:9F:56:EE:21:CB:43:5A:BE:25:93:DF:A7:F0:40:D1:1D:CB SHA256: BE:6C:4D:A2:BB:B9:BA:59:B6:F3:93:97:68:37:42:46:C3:C0:05:99:3F:A9:8F:02:0D:1D:ED:BE:D4:8A:81:D5 Alias name: mozillacert22.pem SHA1: 32:3C:11:8E:1B:F7:B8:B6:52:54:E2:E2:10:0D:D6:02:90:37:F0:96 SHA256: 37:D5:10:06:C5:12:EA:AB:62:64:21:F1:EC:8C:92:01:3F:C5:F8:2A:E9:8E:E5:33:EB:46:19:B8:DE:B4:D0:6C Alias name: mozillacert23.pem SHA1: 91:C6:D6:EE:3E:8A:C8:63:84:E5:48:C2:99:29:5C:75:6C:81:7B:81 SHA256: 8D:72:2F:81:A9:C1:13:C0:79:1D:F1:36:A2:96:6D:B2:6C:95:0A:97:1D:B4:6B:41:99:F4:EA:54:B7:8B:FB:9F Alias name: mozillacert24.pem SHA1: 59:AF:82:79:91:86:C7:B4:75:07:CB:CF:03:57:46:EB:04:DD:B7:16 Client certificates 939 Amazon API Gateway SHA256: Developer Guide 66:8C:83:94:7D:A6:3B:72:4B:EC:E1:74:3C:31:A0:E6:AE:D0:DB:8E:C5:B3:1B:E3:77:BB:78:4F:91:B6:71:6F Alias name: mozillacert25.pem SHA1: 4E:B6:D5:78:49:9B:1C:CF:5F:58:1E:AD:56:BE:3D:9B:67:44:A5:E5 SHA256: 9A:CF:AB:7E:43:C8:D8:80:D0:6B:26:2A:94:DE:EE:E4:B4:65:99:89:C3:D0:CA:F1:9B:AF:64:05:E4:1A:B7:DF Alias name: mozillacert26.pem SHA1: 87:82:C6:C3:04:35:3B:CF:D2:96:92:D2:59:3E:7D:44:D9:34:FF:11 SHA256: F1:C1:B5:0A:E5:A2:0D:D8:03:0E:C9:F6:BC:24:82:3D:D3:67:B5:25:57:59:B4:E7:1B:61:FC:E9:F7:37:5D:73 Alias name: mozillacert27.pem SHA1: 3A:44:73:5A:E5:81:90:1F:24:86:61:46:1E:3B:9C:C4:5F:F5:3A:1B SHA256: 42:00:F5:04:3A:C8:59:0E:BB:52:7D:20:9E:D1:50:30:29:FB:CB:D4:1C:A1:B5:06:EC:27:F1:5A:DE:7D:AC:69 Alias name: mozillacert28.pem SHA1: 66:31:BF:9E:F7:4F:9E:B6:C9:D5:A6:0C:BA:6A:BE:D1:F7:BD:EF:7B SHA256: 0C:2C:D6:3D:F7:80:6F:A3:99:ED:E8:09:11:6B:57:5B:F8:79:89:F0:65:18:F9:80:8C:86:05:03:17:8B:AF:66 Alias name: mozillacert29.pem SHA1: 74:F8:A3:C3:EF:E7:B3:90:06:4B:83:90:3C:21:64:60:20:E5:DF:CE SHA256: 15:F0:BA:00:A3:AC:7A:F3:AC:88:4C:07:2B:10:11:A0:77:BD:77:C0:97:F4:01:64:B2:F8:59:8A:BD:83:86:0C Alias name: mozillacert3.pem SHA1: 87:9F:4B:EE:05:DF:98:58:3B:E3:60:D6:33:E7:0D:3F:FE:98:71:AF SHA256: 39:DF:7B:68:2B:7B:93:8F:84:71:54:81:CC:DE:8D:60:D8:F2:2E:C5:98:87:7D:0A:AA:C1:2B:59:18:2B:03:12 Alias name: mozillacert30.pem SHA1: E7:B4:F6:9D:61:EC:90:69:DB:7E:90:A7:40:1A:3C:F4:7D:4F:E8:EE SHA256: A7:12:72:AE:AA:A3:CF:E8:72:7F:7F:B3:9F:0F:B3:D1:E5:42:6E:90:60:B0:6E:E6:F1:3E:9A:3C:58:33:CD:43 Alias name: mozillacert31.pem SHA1: 9F:74:4E:9F:2B:4D:BA:EC:0F:31:2C:50:B6:56:3B:8E:2D:93:C3:11 SHA256: 17:93:92:7A:06:14:54:97:89:AD:CE:2F:8F:34:F7:F0:B6:6D:0F:3A:E3:A3:B8:4D:21:EC:15:DB:BA:4F:AD:C7 Alias name: mozillacert32.pem SHA1: 60:D6:89:74:B5:C2:65:9E:8A:0F:C1:88:7C:88:D2:46:69:1B:18:2C SHA256: B9:BE:A7:86:0A:96:2E:A3:61:1D:AB:97:AB:6D:A3:E2:1C:10:68:B9:7D:55:57:5E:D0:E1:12:79:C1:1C:89:32 Alias name: mozillacert33.pem SHA1: FE:B8:C4:32:DC:F9:76:9A:CE:AE:3D:D8:90:8F:FD:28:86:65:64:7D SHA256: A2:2D:BA:68:1E:97:37:6E:2D:39:7D:72:8A:AE:3A:9B:62:96:B9:FD:BA:60:BC:2E:11:F6:47:F2:C6:75:FB:37 Alias name: mozillacert34.pem SHA1: 59:22:A1:E1:5A:EA:16:35:21:F8:98:39:6A:46:46:B0:44:1B:0F:A9 Client certificates 940 Amazon API
apigateway-dg-253
apigateway-dg.pdf
253
mozillacert23.pem SHA1: 91:C6:D6:EE:3E:8A:C8:63:84:E5:48:C2:99:29:5C:75:6C:81:7B:81 SHA256: 8D:72:2F:81:A9:C1:13:C0:79:1D:F1:36:A2:96:6D:B2:6C:95:0A:97:1D:B4:6B:41:99:F4:EA:54:B7:8B:FB:9F Alias name: mozillacert24.pem SHA1: 59:AF:82:79:91:86:C7:B4:75:07:CB:CF:03:57:46:EB:04:DD:B7:16 Client certificates 939 Amazon API Gateway SHA256: Developer Guide 66:8C:83:94:7D:A6:3B:72:4B:EC:E1:74:3C:31:A0:E6:AE:D0:DB:8E:C5:B3:1B:E3:77:BB:78:4F:91:B6:71:6F Alias name: mozillacert25.pem SHA1: 4E:B6:D5:78:49:9B:1C:CF:5F:58:1E:AD:56:BE:3D:9B:67:44:A5:E5 SHA256: 9A:CF:AB:7E:43:C8:D8:80:D0:6B:26:2A:94:DE:EE:E4:B4:65:99:89:C3:D0:CA:F1:9B:AF:64:05:E4:1A:B7:DF Alias name: mozillacert26.pem SHA1: 87:82:C6:C3:04:35:3B:CF:D2:96:92:D2:59:3E:7D:44:D9:34:FF:11 SHA256: F1:C1:B5:0A:E5:A2:0D:D8:03:0E:C9:F6:BC:24:82:3D:D3:67:B5:25:57:59:B4:E7:1B:61:FC:E9:F7:37:5D:73 Alias name: mozillacert27.pem SHA1: 3A:44:73:5A:E5:81:90:1F:24:86:61:46:1E:3B:9C:C4:5F:F5:3A:1B SHA256: 42:00:F5:04:3A:C8:59:0E:BB:52:7D:20:9E:D1:50:30:29:FB:CB:D4:1C:A1:B5:06:EC:27:F1:5A:DE:7D:AC:69 Alias name: mozillacert28.pem SHA1: 66:31:BF:9E:F7:4F:9E:B6:C9:D5:A6:0C:BA:6A:BE:D1:F7:BD:EF:7B SHA256: 0C:2C:D6:3D:F7:80:6F:A3:99:ED:E8:09:11:6B:57:5B:F8:79:89:F0:65:18:F9:80:8C:86:05:03:17:8B:AF:66 Alias name: mozillacert29.pem SHA1: 74:F8:A3:C3:EF:E7:B3:90:06:4B:83:90:3C:21:64:60:20:E5:DF:CE SHA256: 15:F0:BA:00:A3:AC:7A:F3:AC:88:4C:07:2B:10:11:A0:77:BD:77:C0:97:F4:01:64:B2:F8:59:8A:BD:83:86:0C Alias name: mozillacert3.pem SHA1: 87:9F:4B:EE:05:DF:98:58:3B:E3:60:D6:33:E7:0D:3F:FE:98:71:AF SHA256: 39:DF:7B:68:2B:7B:93:8F:84:71:54:81:CC:DE:8D:60:D8:F2:2E:C5:98:87:7D:0A:AA:C1:2B:59:18:2B:03:12 Alias name: mozillacert30.pem SHA1: E7:B4:F6:9D:61:EC:90:69:DB:7E:90:A7:40:1A:3C:F4:7D:4F:E8:EE SHA256: A7:12:72:AE:AA:A3:CF:E8:72:7F:7F:B3:9F:0F:B3:D1:E5:42:6E:90:60:B0:6E:E6:F1:3E:9A:3C:58:33:CD:43 Alias name: mozillacert31.pem SHA1: 9F:74:4E:9F:2B:4D:BA:EC:0F:31:2C:50:B6:56:3B:8E:2D:93:C3:11 SHA256: 17:93:92:7A:06:14:54:97:89:AD:CE:2F:8F:34:F7:F0:B6:6D:0F:3A:E3:A3:B8:4D:21:EC:15:DB:BA:4F:AD:C7 Alias name: mozillacert32.pem SHA1: 60:D6:89:74:B5:C2:65:9E:8A:0F:C1:88:7C:88:D2:46:69:1B:18:2C SHA256: B9:BE:A7:86:0A:96:2E:A3:61:1D:AB:97:AB:6D:A3:E2:1C:10:68:B9:7D:55:57:5E:D0:E1:12:79:C1:1C:89:32 Alias name: mozillacert33.pem SHA1: FE:B8:C4:32:DC:F9:76:9A:CE:AE:3D:D8:90:8F:FD:28:86:65:64:7D SHA256: A2:2D:BA:68:1E:97:37:6E:2D:39:7D:72:8A:AE:3A:9B:62:96:B9:FD:BA:60:BC:2E:11:F6:47:F2:C6:75:FB:37 Alias name: mozillacert34.pem SHA1: 59:22:A1:E1:5A:EA:16:35:21:F8:98:39:6A:46:46:B0:44:1B:0F:A9 Client certificates 940 Amazon API Gateway SHA256: Developer Guide 41:C9:23:86:6A:B4:CA:D6:B7:AD:57:80:81:58:2E:02:07:97:A6:CB:DF:4F:FF:78:CE:83:96:B3:89:37:D7:F5 Alias name: mozillacert35.pem SHA1: 2A:C8:D5:8B:57:CE:BF:2F:49:AF:F2:FC:76:8F:51:14:62:90:7A:41 SHA256: 92:BF:51:19:AB:EC:CA:D0:B1:33:2D:C4:E1:D0:5F:BA:75:B5:67:90:44:EE:0C:A2:6E:93:1F:74:4F:2F:33:CF Alias name: mozillacert36.pem SHA1: 23:88:C9:D3:71:CC:9E:96:3D:FF:7D:3C:A7:CE:FC:D6:25:EC:19:0D SHA256: 32:7A:3D:76:1A:BA:DE:A0:34:EB:99:84:06:27:5C:B1:A4:77:6E:FD:AE:2F:DF:6D:01:68:EA:1C:4F:55:67:D0 Alias name: mozillacert37.pem SHA1: B1:2E:13:63:45:86:A4:6F:1A:B2:60:68:37:58:2D:C4:AC:FD:94:97 SHA256: E3:B6:A2:DB:2E:D7:CE:48:84:2F:7A:C5:32:41:C7:B7:1D:54:14:4B:FB:40:C1:1F:3F:1D:0B:42:F5:EE:A1:2D Alias name: mozillacert38.pem SHA1: CB:A1:C5:F8:B0:E3:5E:B8:B9:45:12:D3:F9:34:A2:E9:06:10:D3:36 SHA256: A6:C5:1E:0D:A5:CA:0A:93:09:D2:E4:C0:E4:0C:2A:F9:10:7A:AE:82:03:85:7F:E1:98:E3:E7:69:E3:43:08:5C Alias name: mozillacert39.pem SHA1: AE:50:83:ED:7C:F4:5C:BC:8F:61:C6:21:FE:68:5D:79:42:21:15:6E SHA256: E6:B8:F8:76:64:85:F8:07:AE:7F:8D:AC:16:70:46:1F:07:C0:A1:3E:EF:3A:1F:F7:17:53:8D:7A:BA:D3:91:B4 Alias name: mozillacert4.pem SHA1: E3:92:51:2F:0A:CF:F5:05:DF:F6:DE:06:7F:75:37:E1:65:EA:57:4B SHA256: 0B:5E:ED:4E:84:64:03:CF:55:E0:65:84:84:40:ED:2A:82:75:8B:F5:B9:AA:1F:25:3D:46:13:CF:A0:80:FF:3F Alias name: mozillacert40.pem SHA1: 80:25:EF:F4:6E:70:C8:D4:72:24:65:84:FE:40:3B:8A:8D:6A:DB:F5 SHA256: 8D:A0:84:FC:F9:9C:E0:77:22:F8:9B:32:05:93:98:06:FA:5C:B8:11:E1:C8:13:F6:A1:08:C7:D3:36:B3:40:8E Alias name: mozillacert41.pem SHA1: 6B:2F:34:AD:89:58:BE:62:FD:B0:6B:5C:CE:BB:9D:D9:4F:4E:39:F3 SHA256: EB:F3:C0:2A:87:89:B1:FB:7D:51:19:95:D6:63:B7:29:06:D9:13:CE:0D:5E:10:56:8A:8A:77:E2:58:61:67:E7 Alias name: mozillacert42.pem SHA1: 85:A4:08:C0:9C:19:3E:5D:51:58:7D:CD:D6:13:30:FD:8C:DE:37:BF SHA256: B6:19:1A:50:D0:C3:97:7F:7D:A9:9B:CD:AA:C8:6A:22:7D:AE:B9:67:9E:C7:0B:A3:B0:C9:D9:22:71:C1:70:D3 Alias name: mozillacert43.pem SHA1: F9:CD:0E:2C:DA:76:24:C1:8F:BD:F0:F0:AB:B6:45:B8:F7:FE:D5:7A SHA256: 50:79:41:C7:44:60:A0:B4:70:86:22:0D:4E:99:32:57:2A:B5:D1:B5:BB:CB:89:80:AB:1C:B1:76:51:A8:44:D2 Alias name: mozillacert44.pem SHA1: 5F:43:E5:B1:BF:F8:78:8C:AC:1C:C7:CA:4A:9A:C6:22:2B:CC:34:C6 Client certificates 941 Amazon API Gateway SHA256: Developer Guide 96:0A:DF:00:63:E9:63:56:75:0C:29:65:DD:0A:08:67:DA:0B:9C:BD:6E:77:71:4A:EA:FB:23:49:AB:39:3D:A3 Alias name: mozillacert45.pem SHA1: 67:65:0D:F1:7E:8E:7E:5B:82:40:A4:F4:56:4B:CF:E2:3D:69:C6:F0 SHA256: C0:A6:F4:DC:63:A2:4B:FD:CF:54:EF:2A:6A:08:2A:0A:72:DE:35:80:3E:2F:F5:FF:52:7A:E5:D8:72:06:DF:D5 Alias name: mozillacert46.pem SHA1: 40:9D:4B:D9:17:B5:5C:27:B6:9B:64:CB:98:22:44:0D:CD:09:B8:89 SHA256: EC:C3:E9:C3:40:75:03:BE:E0:91:AA:95:2F:41:34:8F:F8:8B:AA:86:3B:22:64:BE:FA:C8:07:90:15:74:E9:39 Alias name: mozillacert47.pem SHA1: 1B:4B:39:61:26:27:6B:64:91:A2:68:6D:D7:02:43:21:2D:1F:1D:96 SHA256: E4:C7:34:30:D7:A5:B5:09:25:DF:43:37:0A:0D:21:6E:9A:79:B9:D6:DB:83:73:A0:C6:9E:B1:CC:31:C7:C5:2A Alias name: mozillacert48.pem SHA1: A0:A1:AB:90:C9:FC:84:7B:3B:12:61:E8:97:7D:5F:D3:22:61:D3:CC SHA256: 0F:4E:9C:DD:26:4B:02:55:50:D1:70:80:63:40:21:4F:E9:44:34:C9:B0:2F:69:7E:C7:10:FC:5F:EA:FB:5E:38 Alias name: mozillacert49.pem SHA1: 61:57:3A:11:DF:0E:D8:7E:D5:92:65:22:EA:D0:56:D7:44:B3:23:71 SHA256: B7:B1:2B:17:1F:82:1D:AA:99:0C:D0:FE:50:87:B1:28:44:8B:A8:E5:18:4F:84:C5:1E:02:B5:C8:FB:96:2B:24 Alias name: mozillacert5.pem SHA1: B8:01:86:D1:EB:9C:86:A5:41:04:CF:30:54:F3:4C:52:B7:E5:58:C6 SHA256: CE:CD:DC:90:50:99:D8:DA:DF:C5:B1:D2:09:B7:37:CB:E2:C1:8C:FB:2C:10:C0:FF:0B:CF:0D:32:86:FC:1A:A2 Alias name: mozillacert50.pem SHA1: 8C:96:BA:EB:DD:2B:07:07:48:EE:30:32:66:A0:F3:98:6E:7C:AE:58 SHA256: 35:AE:5B:DD:D8:F7:AE:63:5C:FF:BA:56:82:A8:F0:0B:95:F4:84:62:C7:10:8E:E9:A0:E5:29:2B:07:4A:AF:B2 Alias name: mozillacert51.pem SHA1: FA:B7:EE:36:97:26:62:FB:2D:B0:2A:F6:BF:03:FD:E8:7C:4B:2F:9B SHA256: EA:A9:62:C4:FA:4A:6B:AF:EB:E4:15:19:6D:35:1C:CD:88:8D:4F:53:F3:FA:8A:E6:D7:C4:66:A9:4E:60:42:BB Alias name: mozillacert52.pem SHA1: 8B:AF:4C:9B:1D:F0:2A:92:F7:DA:12:8E:B9:1B:AC:F4:98:60:4B:6F SHA256: E2:83:93:77:3D:A8:45:A6:79:F2:08:0C:C7:FB:44:A3:B7:A1:C3:79:2C:B7:EB:77:29:FD:CB:6A:8D:99:AE:A7 Alias name: mozillacert53.pem SHA1: 7F:8A:B0:CF:D0:51:87:6A:66:F3:36:0F:47:C8:8D:8C:D3:35:FC:74 SHA256: 2D:47:43:7D:E1:79:51:21:5A:12:F3:C5:8E:51:C7:29:A5:80:26:EF:1F:CC:0A:5F:B3:D9:DC:01:2F:60:0D:19 Alias name: mozillacert54.pem SHA1: 03:9E:ED:B8:0B:E7:A0:3C:69:53:89:3B:20:D2:D9:32:3A:4C:2A:FD Client certificates 942 Amazon API Gateway SHA256: Developer Guide B4:78:B8:12:25:0D:F8:78:63:5C:2A:A7:EC:7D:15:5E:AA:62:5E:E8:29:16:E2:CD:29:43:61:88:6C:D1:FB:D4 Alias name: mozillacert55.pem SHA1: AA:DB:BC:22:23:8F:C4:01:A1:27:BB:38:DD:F4:1D:DB:08:9E:F0:12 SHA256: A4:31:0D:50:AF:18:A6:44:71:90:37:2A:86:AF:AF:8B:95:1F:FB:43:1D:83:7F:1E:56:88:B4:59:71:ED:15:57 Alias name: mozillacert56.pem SHA1: F1:8B:53:8D:1B:E9:03:B6:A6:F0:56:43:5B:17:15:89:CA:F3:6B:F2 SHA256: 4B:03:F4:58:07:AD:70:F2:1B:FC:2C:AE:71:C9:FD:E4:60:4C:06:4C:F5:FF:B6:86:BA:E5:DB:AA:D7:FD:D3:4C Alias name: mozillacert57.pem SHA1: D6:DA:A8:20:8D:09:D2:15:4D:24:B5:2F:CB:34:6E:B2:58:B2:8A:58 SHA256: F9:E6:7D:33:6C:51:00:2A:C0:54:C6:32:02:2D:66:DD:A2:E7:E3:FF:F1:0A:D0:61:ED:31:D8:BB:B4:10:CF:B2 Alias name: mozillacert58.pem SHA1: 8D:17:84:D5:37:F3:03:7D:EC:70:FE:57:8B:51:9A:99:E6:10:D7:B0 SHA256: 5E:DB:7A:C4:3B:82:A0:6A:87:61:E8:D7:BE:49:79:EB:F2:61:1F:7D:D7:9B:F9:1C:1C:6B:56:6A:21:9E:D7:66 Alias name: mozillacert59.pem SHA1: 36:79:CA:35:66:87:72:30:4D:30:A5:FB:87:3B:0F:A7:7B:B7:0D:54 SHA256: 23:99:56:11:27:A5:71:25:DE:8C:EF:EA:61:0D:DF:2F:A0:78:B5:C8:06:7F:4E:82:82:90:BF:B8:60:E8:4B:3C Alias name: mozillacert6.pem SHA1: 27:96:BA:E6:3F:18:01:E2:77:26:1B:A0:D7:77:70:02:8F:20:EE:E4 SHA256: C3:84:6B:F2:4B:9E:93:CA:64:27:4C:0E:C6:7C:1E:CC:5E:02:4F:FC:AC:D2:D7:40:19:35:0E:81:FE:54:6A:E4 Alias name: mozillacert60.pem SHA1: 3B:C4:9F:48:F8:F3:73:A0:9C:1E:BD:F8:5B:B1:C3:65:C7:D8:11:B3 SHA256: BF:0F:EE:FB:9E:3A:58:1A:D5:F9:E9:DB:75:89:98:57:43:D2:61:08:5C:4D:31:4F:6F:5D:72:59:AA:42:16:12 Alias name: mozillacert61.pem SHA1: E0:B4:32:2E:B2:F6:A5:68:B6:54:53:84:48:18:4A:50:36:87:43:84 SHA256: 03:95:0F:B4:9A:53:1F:3E:19:91:94:23:98:DF:A9:E0:EA:32:D7:BA:1C:DD:9B:C8:5D:B5:7E:D9:40:0B:43:4A Alias name: mozillacert62.pem SHA1: A1:DB:63:93:91:6F:17:E4:18:55:09:40:04:15:C7:02:40:B0:AE:6B SHA256: A4:B6:B3:99:6F:C2:F3:06:B3:FD:86:81:BD:63:41:3D:8C:50:09:CC:4F:A3:29:C2:CC:F0:E2:FA:1B:14:03:05 Alias name: mozillacert63.pem SHA1: 89:DF:74:FE:5C:F4:0F:4A:80:F9:E3:37:7D:54:DA:91:E1:01:31:8E SHA256: 3C:5F:81:FE:A5:FA:B8:2C:64:BF:A2:EA:EC:AF:CD:E8:E0:77:FC:86:20:A7:CA:E5:37:16:3D:F3:6E:DB:F3:78 Alias name: mozillacert64.pem SHA1: 62:7F:8D:78:27:65:63:99:D2:7D:7F:90:44:C9:FE:B3:F3:3E:FA:9A Client certificates 943 Amazon API Gateway SHA256: Developer Guide AB:70:36:36:5C:71:54:AA:29:C2:C2:9F:5D:41:91:16:3B:16:2A:22:25:01:13:57:D5:6D:07:FF:A7:BC:1F:72 Alias name: mozillacert65.pem SHA1: 69:BD:8C:F4:9C:D3:00:FB:59:2E:17:93:CA:55:6A:F3:EC:AA:35:FB SHA256: BC:23:F9:8A:31:3C:B9:2D:E3:BB:FC:3A:5A:9F:44:61:AC:39:49:4C:4A:E1:5A:9E:9D:F1:31:E9:9B:73:01:9A Alias name: mozillacert66.pem SHA1: DD:E1:D2:A9:01:80:2E:1D:87:5E:84:B3:80:7E:4B:B1:FD:99:41:34 SHA256: E6:09:07:84:65:A4:19:78:0C:B6:AC:4C:1C:0B:FB:46:53:D9:D9:CC:6E:B3:94:6E:B7:F3:D6:99:97:BA:D5:98 Alias name: mozillacert67.pem SHA1: D6:9B:56:11:48:F0:1C:77:C5:45:78:C1:09:26:DF:5B:85:69:76:AD SHA256: CB:B5:22:D7:B7:F1:27:AD:6A:01:13:86:5B:DF:1C:D4:10:2E:7D:07:59:AF:63:5A:7C:F4:72:0D:C9:63:C5:3B Alias name: mozillacert68.pem SHA1: AE:C5:FB:3F:C8:E1:BF:C4:E5:4F:03:07:5A:9A:E8:00:B7:F7:B6:FA SHA256: 04:04:80:28:BF:1F:28:64:D4:8F:9A:D4:D8:32:94:36:6A:82:88:56:55:3F:3B:14:30:3F:90:14:7F:5D:40:EF Alias name: mozillacert69.pem SHA1: 2F:78:3D:25:52:18:A7:4A:65:39:71:B5:2C:A2:9C:45:15:6F:E9:19 SHA256: 25:30:CC:8E:98:32:15:02:BA:D9:6F:9B:1F:BA:1B:09:9E:2D:29:9E:0F:45:48:BB:91:4F:36:3B:C0:D4:53:1F Alias name: mozillacert7.pem SHA1: AD:7E:1C:28:B0:64:EF:8F:60:03:40:20:14:C3:D0:E3:37:0E:B5:8A SHA256: 14:65:FA:20:53:97:B8:76:FA:A6:F0:A9:95:8E:55:90:E4:0F:CC:7F:AA:4F:B7:C2:C8:67:75:21:FB:5F:B6:58 Alias name: mozillacert70.pem SHA1: 78:6A:74:AC:76:AB:14:7F:9C:6A:30:50:BA:9E:A8:7E:FE:9A:CE:3C SHA256: 06:3E:4A:FA:C4:91:DF:D3:32:F3:08:9B:85:42:E9:46:17:D8:93:D7:FE:94:4E:10:A7:93:7E:E2:9D:96:93:C0 Alias name: mozillacert71.pem SHA1: 4A:BD:EE:EC:95:0D:35:9C:89:AE:C7:52:A1:2C:5B:29:F6:D6:AA:0C SHA256: 13:63:35:43:93:34:A7:69:80:16:A0:D3:24:DE:72:28:4E:07:9D:7B:52:20:BB:8F:BD:74:78:16:EE:BE:BA:CA Alias name: mozillacert72.pem SHA1: 47:BE:AB:C9:22:EA:E8:0E:78:78:34:62:A7:9F:45:C2:54:FD:E6:8B SHA256: 45:14:0B:32:47:EB:9C:C8:C5:B4:F0:D7:B5:30:91:F7:32:92:08:9E:6E:5A:63:E2:74:9D:D3:AC:A9:19:8E:DA Alias name: mozillacert73.pem SHA1: B5:1C:06:7C:EE:2B:0C:3D:F8:55:AB:2D:92:F4:FE:39:D4:E7:0F:0E SHA256: 2C:E1:CB:0B:F9:D2:F9:E1:02:99:3F:BE:21:51:52:C3:B2:DD:0C:AB:DE:1C:68:E5:31:9B:83:91:54:DB:B7:F5 Alias name: mozillacert74.pem SHA1: 92:5A:8F:8D:2C:6D:04:E0:66:5F:59:6A:FF:22:D8:63:E8:25:6F:3F Client certificates 944 Amazon API Gateway SHA256: Developer Guide 56:8D:69:05:A2:C8:87:08:A4:B3:02:51:90:ED:CF:ED:B1:97:4A:60:6A:13:C6:E5:29:0F:CB:2A:E6:3E:DA:B5 Alias name: mozillacert75.pem SHA1: D2:32:09:AD:23:D3:14:23:21:74:E4:0D:7F:9D:62:13:97:86:63:3A SHA256: 08:29:7A:40:47:DB:A2:36:80:C7:31:DB:6E:31:76:53:CA:78:48:E1:BE:BD:3A:0B:01:79:A7:07:F9:2C:F1:78 Alias name: mozillacert76.pem SHA1: F9:B5:B6:32:45:5F:9C:BE:EC:57:5F:80:DC:E9:6E:2C:C7:B2:78:B7 SHA256: 03:76:AB:1D:54:C5:F9:80:3C:E4:B2:E2:01:A0:EE:7E:EF:7B:57:B6:36:E8:A9:3C:9B:8D:48:60:C9:6F:5F:A7 Alias name: mozillacert77.pem SHA1: 13:2D:0D:45:53:4B:69:97:CD:B2:D5:C3:39:E2:55:76:60:9B:5C:C6 SHA256: EB:04:CF:5E:B1:F3:9A:FA:76:2F:2B:B1:20:F2:96:CB:A5:20:C1:B9:7D:B1:58:95:65:B8:1C:B9:A1:7B:72:44 Alias name: mozillacert78.pem SHA1: 29:36:21:02:8B:20:ED:02:F5:66:C5:32:D1:D6:ED:90:9F:45:00:2F SHA256: 0A:81:EC:5A:92:97:77:F1:45:90:4A:F3:8D:5D:50:9F:66:B5:E2:C5:8F:CD:B5:31:05:8B:0E:17:F3:F0:B4:1B Alias name: mozillacert79.pem SHA1: D8:A6:33:2C:E0:03:6F:B1:85:F6:63:4F:7D:6A:06:65:26:32:28:27 SHA256: 70:A7:3F:7F:37:6B:60:07:42:48:90:45:34:B1:14:82:D5:BF:0E:69:8E:CC:49:8D:F5:25:77:EB:F2:E9:3B:9A Alias name: mozillacert8.pem SHA1: 3E:2B:F7:F2:03:1B:96:F3:8C:E6:C4:D8:A8:5D:3E:2D:58:47:6A:0F SHA256: C7:66:A9:BE:F2:D4:07:1C:86:3A:31:AA:49:20:E8:13:B2:D1:98:60:8C:B7:B7:CF:E2:11:43:B8:36:DF:09:EA Alias name: mozillacert80.pem SHA1: B8:23:6B:00:2F:1D:16:86:53:01:55:6C:11:A4:37:CA:EB:FF:C3:BB SHA256: BD:71:FD:F6:DA:97:E4:CF:62:D1:64:7A:DD:25:81:B0:7D:79:AD:F8:39:7E:B4:EC:BA:9C:5E:84:88:82:14:23 Alias name: mozillacert81.pem SHA1: 07:E0:32:E0:20:B7:2C:3F:19:2F:06:28:A2:59:3A:19:A7:0F:06:9E SHA256: 5C:58:46:8D:55:F5:8E:49:7E:74:39:82:D2:B5:00:10:B6:D1:65:37:4A:CF:83:A7:D4:A3:2D:B7:68:C4:40:8E Alias name: mozillacert82.pem SHA1: 2E:14:DA:EC:28:F0:FA:1E:8E:38:9A:4E:AB:EB:26:C0:0A:D3:83:C3 SHA256: FC:BF:E2:88:62:06:F7:2B:27:59:3C:8B:07:02:97:E1:2D:76:9E:D1:0E:D7:93:07:05:A8:09:8E:FF:C1:4D:17 Alias name: mozillacert83.pem SHA1: A0:73:E5:C5:BD:43:61:0D:86:4C:21:13:0A:85:58:57:CC:9C:EA:46 SHA256: 8C:4E:DF:D0:43:48:F3:22:96:9E:7E:29:A4:CD:4D:CA:00:46:55:06:1C:16:E1:B0:76:42:2E:F3:42:AD:63:0E Alias name: mozillacert84.pem SHA1: D3:C0:63:F2:19:ED:07:3E:34:AD:5D:75:0B:32:76:29:FF:D5:9A:F2 Client certificates 945 Amazon API Gateway SHA256: Developer Guide 79:3C:BF:45:59:B9:FD:E3:8A:B2:2D:F1:68:69:F6:98:81:AE:14:C4:B0:13:9A:C7:88:A7:8A:1A:FC:CA:02:FB Alias name: mozillacert85.pem SHA1: CF:9E:87:6D:D3:EB:FC:42:26:97:A3:B5:A3:7A:A0:76:A9:06:23:48 SHA256: BF:D8:8F:E1:10:1C:41:AE:3E:80:1B:F8:BE:56:35:0E:E9:BA:D1:A6:B9:BD:51:5E:DC:5C:6D:5B:87:11:AC:44 Alias name: mozillacert86.pem SHA1: 74:2C:31:92:E6:07:E4:24:EB:45:49:54:2B:E1:BB:C5:3E:61:74:E2 SHA256: E7:68:56:34:EF:AC:F6:9A:CE:93:9A:6B:25:5B:7B:4F:AB:EF:42:93:5B:50:A2:65:AC:B5:CB:60:27:E4:4E:70 Alias name: mozillacert87.pem SHA1: 5F:3B:8C:F2:F8:10:B3:7D:78:B4:CE:EC:19:19:C3:73:34:B9:C7:74 SHA256: 51:3B:2C:EC:B8:10:D4:CD:E5:DD:85:39:1A:DF:C6:C2:DD:60:D8:7B:B7:36:D2:B5:21:48:4A:A4:7A:0E:BE:F6 Alias name: mozillacert88.pem SHA1: FE:45:65:9B:79:03:5B:98:A1:61:B5:51:2E:AC:DA:58:09:48:22:4D SHA256: BC:10:4F:15:A4:8B:E7:09:DC:A5:42:A7:E1:D4:B9:DF:6F:05:45:27:E8:02:EA:A9:2D:59:54:44:25:8A:FE:71 Alias name: mozillacert89.pem SHA1: C8:EC:8C:87:92:69:CB:4B:AB:39:E9:8D:7E:57:67:F3:14:95:73:9D SHA256: E3:89:36:0D:0F:DB:AE:B3:D2:50:58:4B:47:30:31:4E:22:2F:39:C1:56:A0:20:14:4E:8D:96:05:61:79:15:06 Alias name: mozillacert9.pem SHA1: F4:8B:11:BF:DE:AB:BE:94:54:20:71:E6:41:DE:6B:BE:88:2B:40:B9 SHA256: 76:00:29:5E:EF:E8:5B:9E:1F:D6:24:DB:76:06:2A:AA:AE:59:81:8A:54:D2:77:4C:D4:C0:B2:C0:11:31:E1:B3 Alias name: mozillacert90.pem SHA1: F3:73:B3:87:06:5A:28:84:8A:F2:F3:4A:CE:19:2B:DD:C7:8E:9C:AC SHA256: 55:92:60:84:EC:96:3A:64:B9:6E:2A:BE:01:CE:0B:A8:6A:64:FB:FE:BC:C7:AA:B5:AF:C1:55:B3:7F:D7:60:66 Alias name: mozillacert91.pem SHA1: 3B:C0:38:0B:33:C3:F6:A6:0C:86:15:22:93:D9:DF:F5:4B:81:C0:04 SHA256: C1:B4:82:99:AB:A5:20:8F:E9:63:0A:CE:55:CA:68:A0:3E:DA:5A:51:9C:88:02:A0:D3:A6:73:BE:8F:8E:55:7D Alias name: mozillacert92.pem SHA1: A3:F1:33:3F:E2:42:BF:CF:C5:D1:4E:8F:39:42:98:40:68:10:D1:A0 SHA256: E1:78:90:EE:09:A3:FB:F4:F4:8B:9C:41:4A:17:D6:37:B7:A5:06:47:E9:BC:75:23:22:72:7F:CC:17:42:A9:11 Alias name: mozillacert93.pem SHA1: 31:F1:FD:68:22:63:20:EE:C6:3B:3F:9D:EA:4A:3E:53:7C:7C:39:17 SHA256: C7:BA:65:67:DE:93:A7:98:AE:1F:AA:79:1E:71:2D:37:8F:AE:1F:93:C4:39:7F:EA:44:1B:B7:CB:E6:FD:59:95 Alias name: mozillacert94.pem SHA1: 49:0A:75:74:DE:87:0A:47:FE:58:EE:F6:C7:6B:EB:C6:0B:12:40:99 Client certificates 946 Amazon API Gateway SHA256: Developer Guide 9A:11:40:25:19:7C:5B:B9:5D:94:E6:3D:55:CD:43:79:08:47:B6:46:B2:3C:DF:11:AD:A4:A0:0E:FF:15:FB:48 Alias name: mozillacert95.pem SHA1: DA:FA:F7:FA:66:84:EC:06:8F:14:50:BD:C7:C2:81:A5:BC:A9:64:57 SHA256: ED:F7:EB:BC:A2:7A:2A:38:4D:38:7B:7D:40:10:C6:66:E2:ED:B4:84:3E:4C:29:B4:AE:1D:5B:93:32:E6:B2:4D Alias name: mozillacert96.pem SHA1: 55:A6:72:3E:CB:F2:EC:CD:C3:23:74:70:19:9D:2A:BE:11:E3:81:D1 SHA256: FD:73:DA:D3:1C:64:4F:F1:B4:3B:EF:0C:CD:DA:96:71:0B:9C:D9:87:5E:CA:7E:31:70:7A:F3:E9:6D:52:2B:BD Alias name: mozillacert97.pem SHA1: 85:37:1C:A6:E5:50:14:3D:CE:28:03:47:1B:DE:3A:09:E8:F8:77:0F SHA256: 83:CE:3C:12:29:68:8A:59:3D:48:5F:81:97:3C:0F:91:95:43:1E:DA:37:CC:5E:36:43:0E:79:C7:A8:88:63:8B Alias name: mozillacert98.pem SHA1: C9:A8:B9:E7:55:80:5E:58:E3:53:77:A7:25:EB:AF:C3:7B:27:CC:D7 SHA256: 3E:84:BA:43:42:90:85:16:E7:75:73:C0:99:2F:09:79:CA:08:4E:46:85:68:1F:F1:95:CC:BA:8A:22:9B:8A:76 Alias name: mozillacert99.pem SHA1: F1:7F:6F:B6:31:DC:99:E3:A3:C8:7F:FE:1C:F1:81:10:88:D9:60:33 SHA256: 97:8C:D9:66:F2:FA:A0:7B:A7:AA:95:00:D9:C0:2E:9D:77:F2:CD:AD:A6:AD:6B:A7:4A:F4:B9:1C:66:59:3C:50 Alias name: netlockaranyclassgoldfotanusitvany SHA1: 06:08:3F:59:3F:15:A1:04:A0:69:A4:6B:A9:03:D0:06:B7:97:09:91 SHA256: 6C:61:DA:C3:A2:DE:F0:31:50:6B:E0:36:D2:A6:FE:40:19:94:FB:D1:3D:F9:C8:D4:66:59:92:74:C4:46:EC:98 Alias name: networksolutionscertificateauthority SHA1: 74:F8:A3:C3:EF:E7:B3:90:06:4B:83:90:3C:21:64:60:20:E5:DF:CE SHA256: 15:F0:BA:00:A3:AC:7A:F3:AC:88:4C:07:2B:10:11:A0:77:BD:77:C0:97:F4:01:64:B2:F8:59:8A:BD:83:86:0C Alias name: oistewisekeyglobalrootgaca SHA1: 59:22:A1:E1:5A:EA:16:35:21:F8:98:39:6A:46:46:B0:44:1B:0F:A9 SHA256: 41:C9:23:86:6A:B4:CA:D6:B7:AD:57:80:81:58:2E:02:07:97:A6:CB:DF:4F:FF:78:CE:83:96:B3:89:37:D7:F5 Alias name: oistewisekeyglobalrootgbca SHA1: 0F:F9:40:76:18:D3:D7:6A:4B:98:F0:A8:35:9E:0C:FD:27:AC:CC:ED SHA256: 6B:9C:08:E8:6E:B0:F7:67:CF:AD:65:CD:98:B6:21:49:E5:49:4A:67:F5:84:5E:7B:D1:ED:01:9F:27:B8:6B:D6 Alias name: oistewisekeyglobalrootgcca SHA1: E0:11:84:5E:34:DE:BE:88:81:B9:9C:F6:16:26:D1:96:1F:C3:B9:31 SHA256: 85:60:F9:1C:36:24:DA:BA:95:70:B5:FE:A0:DB:E3:6F:F1:1A:83:23:BE:94:86:85:4F:B3:F3:4A:55:71:19:8D Alias name: quovadisrootca SHA1: DE:3F:40:BD:50:93:D3:9B:6C:60:F6:DA:BC:07:62:01:00:89:76:C9 Client certificates 947 Amazon API Gateway SHA256: Developer Guide A4:5E:DE:3B:BB:F0:9C:8A:E1:5C:72:EF:C0:72:68:D6:93:A2:1C:99:6F:D5:1E:67:CA:07:94:60:FD:6D:88:73 Alias name: quovadisrootca1g3 SHA1: 1B:8E:EA:57:96:29:1A:C9:39:EA:B8:0A:81:1A:73:73:C0:93:79:67 SHA256: 8A:86:6F:D1:B2:76:B5:7E:57:8E:92:1C:65:82:8A:2B:ED:58:E9:F2:F2:88:05:41:34:B7:F1:F4:BF:C9:CC:74 Alias name: quovadisrootca2 SHA1: CA:3A:FB:CF:12:40:36:4B:44:B2:16:20:88:80:48:39:19:93:7C:F7 SHA256: 85:A0:DD:7D:D7:20:AD:B7:FF:05:F8:3D:54:2B:20:9D:C7:FF:45:28:F7:D6:77:B1:83:89:FE:A5:E5:C4:9E:86 Alias name: quovadisrootca2g3 SHA1: 09:3C:61:F3:8B:8B:DC:7D:55:DF:75:38:02:05:00:E1:25:F5:C8:36 SHA256: 8F:E4:FB:0A:F9:3A:4D:0D:67:DB:0B:EB:B2:3E:37:C7:1B:F3:25:DC:BC:DD:24:0E:A0:4D:AF:58:B4:7E:18:40 Alias name: quovadisrootca3 SHA1: 1F:49:14:F7:D8:74:95:1D:DD:AE:02:C0:BE:FD:3A:2D:82:75:51:85 SHA256: 18:F1:FC:7F:20:5D:F8:AD:DD:EB:7F:E0:07:DD:57:E3:AF:37:5A:9C:4D:8D:73:54:6B:F4:F1:FE:D1:E1:8D:35 Alias name: quovadisrootca3g3 SHA1: 48:12:BD:92:3C:A8:C4:39:06:E7:30:6D:27:96:E6:A4:CF:22:2E:7D SHA256: 88:EF:81:DE:20:2E:B0:18:45:2E:43:F8:64:72:5C:EA:5F:BD:1F:C2:D9:D2:05:73:07:09:C5:D8:B8:69:0F:46 Alias name: secomevrootca1 SHA1: FE:B8:C4:32:DC:F9:76:9A:CE:AE:3D:D8:90:8F:FD:28:86:65:64:7D SHA256: A2:2D:BA:68:1E:97:37:6E:2D:39:7D:72:8A:AE:3A:9B:62:96:B9:FD:BA:60:BC:2E:11:F6:47:F2:C6:75:FB:37 Alias name: secomscrootca1 SHA1: 36:B1:2B:49:F9:81:9E:D7:4C:9E:BC:38:0F:C6:56:8F:5D:AC:B2:F7 SHA256: E7:5E:72:ED:9F:56:0E:EC:6E:B4:80:00:73:A4:3F:C3:AD:19:19:5A:39:22:82:01:78:95:97:4A:99:02:6B:6C Alias name: secomscrootca2 SHA1: 5F:3B:8C:F2:F8:10:B3:7D:78:B4:CE:EC:19:19:C3:73:34:B9:C7:74 SHA256: 51:3B:2C:EC:B8:10:D4:CD:E5:DD:85:39:1A:DF:C6:C2:DD:60:D8:7B:B7:36:D2:B5:21:48:4A:A4:7A:0E:BE:F6 Alias name: secomvalicertclass1ca SHA1: E5:DF:74:3C:B6:01:C4:9B:98:43:DC:AB:8C:E8:6A:81:10:9F:E4:8E SHA256: F4:C1:49:55:1A:30:13:A3:5B:C7:BF:FE:17:A7:F3:44:9B:C1:AB:5B:5A:0A:E7:4B:06:C2:3B:90:00:4C:01:04 Alias name: secureglobalca SHA1: 3A:44:73:5A:E5:81:90:1F:24:86:61:46:1E:3B:9C:C4:5F:F5:3A:1B SHA256: 42:00:F5:04:3A:C8:59:0E:BB:52:7D:20:9E:D1:50:30:29:FB:CB:D4:1C:A1:B5:06:EC:27:F1:5A:DE:7D:AC:69 Alias name: securesignrootca11 SHA1: 3B:C4:9F:48:F8:F3:73:A0:9C:1E:BD:F8:5B:B1:C3:65:C7:D8:11:B3 Client certificates 948 Amazon API Gateway SHA256: Developer Guide BF:0F:EE:FB:9E:3A:58:1A:D5:F9:E9:DB:75:89:98:57:43:D2:61:08:5C:4D:31:4F:6F:5D:72:59:AA:42:16:12 Alias name: securetrustca SHA1: 87:82:C6:C3:04:35:3B:CF:D2:96:92:D2:59:3E:7D:44:D9:34:FF:11 SHA256: F1:C1:B5:0A:E5:A2:0D:D8:03:0E:C9:F6:BC:24:82:3D:D3:67:B5:25:57:59:B4:E7:1B:61:FC:E9:F7:37:5D:73 Alias name: securitycommunicationrootca SHA1: 36:B1:2B:49:F9:81:9E:D7:4C:9E:BC:38:0F:C6:56:8F:5D:AC:B2:F7 SHA256: E7:5E:72:ED:9F:56:0E:EC:6E:B4:80:00:73:A4:3F:C3:AD:19:19:5A:39:22:82:01:78:95:97:4A:99:02:6B:6C Alias
apigateway-dg-254
apigateway-dg.pdf
254
Alias name: quovadisrootca1g3 SHA1: 1B:8E:EA:57:96:29:1A:C9:39:EA:B8:0A:81:1A:73:73:C0:93:79:67 SHA256: 8A:86:6F:D1:B2:76:B5:7E:57:8E:92:1C:65:82:8A:2B:ED:58:E9:F2:F2:88:05:41:34:B7:F1:F4:BF:C9:CC:74 Alias name: quovadisrootca2 SHA1: CA:3A:FB:CF:12:40:36:4B:44:B2:16:20:88:80:48:39:19:93:7C:F7 SHA256: 85:A0:DD:7D:D7:20:AD:B7:FF:05:F8:3D:54:2B:20:9D:C7:FF:45:28:F7:D6:77:B1:83:89:FE:A5:E5:C4:9E:86 Alias name: quovadisrootca2g3 SHA1: 09:3C:61:F3:8B:8B:DC:7D:55:DF:75:38:02:05:00:E1:25:F5:C8:36 SHA256: 8F:E4:FB:0A:F9:3A:4D:0D:67:DB:0B:EB:B2:3E:37:C7:1B:F3:25:DC:BC:DD:24:0E:A0:4D:AF:58:B4:7E:18:40 Alias name: quovadisrootca3 SHA1: 1F:49:14:F7:D8:74:95:1D:DD:AE:02:C0:BE:FD:3A:2D:82:75:51:85 SHA256: 18:F1:FC:7F:20:5D:F8:AD:DD:EB:7F:E0:07:DD:57:E3:AF:37:5A:9C:4D:8D:73:54:6B:F4:F1:FE:D1:E1:8D:35 Alias name: quovadisrootca3g3 SHA1: 48:12:BD:92:3C:A8:C4:39:06:E7:30:6D:27:96:E6:A4:CF:22:2E:7D SHA256: 88:EF:81:DE:20:2E:B0:18:45:2E:43:F8:64:72:5C:EA:5F:BD:1F:C2:D9:D2:05:73:07:09:C5:D8:B8:69:0F:46 Alias name: secomevrootca1 SHA1: FE:B8:C4:32:DC:F9:76:9A:CE:AE:3D:D8:90:8F:FD:28:86:65:64:7D SHA256: A2:2D:BA:68:1E:97:37:6E:2D:39:7D:72:8A:AE:3A:9B:62:96:B9:FD:BA:60:BC:2E:11:F6:47:F2:C6:75:FB:37 Alias name: secomscrootca1 SHA1: 36:B1:2B:49:F9:81:9E:D7:4C:9E:BC:38:0F:C6:56:8F:5D:AC:B2:F7 SHA256: E7:5E:72:ED:9F:56:0E:EC:6E:B4:80:00:73:A4:3F:C3:AD:19:19:5A:39:22:82:01:78:95:97:4A:99:02:6B:6C Alias name: secomscrootca2 SHA1: 5F:3B:8C:F2:F8:10:B3:7D:78:B4:CE:EC:19:19:C3:73:34:B9:C7:74 SHA256: 51:3B:2C:EC:B8:10:D4:CD:E5:DD:85:39:1A:DF:C6:C2:DD:60:D8:7B:B7:36:D2:B5:21:48:4A:A4:7A:0E:BE:F6 Alias name: secomvalicertclass1ca SHA1: E5:DF:74:3C:B6:01:C4:9B:98:43:DC:AB:8C:E8:6A:81:10:9F:E4:8E SHA256: F4:C1:49:55:1A:30:13:A3:5B:C7:BF:FE:17:A7:F3:44:9B:C1:AB:5B:5A:0A:E7:4B:06:C2:3B:90:00:4C:01:04 Alias name: secureglobalca SHA1: 3A:44:73:5A:E5:81:90:1F:24:86:61:46:1E:3B:9C:C4:5F:F5:3A:1B SHA256: 42:00:F5:04:3A:C8:59:0E:BB:52:7D:20:9E:D1:50:30:29:FB:CB:D4:1C:A1:B5:06:EC:27:F1:5A:DE:7D:AC:69 Alias name: securesignrootca11 SHA1: 3B:C4:9F:48:F8:F3:73:A0:9C:1E:BD:F8:5B:B1:C3:65:C7:D8:11:B3 Client certificates 948 Amazon API Gateway SHA256: Developer Guide BF:0F:EE:FB:9E:3A:58:1A:D5:F9:E9:DB:75:89:98:57:43:D2:61:08:5C:4D:31:4F:6F:5D:72:59:AA:42:16:12 Alias name: securetrustca SHA1: 87:82:C6:C3:04:35:3B:CF:D2:96:92:D2:59:3E:7D:44:D9:34:FF:11 SHA256: F1:C1:B5:0A:E5:A2:0D:D8:03:0E:C9:F6:BC:24:82:3D:D3:67:B5:25:57:59:B4:E7:1B:61:FC:E9:F7:37:5D:73 Alias name: securitycommunicationrootca SHA1: 36:B1:2B:49:F9:81:9E:D7:4C:9E:BC:38:0F:C6:56:8F:5D:AC:B2:F7 SHA256: E7:5E:72:ED:9F:56:0E:EC:6E:B4:80:00:73:A4:3F:C3:AD:19:19:5A:39:22:82:01:78:95:97:4A:99:02:6B:6C Alias name: securitycommunicationrootca2 SHA1: 5F:3B:8C:F2:F8:10:B3:7D:78:B4:CE:EC:19:19:C3:73:34:B9:C7:74 SHA256: 51:3B:2C:EC:B8:10:D4:CD:E5:DD:85:39:1A:DF:C6:C2:DD:60:D8:7B:B7:36:D2:B5:21:48:4A:A4:7A:0E:BE:F6 Alias name: soneraclass1ca SHA1: 07:47:22:01:99:CE:74:B9:7C:B0:3D:79:B2:64:A2:C8:55:E9:33:FF SHA256: CD:80:82:84:CF:74:6F:F2:FD:6E:B5:8A:A1:D5:9C:4A:D4:B3:CA:56:FD:C6:27:4A:89:26:A7:83:5F:32:31:3D Alias name: soneraclass2ca SHA1: 37:F7:6D:E6:07:7C:90:C5:B1:3E:93:1A:B7:41:10:B4:F2:E4:9A:27 SHA256: 79:08:B4:03:14:C1:38:10:0B:51:8D:07:35:80:7F:FB:FC:F8:51:8A:00:95:33:71:05:BA:38:6B:15:3D:D9:27 Alias name: soneraclass2rootca SHA1: 37:F7:6D:E6:07:7C:90:C5:B1:3E:93:1A:B7:41:10:B4:F2:E4:9A:27 SHA256: 79:08:B4:03:14:C1:38:10:0B:51:8D:07:35:80:7F:FB:FC:F8:51:8A:00:95:33:71:05:BA:38:6B:15:3D:D9:27 Alias name: sslcomevrootcertificationauthorityecc SHA1: 4C:DD:51:A3:D1:F5:20:32:14:B0:C6:C5:32:23:03:91:C7:46:42:6D SHA256: 22:A2:C1:F7:BD:ED:70:4C:C1:E7:01:B5:F4:08:C3:10:88:0F:E9:56:B5:DE:2A:4A:44:F9:9C:87:3A:25:A7:C8 Alias name: sslcomevrootcertificationauthorityrsar2 SHA1: 74:3A:F0:52:9B:D0:32:A0:F4:4A:83:CD:D4:BA:A9:7B:7C:2E:C4:9A SHA256: 2E:7B:F1:6C:C2:24:85:A7:BB:E2:AA:86:96:75:07:61:B0:AE:39:BE:3B:2F:E9:D0:CC:6D:4E:F7:34:91:42:5C Alias name: sslcomrootcertificationauthorityecc SHA1: C3:19:7C:39:24:E6:54:AF:1B:C4:AB:20:95:7A:E2:C3:0E:13:02:6A SHA256: 34:17:BB:06:CC:60:07:DA:1B:96:1C:92:0B:8A:B4:CE:3F:AD:82:0E:4A:A3:0B:9A:CB:C4:A7:4E:BD:CE:BC:65 Alias name: sslcomrootcertificationauthorityrsa SHA1: B7:AB:33:08:D1:EA:44:77:BA:14:80:12:5A:6F:BD:A9:36:49:0C:BB SHA256: 85:66:6A:56:2E:E0:BE:5C:E9:25:C1:D8:89:0A:6F:76:A8:7E:C1:6D:4D:7D:5F:29:EA:74:19:CF:20:12:3B:69 Alias name: staatdernederlandenevrootca SHA1: 76:E2:7E:C1:4F:DB:82:C1:C0:A6:75:B5:05:BE:3D:29:B4:ED:DB:BB Client certificates 949 Amazon API Gateway SHA256: Developer Guide 4D:24:91:41:4C:FE:95:67:46:EC:4C:EF:A6:CF:6F:72:E2:8A:13:29:43:2F:9D:8A:90:7A:C4:CB:5D:AD:C1:5A Alias name: staatdernederlandenrootcag3 SHA1: D8:EB:6B:41:51:92:59:E0:F3:E7:85:00:C0:3D:B6:88:97:C9:EE:FC SHA256: 3C:4F:B0:B9:5A:B8:B3:00:32:F4:32:B8:6F:53:5F:E1:72:C1:85:D0:FD:39:86:58:37:CF:36:18:7F:A6:F4:28 Alias name: starfieldclass2ca SHA1: AD:7E:1C:28:B0:64:EF:8F:60:03:40:20:14:C3:D0:E3:37:0E:B5:8A SHA256: 14:65:FA:20:53:97:B8:76:FA:A6:F0:A9:95:8E:55:90:E4:0F:CC:7F:AA:4F:B7:C2:C8:67:75:21:FB:5F:B6:58 Alias name: starfieldrootcertificateauthorityg2 SHA1: B5:1C:06:7C:EE:2B:0C:3D:F8:55:AB:2D:92:F4:FE:39:D4:E7:0F:0E SHA256: 2C:E1:CB:0B:F9:D2:F9:E1:02:99:3F:BE:21:51:52:C3:B2:DD:0C:AB:DE:1C:68:E5:31:9B:83:91:54:DB:B7:F5 Alias name: starfieldrootg2ca SHA1: B5:1C:06:7C:EE:2B:0C:3D:F8:55:AB:2D:92:F4:FE:39:D4:E7:0F:0E SHA256: 2C:E1:CB:0B:F9:D2:F9:E1:02:99:3F:BE:21:51:52:C3:B2:DD:0C:AB:DE:1C:68:E5:31:9B:83:91:54:DB:B7:F5 Alias name: starfieldservicesrootcertificateauthorityg2 SHA1: 92:5A:8F:8D:2C:6D:04:E0:66:5F:59:6A:FF:22:D8:63:E8:25:6F:3F SHA256: 56:8D:69:05:A2:C8:87:08:A4:B3:02:51:90:ED:CF:ED:B1:97:4A:60:6A:13:C6:E5:29:0F:CB:2A:E6:3E:DA:B5 Alias name: starfieldservicesrootg2ca SHA1: 92:5A:8F:8D:2C:6D:04:E0:66:5F:59:6A:FF:22:D8:63:E8:25:6F:3F SHA256: 56:8D:69:05:A2:C8:87:08:A4:B3:02:51:90:ED:CF:ED:B1:97:4A:60:6A:13:C6:E5:29:0F:CB:2A:E6:3E:DA:B5 Alias name: swisssigngoldcag2 SHA1: D8:C5:38:8A:B7:30:1B:1B:6E:D4:7A:E6:45:25:3A:6F:9F:1A:27:61 SHA256: 62:DD:0B:E9:B9:F5:0A:16:3E:A0:F8:E7:5C:05:3B:1E:CA:57:EA:55:C8:68:8F:64:7C:68:81:F2:C8:35:7B:95 Alias name: swisssigngoldg2ca SHA1: D8:C5:38:8A:B7:30:1B:1B:6E:D4:7A:E6:45:25:3A:6F:9F:1A:27:61 SHA256: 62:DD:0B:E9:B9:F5:0A:16:3E:A0:F8:E7:5C:05:3B:1E:CA:57:EA:55:C8:68:8F:64:7C:68:81:F2:C8:35:7B:95 Alias name: swisssignplatinumg2ca SHA1: 56:E0:FA:C0:3B:8F:18:23:55:18:E5:D3:11:CA:E8:C2:43:31:AB:66 SHA256: 3B:22:2E:56:67:11:E9:92:30:0D:C0:B1:5A:B9:47:3D:AF:DE:F8:C8:4D:0C:EF:7D:33:17:B4:C1:82:1D:14:36 Alias name: swisssignsilvercag2 SHA1: 9B:AA:E5:9F:56:EE:21:CB:43:5A:BE:25:93:DF:A7:F0:40:D1:1D:CB SHA256: BE:6C:4D:A2:BB:B9:BA:59:B6:F3:93:97:68:37:42:46:C3:C0:05:99:3F:A9:8F:02:0D:1D:ED:BE:D4:8A:81:D5 Alias name: swisssignsilverg2ca SHA1: 9B:AA:E5:9F:56:EE:21:CB:43:5A:BE:25:93:DF:A7:F0:40:D1:1D:CB Client certificates 950 Amazon API Gateway SHA256: Developer Guide BE:6C:4D:A2:BB:B9:BA:59:B6:F3:93:97:68:37:42:46:C3:C0:05:99:3F:A9:8F:02:0D:1D:ED:BE:D4:8A:81:D5 Alias name: szafirrootca2 SHA1: E2:52:FA:95:3F:ED:DB:24:60:BD:6E:28:F3:9C:CC:CF:5E:B3:3F:DE SHA256: A1:33:9D:33:28:1A:0B:56:E5:57:D3:D3:2B:1C:E7:F9:36:7E:B0:94:BD:5F:A7:2A:7E:50:04:C8:DE:D7:CA:FE Alias name: teliasonerarootcav1 SHA1: 43:13:BB:96:F1:D5:86:9B:C1:4E:6A:92:F6:CF:F6:34:69:87:82:37 SHA256: DD:69:36:FE:21:F8:F0:77:C1:23:A1:A5:21:C1:22:24:F7:22:55:B7:3E:03:A7:26:06:93:E8:A2:4B:0F:A3:89 Alias name: thawtepersonalfreemailca SHA1: E6:18:83:AE:84:CA:C1:C1:CD:52:AD:E8:E9:25:2B:45:A6:4F:B7:E2 SHA256: 5B:38:BD:12:9E:83:D5:A0:CA:D2:39:21:08:94:90:D5:0D:4A:AE:37:04:28:F8:DD:FF:FF:FA:4C:15:64:E1:84 Alias name: thawtepremiumserverca SHA1: E0:AB:05:94:20:72:54:93:05:60:62:02:36:70:F7:CD:2E:FC:66:66 SHA256: 3F:9F:27:D5:83:20:4B:9E:09:C8:A3:D2:06:6C:4B:57:D3:A2:47:9C:36:93:65:08:80:50:56:98:10:5D:BC:E9 Alias name: thawteprimaryrootca SHA1: 91:C6:D6:EE:3E:8A:C8:63:84:E5:48:C2:99:29:5C:75:6C:81:7B:81 SHA256: 8D:72:2F:81:A9:C1:13:C0:79:1D:F1:36:A2:96:6D:B2:6C:95:0A:97:1D:B4:6B:41:99:F4:EA:54:B7:8B:FB:9F Alias name: thawteprimaryrootcag2 SHA1: AA:DB:BC:22:23:8F:C4:01:A1:27:BB:38:DD:F4:1D:DB:08:9E:F0:12 SHA256: A4:31:0D:50:AF:18:A6:44:71:90:37:2A:86:AF:AF:8B:95:1F:FB:43:1D:83:7F:1E:56:88:B4:59:71:ED:15:57 Alias name: thawteprimaryrootcag3 SHA1: F1:8B:53:8D:1B:E9:03:B6:A6:F0:56:43:5B:17:15:89:CA:F3:6B:F2 SHA256: 4B:03:F4:58:07:AD:70:F2:1B:FC:2C:AE:71:C9:FD:E4:60:4C:06:4C:F5:FF:B6:86:BA:E5:DB:AA:D7:FD:D3:4C Alias name: thawteserverca SHA1: 9F:AD:91:A6:CE:6A:C6:C5:00:47:C4:4E:C9:D4:A5:0D:92:D8:49:79 SHA256: 87:C6:78:BF:B8:B2:5F:38:F7:E9:7B:33:69:56:BB:CF:14:4B:BA:CA:A5:36:47:E6:1A:23:25:BC:10:55:31:6B Alias name: trustcenterclass2caii SHA1: AE:50:83:ED:7C:F4:5C:BC:8F:61:C6:21:FE:68:5D:79:42:21:15:6E SHA256: E6:B8:F8:76:64:85:F8:07:AE:7F:8D:AC:16:70:46:1F:07:C0:A1:3E:EF:3A:1F:F7:17:53:8D:7A:BA:D3:91:B4 Alias name: trustcenterclass4caii SHA1: A6:9A:91:FD:05:7F:13:6A:42:63:0B:B1:76:0D:2D:51:12:0C:16:50 SHA256: 32:66:96:7E:59:CD:68:00:8D:9D:D3:20:81:11:85:C7:04:20:5E:8D:95:FD:D8:4F:1C:7B:31:1E:67:04:FC:32 Alias name: trustcenteruniversalcai SHA1: 6B:2F:34:AD:89:58:BE:62:FD:B0:6B:5C:CE:BB:9D:D9:4F:4E:39:F3 Client certificates 951 Amazon API Gateway SHA256: Developer Guide EB:F3:C0:2A:87:89:B1:FB:7D:51:19:95:D6:63:B7:29:06:D9:13:CE:0D:5E:10:56:8A:8A:77:E2:58:61:67:E7 Alias name: trustcoreca1 SHA1: 58:D1:DF:95:95:67:6B:63:C0:F0:5B:1C:17:4D:8B:84:0B:C8:78:BD SHA256: 5A:88:5D:B1:9C:01:D9:12:C5:75:93:88:93:8C:AF:BB:DF:03:1A:B2:D4:8E:91:EE:15:58:9B:42:97:1D:03:9C Alias name: trustcorrootcertca1 SHA1: FF:BD:CD:E7:82:C8:43:5E:3C:6F:26:86:5C:CA:A8:3A:45:5B:C3:0A SHA256: D4:0E:9C:86:CD:8F:E4:68:C1:77:69:59:F4:9E:A7:74:FA:54:86:84:B6:C4:06:F3:90:92:61:F4:DC:E2:57:5C Alias name: trustcorrootcertca2 SHA1: B8:BE:6D:CB:56:F1:55:B9:63:D4:12:CA:4E:06:34:C7:94:B2:1C:C0 SHA256: 07:53:E9:40:37:8C:1B:D5:E3:83:6E:39:5D:AE:A5:CB:83:9E:50:46:F1:BD:0E:AE:19:51:CF:10:FE:C7:C9:65 Alias name: trustisfpsrootca SHA1: 3B:C0:38:0B:33:C3:F6:A6:0C:86:15:22:93:D9:DF:F5:4B:81:C0:04 SHA256: C1:B4:82:99:AB:A5:20:8F:E9:63:0A:CE:55:CA:68:A0:3E:DA:5A:51:9C:88:02:A0:D3:A6:73:BE:8F:8E:55:7D Alias name: ttelesecglobalrootclass2 SHA1: 59:0D:2D:7D:88:4F:40:2E:61:7E:A5:62:32:17:65:CF:17:D8:94:E9 SHA256: 91:E2:F5:78:8D:58:10:EB:A7:BA:58:73:7D:E1:54:8A:8E:CA:CD:01:45:98:BC:0B:14:3E:04:1B:17:05:25:52 Alias name: ttelesecglobalrootclass2ca SHA1: 59:0D:2D:7D:88:4F:40:2E:61:7E:A5:62:32:17:65:CF:17:D8:94:E9 SHA256: 91:E2:F5:78:8D:58:10:EB:A7:BA:58:73:7D:E1:54:8A:8E:CA:CD:01:45:98:BC:0B:14:3E:04:1B:17:05:25:52 Alias name: ttelesecglobalrootclass3 SHA1: 55:A6:72:3E:CB:F2:EC:CD:C3:23:74:70:19:9D:2A:BE:11:E3:81:D1 SHA256: FD:73:DA:D3:1C:64:4F:F1:B4:3B:EF:0C:CD:DA:96:71:0B:9C:D9:87:5E:CA:7E:31:70:7A:F3:E9:6D:52:2B:BD Alias name: ttelesecglobalrootclass3ca SHA1: 55:A6:72:3E:CB:F2:EC:CD:C3:23:74:70:19:9D:2A:BE:11:E3:81:D1 SHA256: FD:73:DA:D3:1C:64:4F:F1:B4:3B:EF:0C:CD:DA:96:71:0B:9C:D9:87:5E:CA:7E:31:70:7A:F3:E9:6D:52:2B:BD Alias name: tubitakkamusmsslkoksertifikasisurum1 SHA1: 31:43:64:9B:EC:CE:27:EC:ED:3A:3F:0B:8F:0D:E4:E8:91:DD:EE:CA SHA256: 46:ED:C3:68:90:46:D5:3A:45:3F:B3:10:4A:B8:0D:CA:EC:65:8B:26:60:EA:16:29:DD:7E:86:79:90:64:87:16 Alias name: twcaglobalrootca SHA1: 9C:BB:48:53:F6:A4:F6:D3:52:A4:E8:32:52:55:60:13:F5:AD:AF:65 SHA256: 59:76:90:07:F7:68:5D:0F:CD:50:87:2F:9F:95:D5:75:5A:5B:2B:45:7D:81:F3:69:2B:61:0A:98:67:2F:0E:1B Alias name: twcarootcertificationauthority SHA1: CF:9E:87:6D:D3:EB:FC:42:26:97:A3:B5:A3:7A:A0:76:A9:06:23:48 Client certificates 952 Amazon API Gateway SHA256: Developer Guide BF:D8:8F:E1:10:1C:41:AE:3E:80:1B:F8:BE:56:35:0E:E9:BA:D1:A6:B9:BD:51:5E:DC:5C:6D:5B:87:11:AC:44 Alias name: ucaextendedvalidationroot SHA1: A3:A1:B0:6F:24:61:23:4A:E3:36:A5:C2:37:FC:A6:FF:DD:F0:D7:3A SHA256: D4:3A:F9:B3:54:73:75:5C:96:84:FC:06:D7:D8:CB:70:EE:5C:28:E7:73:FB:29:4E:B4:1E:E7:17:22:92:4D:24 Alias name: ucaglobalg2root SHA1: 28:F9:78:16:19:7A:FF:18:25:18:AA:44:FE:C1:A0:CE:5C:B6:4C:8A SHA256: 9B:EA:11:C9:76:FE:01:47:64:C1:BE:56:A6:F9:14:B5:A5:60:31:7A:BD:99:88:39:33:82:E5:16:1A:A0:49:3C Alias name: usertrustecc SHA1: D1:CB:CA:5D:B2:D5:2A:7F:69:3B:67:4D:E5:F0:5A:1D:0C:95:7D:F0 SHA256: 4F:F4:60:D5:4B:9C:86:DA:BF:BC:FC:57:12:E0:40:0D:2B:ED:3F:BC:4D:4F:BD:AA:86:E0:6A:DC:D2:A9:AD:7A Alias name: usertrustecccertificationauthority SHA1: D1:CB:CA:5D:B2:D5:2A:7F:69:3B:67:4D:E5:F0:5A:1D:0C:95:7D:F0 SHA256: 4F:F4:60:D5:4B:9C:86:DA:BF:BC:FC:57:12:E0:40:0D:2B:ED:3F:BC:4D:4F:BD:AA:86:E0:6A:DC:D2:A9:AD:7A Alias name: usertrustrsa SHA1: 2B:8F:1B:57:33:0D:BB:A2:D0:7A:6C:51:F7:0E:E9:0D:DA:B9:AD:8E SHA256: E7:93:C9:B0:2F:D8:AA:13:E2:1C:31:22:8A:CC:B0:81:19:64:3B:74:9C:89:89:64:B1:74:6D:46:C3:D4:CB:D2 Alias name: usertrustrsacertificationauthority SHA1: 2B:8F:1B:57:33:0D:BB:A2:D0:7A:6C:51:F7:0E:E9:0D:DA:B9:AD:8E SHA256: E7:93:C9:B0:2F:D8:AA:13:E2:1C:31:22:8A:CC:B0:81:19:64:3B:74:9C:89:89:64:B1:74:6D:46:C3:D4:CB:D2 Alias name: utndatacorpsgcca SHA1: 58:11:9F:0E:12:82:87:EA:50:FD:D9:87:45:6F:4F:78:DC:FA:D6:D4 SHA256: 85:FB:2F:91:DD:12:27:5A:01:45:B6:36:53:4F:84:02:4A:D6:8B:69:B8:EE:88:68:4F:F7:11:37:58:05:B3:48 Alias name: utnuserfirstclientauthemailca SHA1: B1:72:B1:A5:6D:95:F9:1F:E5:02:87:E1:4D:37:EA:6A:44:63:76:8A SHA256: 43:F2:57:41:2D:44:0D:62:74:76:97:4F:87:7D:A8:F1:FC:24:44:56:5A:36:7A:E6:0E:DD:C2:7A:41:25:31:AE Alias name: utnuserfirsthardwareca SHA1: 04:83:ED:33:99:AC:36:08:05:87:22:ED:BC:5E:46:00:E3:BE:F9:D7 SHA256: 6E:A5:47:41:D0:04:66:7E:ED:1B:48:16:63:4A:A3:A7:9E:6E:4B:96:95:0F:82:79:DA:FC:8D:9B:D8:81:21:37 Alias name: utnuserfirstobjectca SHA1: E1:2D:FB:4B:41:D7:D9:C3:2B:30:51:4B:AC:1D:81:D8:38:5E:2D:46 SHA256: 6F:FF:78:E4:00:A7:0C:11:01:1C:D8:59:77:C4:59:FB:5A:F9:6A:3D:F0:54:08:20:D0:F4:B8:60:78:75:E5:8F Alias name: valicertclass2ca SHA1: 31:7A:2A:D0:7F:2B:33:5E:F5:A1:C3:4E:4B:57:E8:B7:D8:F1:FC:A6 Client certificates 953 Amazon API Gateway SHA256: Developer Guide 58:D0:17:27:9C:D4:DC:63:AB:DD:B1:96:A6:C9:90:6C:30:C4:E0:87:83:EA:E8:C1:60:99:54:D6:93:55:59:6B Alias name: verisignc1g1.pem SHA1: 90:AE:A2:69:85:FF:14:80:4C:43:49:52:EC:E9:60:84:77:AF:55:6F SHA256: D1:7C:D8:EC:D5:86:B7:12:23:8A:48:2C:E4:6F:A5:29:39:70:74:2F:27:6D:8A:B6:A9:E4:6E:E0:28:8F:33:55 Alias name: verisignc1g2.pem SHA1: 27:3E:E1:24:57:FD:C4:F9:0C:55:E8:2B:56:16:7F:62:F5:32:E5:47 SHA256: 34:1D:E9:8B:13:92:AB:F7:F4:AB:90:A9:60:CF:25:D4:BD:6E:C6:5B:9A:51:CE:6E:D0:67:D0:0E:C7:CE:9B:7F Alias name: verisignc1g3.pem SHA1: 20:42:85:DC:F7:EB:76:41:95:57:8E:13:6B:D4:B7:D1:E9:8E:46:A5 SHA256: CB:B5:AF:18:5E:94:2A:24:02:F9:EA:CB:C0:ED:5B:B8:76:EE:A3:C1:22:36:23:D0:04:47:E4:F3:BA:55:4B:65 Alias name: verisignc1g6.pem SHA1: 51:7F:61:1E:29:91:6B:53:82:FB:72:E7:44:D9:8D:C3:CC:53:6D:64 SHA256: 9D:19:0B:2E:31:45:66:68:5B:E8:A8:89:E2:7A:A8:C7:D7:AE:1D:8A:AD:DB:A3:C1:EC:F9:D2:48:63:CD:34:B9 Alias name: verisignc2g1.pem SHA1: 67:82:AA:E0:ED:EE:E2:1A:58:39:D3:C0:CD:14:68:0A:4F:60:14:2A SHA256: BD:46:9F:F4:5F:AA:E7:C5:4C:CB:D6:9D:3F:3B:00:22:55:D9:B0:6B:10:B1:D0:FA:38:8B:F9:6B:91:8B:2C:E9 Alias name: verisignc2g2.pem SHA1: B3:EA:C4:47:76:C9:C8:1C:EA:F2:9D:95:B6:CC:A0:08:1B:67:EC:9D SHA256: 3A:43:E2:20:FE:7F:3E:A9:65:3D:1E:21:74:2E:AC:2B:75:C2:0F:D8:98:03:05:BC:50:2C:AF:8C:2D:9B:41:A1 Alias name: verisignc2g3.pem SHA1: 61:EF:43:D7:7F:CA:D4:61:51:BC:98:E0:C3:59:12:AF:9F:EB:63:11 SHA256: 92:A9:D9:83:3F:E1:94:4D:B3:66:E8:BF:AE:7A:95:B6:48:0C:2D:6C:6C:2A:1B:E6:5D:42:36:B6:08:FC:A1:BB Alias name: verisignc2g6.pem SHA1: 40:B3:31:A0:E9:BF:E8:55:BC:39:93:CA:70:4F:4E:C2:51:D4:1D:8F SHA256: CB:62:7D:18:B5:8A:D5:6D:DE:33:1A:30:45:6B:C6:5C:60:1A:4E:9B:18:DE:DC:EA:08:E7:DA:AA:07:81:5F:F0 Alias name: verisignc3g1.pem SHA1: A1:DB:63:93:91:6F:17:E4:18:55:09:40:04:15:C7:02:40:B0:AE:6B SHA256: A4:B6:B3:99:6F:C2:F3:06:B3:FD:86:81:BD:63:41:3D:8C:50:09:CC:4F:A3:29:C2:CC:F0:E2:FA:1B:14:03:05 Alias name: verisignc3g2.pem SHA1: 85:37:1C:A6:E5:50:14:3D:CE:28:03:47:1B:DE:3A:09:E8:F8:77:0F SHA256: 83:CE:3C:12:29:68:8A:59:3D:48:5F:81:97:3C:0F:91:95:43:1E:DA:37:CC:5E:36:43:0E:79:C7:A8:88:63:8B Alias name: verisignc3g3.pem SHA1: 13:2D:0D:45:53:4B:69:97:CD:B2:D5:C3:39:E2:55:76:60:9B:5C:C6 Client certificates 954 Amazon API Gateway SHA256: Developer Guide EB:04:CF:5E:B1:F3:9A:FA:76:2F:2B:B1:20:F2:96:CB:A5:20:C1:B9:7D:B1:58:95:65:B8:1C:B9:A1:7B:72:44 Alias name: verisignc3g4.pem SHA1: 22:D5:D8:DF:8F:02:31:D1:8D:F7:9D:B7:CF:8A:2D:64:C9:3F:6C:3A SHA256: 69:DD:D7:EA:90:BB:57:C9:3E:13:5D:C8:5E:A6:FC:D5:48:0B:60:32:39:BD:C4:54:FC:75:8B:2A:26:CF:7F:79 Alias name: verisignc3g5.pem SHA1: 4E:B6:D5:78:49:9B:1C:CF:5F:58:1E:AD:56:BE:3D:9B:67:44:A5:E5 SHA256: 9A:CF:AB:7E:43:C8:D8:80:D0:6B:26:2A:94:DE:EE:E4:B4:65:99:89:C3:D0:CA:F1:9B:AF:64:05:E4:1A:B7:DF Alias name: verisignc4g2.pem SHA1: 0B:77:BE:BB:CB:7A:A2:47:05:DE:CC:0F:BD:6A:02:FC:7A:BD:9B:52 SHA256: 44:64:0A:0A:0E:4D:00:0F:BD:57:4D:2B:8A:07:BD:B4:D1:DF:ED:3B:45:BA:AB:A7:6F:78:57:78:C7:01:19:61 Alias name: verisignc4g3.pem SHA1: C8:EC:8C:87:92:69:CB:4B:AB:39:E9:8D:7E:57:67:F3:14:95:73:9D SHA256: E3:89:36:0D:0F:DB:AE:B3:D2:50:58:4B:47:30:31:4E:22:2F:39:C1:56:A0:20:14:4E:8D:96:05:61:79:15:06 Alias name: verisignclass1ca SHA1: CE:6A:64:A3:09:E4:2F:BB:D9:85:1C:45:3E:64:09:EA:E8:7D:60:F1 SHA256: 51:84:7C:8C:BD:2E:9A:72:C9:1E:29:2D:2A:E2:47:D7:DE:1E:3F:D2:70:54:7A:20:EF:7D:61:0F:38:B8:84:2C Alias name: verisignclass1g2ca SHA1: 27:3E:E1:24:57:FD:C4:F9:0C:55:E8:2B:56:16:7F:62:F5:32:E5:47 SHA256: 34:1D:E9:8B:13:92:AB:F7:F4:AB:90:A9:60:CF:25:D4:BD:6E:C6:5B:9A:51:CE:6E:D0:67:D0:0E:C7:CE:9B:7F Alias name: verisignclass1g3ca SHA1: 20:42:85:DC:F7:EB:76:41:95:57:8E:13:6B:D4:B7:D1:E9:8E:46:A5 SHA256: CB:B5:AF:18:5E:94:2A:24:02:F9:EA:CB:C0:ED:5B:B8:76:EE:A3:C1:22:36:23:D0:04:47:E4:F3:BA:55:4B:65 Alias name: verisignclass2g2ca SHA1: B3:EA:C4:47:76:C9:C8:1C:EA:F2:9D:95:B6:CC:A0:08:1B:67:EC:9D SHA256: 3A:43:E2:20:FE:7F:3E:A9:65:3D:1E:21:74:2E:AC:2B:75:C2:0F:D8:98:03:05:BC:50:2C:AF:8C:2D:9B:41:A1 Alias name: verisignclass2g3ca SHA1: 61:EF:43:D7:7F:CA:D4:61:51:BC:98:E0:C3:59:12:AF:9F:EB:63:11 SHA256: 92:A9:D9:83:3F:E1:94:4D:B3:66:E8:BF:AE:7A:95:B6:48:0C:2D:6C:6C:2A:1B:E6:5D:42:36:B6:08:FC:A1:BB Alias name: verisignclass3ca SHA1: A1:DB:63:93:91:6F:17:E4:18:55:09:40:04:15:C7:02:40:B0:AE:6B SHA256: A4:B6:B3:99:6F:C2:F3:06:B3:FD:86:81:BD:63:41:3D:8C:50:09:CC:4F:A3:29:C2:CC:F0:E2:FA:1B:14:03:05 Alias name: verisignclass3g2ca SHA1: 85:37:1C:A6:E5:50:14:3D:CE:28:03:47:1B:DE:3A:09:E8:F8:77:0F Client certificates 955 Amazon API Gateway SHA256: Developer Guide 83:CE:3C:12:29:68:8A:59:3D:48:5F:81:97:3C:0F:91:95:43:1E:DA:37:CC:5E:36:43:0E:79:C7:A8:88:63:8B Alias name: verisignclass3g3ca SHA1: 13:2D:0D:45:53:4B:69:97:CD:B2:D5:C3:39:E2:55:76:60:9B:5C:C6 SHA256: EB:04:CF:5E:B1:F3:9A:FA:76:2F:2B:B1:20:F2:96:CB:A5:20:C1:B9:7D:B1:58:95:65:B8:1C:B9:A1:7B:72:44 Alias name: verisignclass3g4ca SHA1: 22:D5:D8:DF:8F:02:31:D1:8D:F7:9D:B7:CF:8A:2D:64:C9:3F:6C:3A SHA256: 69:DD:D7:EA:90:BB:57:C9:3E:13:5D:C8:5E:A6:FC:D5:48:0B:60:32:39:BD:C4:54:FC:75:8B:2A:26:CF:7F:79 Alias name: verisignclass3g5ca SHA1: 4E:B6:D5:78:49:9B:1C:CF:5F:58:1E:AD:56:BE:3D:9B:67:44:A5:E5 SHA256: 9A:CF:AB:7E:43:C8:D8:80:D0:6B:26:2A:94:DE:EE:E4:B4:65:99:89:C3:D0:CA:F1:9B:AF:64:05:E4:1A:B7:DF Alias name: verisignclass3publicprimarycertificationauthorityg4 SHA1: 22:D5:D8:DF:8F:02:31:D1:8D:F7:9D:B7:CF:8A:2D:64:C9:3F:6C:3A SHA256: 69:DD:D7:EA:90:BB:57:C9:3E:13:5D:C8:5E:A6:FC:D5:48:0B:60:32:39:BD:C4:54:FC:75:8B:2A:26:CF:7F:79 Alias name: verisignclass3publicprimarycertificationauthorityg5 SHA1: 4E:B6:D5:78:49:9B:1C:CF:5F:58:1E:AD:56:BE:3D:9B:67:44:A5:E5 SHA256: 9A:CF:AB:7E:43:C8:D8:80:D0:6B:26:2A:94:DE:EE:E4:B4:65:99:89:C3:D0:CA:F1:9B:AF:64:05:E4:1A:B7:DF Alias name: verisignroot.pem SHA1: 36:79:CA:35:66:87:72:30:4D:30:A5:FB:87:3B:0F:A7:7B:B7:0D:54 SHA256: 23:99:56:11:27:A5:71:25:DE:8C:EF:EA:61:0D:DF:2F:A0:78:B5:C8:06:7F:4E:82:82:90:BF:B8:60:E8:4B:3C Alias name: verisigntsaca SHA1: 20:CE:B1:F0:F5:1C:0E:19:A9:F3:8D:B1:AA:8E:03:8C:AA:7A:C7:01 SHA256: CB:6B:05:D9:E8:E5:7C:D8:82:B1:0B:4D:B7:0D:E4:BB:1D:E4:2B:A4:8A:7B:D0:31:8B:63:5B:F6:E7:78:1A:9D Alias name: verisignuniversalrootca SHA1: 36:79:CA:35:66:87:72:30:4D:30:A5:FB:87:3B:0F:A7:7B:B7:0D:54 SHA256: 23:99:56:11:27:A5:71:25:DE:8C:EF:EA:61:0D:DF:2F:A0:78:B5:C8:06:7F:4E:82:82:90:BF:B8:60:E8:4B:3C Alias name: verisignuniversalrootcertificationauthority SHA1: 36:79:CA:35:66:87:72:30:4D:30:A5:FB:87:3B:0F:A7:7B:B7:0D:54 SHA256: 23:99:56:11:27:A5:71:25:DE:8C:EF:EA:61:0D:DF:2F:A0:78:B5:C8:06:7F:4E:82:82:90:BF:B8:60:E8:4B:3C Alias name: xrampglobalca SHA1: B8:01:86:D1:EB:9C:86:A5:41:04:CF:30:54:F3:4C:52:B7:E5:58:C6 SHA256: CE:CD:DC:90:50:99:D8:DA:DF:C5:B1:D2:09:B7:37:CB:E2:C1:8C:FB:2C:10:C0:FF:0B:CF:0D:32:86:FC:1A:A2 Alias name: xrampglobalcaroot SHA1: B8:01:86:D1:EB:9C:86:A5:41:04:CF:30:54:F3:4C:52:B7:E5:58:C6 Client certificates 956 Amazon API Gateway SHA256: Developer Guide CE:CD:DC:90:50:99:D8:DA:DF:C5:B1:D2:09:B7:37:CB:E2:C1:8C:FB:2C:10:C0:FF:0B:CF:0D:32:86:FC:1A:A2 Use AWS WAF to protect your REST APIs in API Gateway AWS WAF is a web application firewall that helps protect web applications and APIs from attacks. It enables you to configure a set of
apigateway-dg-255
apigateway-dg.pdf
255
9A:CF:AB:7E:43:C8:D8:80:D0:6B:26:2A:94:DE:EE:E4:B4:65:99:89:C3:D0:CA:F1:9B:AF:64:05:E4:1A:B7:DF Alias name: verisignclass3publicprimarycertificationauthorityg4 SHA1: 22:D5:D8:DF:8F:02:31:D1:8D:F7:9D:B7:CF:8A:2D:64:C9:3F:6C:3A SHA256: 69:DD:D7:EA:90:BB:57:C9:3E:13:5D:C8:5E:A6:FC:D5:48:0B:60:32:39:BD:C4:54:FC:75:8B:2A:26:CF:7F:79 Alias name: verisignclass3publicprimarycertificationauthorityg5 SHA1: 4E:B6:D5:78:49:9B:1C:CF:5F:58:1E:AD:56:BE:3D:9B:67:44:A5:E5 SHA256: 9A:CF:AB:7E:43:C8:D8:80:D0:6B:26:2A:94:DE:EE:E4:B4:65:99:89:C3:D0:CA:F1:9B:AF:64:05:E4:1A:B7:DF Alias name: verisignroot.pem SHA1: 36:79:CA:35:66:87:72:30:4D:30:A5:FB:87:3B:0F:A7:7B:B7:0D:54 SHA256: 23:99:56:11:27:A5:71:25:DE:8C:EF:EA:61:0D:DF:2F:A0:78:B5:C8:06:7F:4E:82:82:90:BF:B8:60:E8:4B:3C Alias name: verisigntsaca SHA1: 20:CE:B1:F0:F5:1C:0E:19:A9:F3:8D:B1:AA:8E:03:8C:AA:7A:C7:01 SHA256: CB:6B:05:D9:E8:E5:7C:D8:82:B1:0B:4D:B7:0D:E4:BB:1D:E4:2B:A4:8A:7B:D0:31:8B:63:5B:F6:E7:78:1A:9D Alias name: verisignuniversalrootca SHA1: 36:79:CA:35:66:87:72:30:4D:30:A5:FB:87:3B:0F:A7:7B:B7:0D:54 SHA256: 23:99:56:11:27:A5:71:25:DE:8C:EF:EA:61:0D:DF:2F:A0:78:B5:C8:06:7F:4E:82:82:90:BF:B8:60:E8:4B:3C Alias name: verisignuniversalrootcertificationauthority SHA1: 36:79:CA:35:66:87:72:30:4D:30:A5:FB:87:3B:0F:A7:7B:B7:0D:54 SHA256: 23:99:56:11:27:A5:71:25:DE:8C:EF:EA:61:0D:DF:2F:A0:78:B5:C8:06:7F:4E:82:82:90:BF:B8:60:E8:4B:3C Alias name: xrampglobalca SHA1: B8:01:86:D1:EB:9C:86:A5:41:04:CF:30:54:F3:4C:52:B7:E5:58:C6 SHA256: CE:CD:DC:90:50:99:D8:DA:DF:C5:B1:D2:09:B7:37:CB:E2:C1:8C:FB:2C:10:C0:FF:0B:CF:0D:32:86:FC:1A:A2 Alias name: xrampglobalcaroot SHA1: B8:01:86:D1:EB:9C:86:A5:41:04:CF:30:54:F3:4C:52:B7:E5:58:C6 Client certificates 956 Amazon API Gateway SHA256: Developer Guide CE:CD:DC:90:50:99:D8:DA:DF:C5:B1:D2:09:B7:37:CB:E2:C1:8C:FB:2C:10:C0:FF:0B:CF:0D:32:86:FC:1A:A2 Use AWS WAF to protect your REST APIs in API Gateway AWS WAF is a web application firewall that helps protect web applications and APIs from attacks. It enables you to configure a set of rules called a web access control list (web ACL) that allow, block, or count web requests based on customizable web security rules and conditions that you define. For more information, see How AWS WAF Works. You can use AWS WAF to protect your API Gateway REST API from common web exploits, such as SQL injection and cross-site scripting (XSS) attacks. These could affect API availability and performance, compromise security, or consume excessive resources. For example, you can create rules to allow or block requests from specified IP address ranges, requests from CIDR blocks, requests that originate from a specific country or region, requests that contain malicious SQL code, or requests that contain malicious script. You can also create rules that match a specified string or a regular expression pattern in HTTP headers, method, query string, URI, and the request body (limited to the first 64 KB). Additionally, you can create rules to block attacks from specific user agents, bad bots, and content scrapers. For example, you can use rate-based rules to specify the number of web requests that are allowed by each client IP in a trailing, continuously updated, 5-minute period. Important AWS WAF is your first line of defense against web exploits. When AWS WAF is enabled on an API, AWS WAF rules are evaluated before other access control features, such as resource policies, IAM policies, Lambda authorizers, and Amazon Cognito authorizers. For example, if AWS WAF blocks access from a CIDR block that a resource policy allows, AWS WAF takes precedence and the resource policy isn't evaluated. To enable AWS WAF for your API, you need to do the following: 1. Use the AWS WAF console, AWS SDK, or CLI to create a web ACL that contains the desired combination of AWS WAF managed rules and your own custom rules. For more information, see Getting Started with AWS WAF and Web access control lists (web ACLs). AWS WAF 957 Amazon API Gateway Developer Guide Important API Gateway requires an AWS WAFV2 web ACL for a Regional application or an AWS WAF Classic Regional web ACL. 2. Associate the AWS WAF web ACL with an API stage. You can do this by using the AWS WAF console, AWS SDK, CLI, or by using the API Gateway console. To associate an AWS WAF web ACL with an API Gateway API stage using the API Gateway console To use the API Gateway console to associate an AWS WAF web ACL with an existing API Gateway API stage, use the following steps: 1. Sign in to the API Gateway console at https://console.aws.amazon.com/apigateway. 2. Choose an existing API or create a new one. 3. 4. In the main navigation pane, choose Stages, and then choose a stage. In the Stage details section, choose Edit. 5. Under Web application firewall (AWS WAF), select your web ACL. If you are using AWS WAFV2, select an AWS WAFV2 web ACL for a Regional application. The web ACL and any other AWS WAFV2 resources that it uses must be located in the same Region as your API. If you are using AWS WAF Classic Regional, select a Regional web ACL. 6. Choose Save changes. Associate an AWS WAF web ACL with an API Gateway API stage using the AWS CLI The following associate-web-acl command associates an AWS WAFV2 web ACL for a Regional application with an existing API Gateway API stage: aws wafv2 associate-web-acl \ --web-acl-arn arn:aws:wafv2:{region}:111122223333:regional/webacl/test-cli/ a1b2c3d4-5678-90ab-cdef-EXAMPLE11111 \ --resource-arn arn:aws:apigateway:{region}::/restapis/4wk1k4onj3/stages/prod AWS WAF 958 Amazon API Gateway Developer Guide The following associate-web-acl command associates an AWS WAF Classic Regional web ACL with an existing API Gateway API stage: aws waf-regional associate-web-acl \ --web-acl-id 'aabc123a-fb4f-4fc6-becb-2b00831cadcf' \ --resource-arn 'arn:aws:apigateway:{region}::/restapis/4wk1k4onj3/stages/prod' Associate an AWS WAF web ACL with an API stage using the AWS WAF REST API To use the AWS WAFV2 REST API to associate an AWS WAFV2 web ACL for a Regional application with an existing API Gateway API stage, use the AssociateWebACL command, as in the following example: import boto3 wafv2 = boto3.client('wafv2') wafv2.associate_web_acl( WebACLArn='arn:aws:wafv2:{region}:111122223333:regional/webacl/test/abc6aa3b- fc33-4841-b3db-0ef3d3825b25', ResourceArn='arn:aws:apigateway:{region}::/restapis/4wk1k4onj3/stages/prod' ) To use the AWS WAF REST API to associate an AWS WAF Classic Regional web ACL with an existing API Gateway API stage, use the AssociateWebACL command, as in the
apigateway-dg-256
apigateway-dg.pdf
256
stage: aws waf-regional associate-web-acl \ --web-acl-id 'aabc123a-fb4f-4fc6-becb-2b00831cadcf' \ --resource-arn 'arn:aws:apigateway:{region}::/restapis/4wk1k4onj3/stages/prod' Associate an AWS WAF web ACL with an API stage using the AWS WAF REST API To use the AWS WAFV2 REST API to associate an AWS WAFV2 web ACL for a Regional application with an existing API Gateway API stage, use the AssociateWebACL command, as in the following example: import boto3 wafv2 = boto3.client('wafv2') wafv2.associate_web_acl( WebACLArn='arn:aws:wafv2:{region}:111122223333:regional/webacl/test/abc6aa3b- fc33-4841-b3db-0ef3d3825b25', ResourceArn='arn:aws:apigateway:{region}::/restapis/4wk1k4onj3/stages/prod' ) To use the AWS WAF REST API to associate an AWS WAF Classic Regional web ACL with an existing API Gateway API stage, use the AssociateWebACL command, as in the following example: import boto3 waf = boto3.client('waf-regional') waf.associate_web_acl( WebACLId='aabc123a-fb4f-4fc6-becb-2b00831cadcf', ResourceArn='arn:aws:apigateway:{region}::/restapis/4wk1k4onj3/stages/prod' ) AWS WAF 959 Amazon API Gateway Developer Guide Throttle requests to your REST APIs for better throughput in API Gateway You can configure throttling and quotas for your APIs to help protect them from being overwhelmed by too many requests. Both throttles and quotas are applied on a best-effort basis and should be thought of as targets rather than guaranteed request ceilings. API Gateway throttles requests to your API using the token bucket algorithm, where a token counts for a request. Specifically, API Gateway examines the rate and a burst of request submissions against all APIs in your account, per Region. In the token bucket algorithm, a burst can allow pre- defined overrun of those limits, but other factors can also cause limits to be overrun in some cases. When request submissions exceed the steady-state request rate and burst limits, API Gateway begins to throttle requests. Clients may receive 429 Too Many Requests error responses at this point. Upon catching such exceptions, the client can resubmit the failed requests in a way that is rate limiting. As an API developer, you can set the target limits for individual API stages or methods to improve overall performance across all APIs in your account. Alternatively, you can enable usage plans to set throttles on client request submissions based on specified requests rates and quotas. Topics • How throttling limit settings are applied in API Gateway • Account-level throttling per Region • Configuring API-level and stage-level throttling targets in a usage plan • Configuring stage-level throttling targets • Configuring method-level throttling targets in a usage plan How throttling limit settings are applied in API Gateway Before you configure throttle and quota settings for your API, it's useful to understand the types of throttling-related settings for your API and how API Gateway applies them. Amazon API Gateway provides four basic types of throttling-related settings: • AWS throttling limits are applied across all accounts and clients in a Region. These limit settings exist to prevent your API—and your account—from being overwhelmed by too many requests. These limits are set by AWS and can't be changed by a customer. Throttling 960 Amazon API Gateway Developer Guide • Per-account limits are applied to all APIs in an account in a specified Region. The account-level rate limit can be increased upon request - higher limits are possible with APIs that have shorter timeouts and smaller payloads. To request an increase of account-level throttling limits per Region, contact the AWS Support Center. For more information, see Quotas and important notes. Note that these limits can't be higher than the AWS throttling limits. • Per-API, per-stage throttling limits are applied at the API method level for a stage. You can configure the same settings for all methods, or configure different throttle settings for each method. Note that these limits can't be higher than the AWS throttling limits. • Per-client throttling limits are applied to clients that use API keys associated with your usage plan as client identifier. Note that these limits can't be higher than the per-account limits. API Gateway applies your throttling-related settings in the following order: 1. Per-client or per-method throttling limits that you set for an API stage in a usage plan 2. Per-method throttling limits that you set for an API stage 3. Account-level throttling per Region 4. AWS Regional throttling Account-level throttling per Region By default, API Gateway limits the steady-state requests per second (RPS) across all APIs within an AWS account, per Region. It also limits the burst (that is, the maximum bucket size) across all APIs within an AWS account, per Region. In API Gateway, the burst limit represents the target maximum number of concurrent request submissions that API Gateway will fulfill before returning 429 Too Many Requests error responses. For more information on throttling quotas, see Quotas and important notes. Configuring API-level and stage-level throttling targets in a usage plan In a usage plan, you can set a per-method throttling target for all methods at the API or stage level. You can specify a throttling rate, which is the rate, in requests per second, that tokens are added to the token
apigateway-dg-257
apigateway-dg.pdf
257
size) across all APIs within an AWS account, per Region. In API Gateway, the burst limit represents the target maximum number of concurrent request submissions that API Gateway will fulfill before returning 429 Too Many Requests error responses. For more information on throttling quotas, see Quotas and important notes. Configuring API-level and stage-level throttling targets in a usage plan In a usage plan, you can set a per-method throttling target for all methods at the API or stage level. You can specify a throttling rate, which is the rate, in requests per second, that tokens are added to the token bucket. You can also specify a throttling burst, which is the capacity of the token bucket. You can use the AWS CLI, SDKs, and the AWS Management Console to create a usage plan. For more information about how to create a usage plan, see ???. Throttling 961 Amazon API Gateway Developer Guide Configuring stage-level throttling targets You can use the AWS CLI, SDKs, and the AWS Management Console to create stage-level throttling targets. For more information about how to use the AWS Management Console to create stage-level throttling targets, see ???. For more information about how to use the AWS CLI to create stage- level throttling targets, see create-stage. Configuring method-level throttling targets in a usage plan You can set additional throttling targets at the method level in Usage Plans as shown in Create a usage plan. In the API Gateway console, these are set by specifying Resource=<resource>, Method=<method> in the Configure Method Throttling setting. For example, for the PetStore example, you might specify Resource=/pets, Method=GET. Private REST APIs in API Gateway A private API is a REST API that is only callable from within an Amazon VPC. You can access your API using an interface VPC endpoint, which is an endpoint network interface that you create in your VPC. Interface endpoints are powered by AWS PrivateLink, a technology that enables you to privately access AWS services by using private IP addresses. You can also use AWS Direct Connect to establish a connection from an on-premises network to Amazon VPC and then access your private API over that connection. In all cases, traffic to your private API uses secure connections and is isolated from the public internet. Traffic doesn't leave the Amazon network. Best practices for private APIs We recommend that you use the following best practices when you create your private API: • Use a single VPC endpoint to access multiple private APIs. This reduces the number of VPC endpoints that you might need. • Associate your VPC endpoint to your API. This creates a Route 53 alias DNS record and simplifies invoking your private API. • Turn on private DNS for your VPC. When you turn on private DNS for your VPC, you can invoke your API within a VPC without passing the Host or x-apigw-api-id header. Private REST APIs 962 Amazon API Gateway Developer Guide If you turn on private DNS, you can’t access the default endpoint for public APIs. To access the default endpoint for public APIs, you can turn off private DNS, create a private hosted zone for each private API in your VPC, and then provision the required records in Route 53. This allows your private API to resolve while you can still invoke public default endpoint from your VPC. For more information, see Creating a private hosted zone. • Restrict access to your private API to specific VPCs or VPC endpoints. Add aws:SourceVpc or aws:SourceVpce conditions to your API's resource policy to restrict access. • For the most secure data perimeter, you can create a VPC endpoint policy. This controls access to the VPC endpoints that can invoke your private API. Considerations for private APIs The following considerations might impact your use of private APIs: • Only REST APIs are supported. • You cannot convert a private API to an edge-optimized API. • Private APIs only support TLS 1.2. Earlier TLS versions are not supported. • If you make a request using HTTP/2 protocol, the request is enforced to use HTTP/1.1 protocol. • You can't set the IP address type for private APIs to only allow IPv4 addresses to invoke your private API. Only dualstack is supported. For more information, see the section called “IP address types for REST APIs in API Gateway”. • To send traffic using your private API, you can use all IP address types supported by Amazon VPC. You can send dualstack and IPv6 traffic by configuring the settings on your VPC endpoint. You can't modify this using API Gateway. For more information, see Add IPv6 support for your VPC. • VPC endpoints for private APIs are subject to the same limitations as other interface VPC endpoints. For more information, see Access an AWS service using an interface VPC
apigateway-dg-258
apigateway-dg.pdf
258
Only dualstack is supported. For more information, see the section called “IP address types for REST APIs in API Gateway”. • To send traffic using your private API, you can use all IP address types supported by Amazon VPC. You can send dualstack and IPv6 traffic by configuring the settings on your VPC endpoint. You can't modify this using API Gateway. For more information, see Add IPv6 support for your VPC. • VPC endpoints for private APIs are subject to the same limitations as other interface VPC endpoints. For more information, see Access an AWS service using an interface VPC endpoint in the AWS PrivateLink Guide. For more information about using API Gateway with shared VPCs and shared subnets, see Shared subnets in the AWS PrivateLink Guide. Next steps for private APIs To learn how to create a private API and associate a VPC endpoint see, the section called “Create a private API”. To follow a tutorial where you create dependencies in AWS CloudFormation and a Private REST APIs 963 Amazon API Gateway Developer Guide private API in the AWS Management Console, see the section called “Tutorial: Create a private REST API”. Create a private API Before you create a private API, you first create a VPC endpoint for API Gateway. Next you create your private API and attach a resource policy to it. Optionally, you can associate your VPC endpoint with your private API to simplify how you invoke your API. Finally, you deploy your API. The following procedures describe how to accomplish this. You can create a private REST API using the AWS Management Console, AWS CLI or an AWS SDK. Prerequisites To follow these steps, you must have a fully configured VPC. To learn how to create a VPC, see Create a VPC only in the Amazon VPC User Guide. To follow all recommend steps when you create your VPC, enable private DNS. This way you can invoke your API within a VPC without having to pass the Host or x-apigw-api-id header. To enable private DNS, the enableDnsSupport and enableDnsHostnames attributes of your VPC must be set to true. For more information, see DNS Support in Your VPC and Updating DNS Support for Your VPC. Step 1: Create a VPC endpoint for API Gateway in your VPC The following procedure shows how to create a VPC endpoint for API Gateway. To create a VPC endpoint for API Gateway, you specify the execute-api domain for the AWS Region where you create your private API. The execute-api domain is the API Gateway component service for API execution. When you create your VPC endpoint for API Gateway, you specify the DNS settings. If you turn off private DNS, you can only access your API using public DNS. For more information, see the section called “Issue: I can't connect to my public API from an API Gateway VPC endpoint”. AWS Management Console To create an interface VPC endpoint for API Gateway 1. Sign in to the AWS Management Console and open the Amazon VPC console at https:// console.aws.amazon.com/vpc/. 2. In the navigation pane, under Virtual private cloud, choose Endpoints. Private REST APIs 964 Amazon API Gateway Developer Guide 3. Choose Create endpoint. 4. 5. (Optional) For Name tag, enter a name to help identify your VPC endpoint. For Service category, choose AWS services. 6. Under Services, in the search bar, enter execute-api. Then, choose the API Gateway service endpoint in the AWS Region where you will create your API. The service name should look like com.amazonaws.us-east-1.execute-api and the Type should be Interface. 7. 8. 9. For VPC, choose the VPC that you want to create the endpoint in. (Optional) To turn off Enable Private DNS Name, choose Additional settings and then clear Enable Private DNS Name. For Subnets, choose the Availability Zones where you created the endpoint network interfaces. To improve the availability of your API, choose multiple subnets. 10. For Security group, select the security group to associate with the VPC endpoint network interfaces. The security group you choose must be set to allow TCP Port 443 inbound HTTPS traffic from either an IP range in your VPC or another security group in your VPC. 11. For Policy, do one of the following: • • If you have not created your private API or you don't want to configure a custom VPC endpoint policy, choose Full access. If you have already created a private API and want to configure a custom VPC endpoint policy, you can enter a custom VPC endpoint policy. For more information, see the section called “Use VPC endpoint policies for private APIs”. You can update the VPC endpoint policy after you create your VPC endpoint. For more information, see Update a VPC endpoint policy. 12. Choose Create endpoint. 13. Copy the resulting VPC endpoint ID, as
apigateway-dg-259
apigateway-dg.pdf
259
of the following: • • If you have not created your private API or you don't want to configure a custom VPC endpoint policy, choose Full access. If you have already created a private API and want to configure a custom VPC endpoint policy, you can enter a custom VPC endpoint policy. For more information, see the section called “Use VPC endpoint policies for private APIs”. You can update the VPC endpoint policy after you create your VPC endpoint. For more information, see Update a VPC endpoint policy. 12. Choose Create endpoint. 13. Copy the resulting VPC endpoint ID, as you might use it in future steps. AWS CLI The following create-vpc-endpoint command creates a VPC endpoint: aws ec2 create-vpc-endpoint \ --vpc-id vpc-1a2b3c4d \ Private REST APIs 965 Amazon API Gateway Developer Guide --vpc-endpoint-type Interface \ --service-name com.amazonaws.us-east-1.execute-api \ --subnet-ids subnet-7b16de0c \ --security-group-id sg-1a2b3c4d Copy the resulting VPC endpoint ID, as you might use it in future steps. Step 2: Create a private API After you create your VPC endpoint, you create a private REST API. The following procedure shows how to create a private API. AWS Management Console To create a private API 1. Sign in to the API Gateway console at https://console.aws.amazon.com/apigateway. 2. Choose Create API. 3. Under REST API, choose Build. 4. 5. 6. 7. For Name, enter a name. (Optional) For Description, enter a description. For API endpoint type, select Private. (Optional) For VPC endpoint IDs, enter a VPC endpoint ID. If you associate a VPC endpoint ID with your private API, you can invoke your API from within your VPC without overriding a Host header or passing an x-apigw-api-id header For more information, see the section called “(Optional) Associate or disassociate a VPC endpoint with a private API”. 8. For IP address type, choose Dualstack. 9. Choose Create API. After completing the preceding steps, you can follow the instructions in the section called “Get started with the REST API console” to set up methods and integrations for this API, but you can't deploy your API. To deploy your API, follow step 3 and attach a resource policy to your API. AWS CLI The following create-rest-api command creates a private API: Private REST APIs 966 Amazon API Gateway Developer Guide aws apigateway create-rest-api \ --name 'Simple PetStore (AWS CLI, Private)' \ --description 'Simple private PetStore API' \ --region us-west-2 \ --endpoint-configuration '{ "types": ["PRIVATE"], "ipAddressType": "dualstack" }' A successful call returns output similar to the following: { "createdDate": "2017-10-13T18:41:39Z", "description": "Simple private PetStore API", "endpointConfiguration": { "types": [ "PRIVATE" ], "ipAddressType": "dualstack" }, "id": "0qzs2sy7bh", "name": "Simple PetStore (AWS CLI, Private)" } After completing the preceding steps, you can follow the instructions in the section called “Tutorial: Create a REST API using AWS SDKs or the AWS CLI” to set up methods and integrations for this API, but you can't deploy your API. To deploy your API, follow step 3 and attach a resource policy to your API. SDK JavaScript v3 The following example shows how to create a private API by using the AWS SDK for JavaScript v3: import {APIGatewayClient, CreateRestApiCommand} from "@aws-sdk/client-api-gateway"; const apig = new APIGatewayClient({region:"us-east-1"}); const input = { // CreateRestApiRequest name: "Simple PetStore (JavaScript v3 SDK, private)", // required description: "Demo private API created using the AWS SDK for JavaScript v3", version: "0.00.001", endpointConfiguration: { // EndpointConfiguration types: [ "PRIVATE"], }, Private REST APIs 967 Amazon API Gateway }; Developer Guide export const handler = async (event) => { const command = new CreateRestApiCommand(input); try { const result = await apig.send(command); console.log(result); } catch (err){ console.error(err) } }; A successful call returns output similar to the following: { apiKeySource: 'HEADER', createdDate: 2024-04-03T17:56:36.000Z, description: 'Demo private API created using the AWS SDK for JavaScript v3', disableExecuteApiEndpoint: false, endpointConfiguration: { types: [ 'PRIVATE' ] }, id: 'abcd1234', name: 'Simple PetStore (JavaScript v3 SDK, private)', rootResourceId: 'efg567', version: '0.00.001' } After completing the preceding steps, you can follow the instructions in the section called “Tutorial: Create a REST API using AWS SDKs or the AWS CLI” to set up methods and integrations for this API, but you can't deploy your API. To deploy your API, follow step 3 and attach a resource policy to your API. Python SDK The following example shows how to create a private API by using the AWS SDK for Python: import json import boto3 import logging logger = logging.getLogger() apig = boto3.client('apigateway') def lambda_handler(event, context): Private REST APIs 968 Amazon API Gateway try: Developer Guide result = apig.create_rest_api( name='Simple PetStore (Python SDK, private)', description='Demo private API created using the AWS SDK for Python', version='0.00.001', endpointConfiguration={ 'types': [ 'PRIVATE', ], }, ) except botocore.exceptions.ClientError as error: logger.exception("Couldn't create private API %s.", error) raise attribute=["id", "name", "description", "createdDate", "version", "apiKeySource", "endpointConfiguration"] filtered_data ={key:result[key] for key in attribute} result = json.dumps(filtered_data, default=str,
apigateway-dg-260
apigateway-dg.pdf
260
your API. Python SDK The following example shows how to create a private API by using the AWS SDK for Python: import json import boto3 import logging logger = logging.getLogger() apig = boto3.client('apigateway') def lambda_handler(event, context): Private REST APIs 968 Amazon API Gateway try: Developer Guide result = apig.create_rest_api( name='Simple PetStore (Python SDK, private)', description='Demo private API created using the AWS SDK for Python', version='0.00.001', endpointConfiguration={ 'types': [ 'PRIVATE', ], }, ) except botocore.exceptions.ClientError as error: logger.exception("Couldn't create private API %s.", error) raise attribute=["id", "name", "description", "createdDate", "version", "apiKeySource", "endpointConfiguration"] filtered_data ={key:result[key] for key in attribute} result = json.dumps(filtered_data, default=str, sort_keys='true') return result A successful call returns output similar to the following: "{\"apiKeySource\": \"HEADER\", \"createdDate\": \"2024-04-03 17:27:05+00:00\", \"description\": \"Demo private API created using the AWS SDK for \", \"endpointConfiguration\": {\"types\": [\"PRIVATE\"]}, \"id\": \"abcd1234\", \"name \": \"Simple PetStore (Python SDK, private)\", \"version\": \"0.00.001\"}" After completing the preceding steps, you can follow the instructions in the section called “Tutorial: Create a REST API using AWS SDKs or the AWS CLI” to set up methods and integrations for this API, but you can't deploy your API. To deploy your API, follow step 3 and attach a resource policy to your API. Step 3: Set up a resource policy for a private API Your current private API is inaccessible to all VPCs. Use a resource policy to grant your VPCs and VPC endpoints access to your private APIs. You can grant access to a VPC endpoint in any AWS account. Your resource policy should contain aws:SourceVpc or aws:SourceVpce conditions to restrict access. We recommend that you identify specific VPCs and VPC endpoints and don't create a resource policy that allows access for all VPCs and VPC endpoints. Private REST APIs 969 Amazon API Gateway Developer Guide The following procedure shows how to attach a resource policy to your API. AWS Management Console 1. Sign in to the API Gateway console at https://console.aws.amazon.com/apigateway. 2. Choose a REST API. 3. In the main navigation pane, choose Resource policy. 4. Choose Create policy. 5. Choose Select a template and then choose Source VPC. 6. Replace {{vpcID}} (including the curly braces) with your VPC ID. 7. Choose Save changes. AWS CLI The following update-rest-api command attaches a resource policy to an existing API: aws apigateway update-rest-api \ --rest-api-id a1b2c3 \ --patch-operations op=replace,path=/ policy,value='"{\"jsonEscapedPolicyDocument\"}"' You might also want to control which resources have access to your VPC endpoint. To control which resources have access to your VPC endpoint, attach an endpoint policy to your VPC endpoint. For more information, see the section called “Use VPC endpoint policies for private APIs”. (Optional) Associate or disassociate a VPC endpoint with a private API When you associate a VPC endpoint with your private API, API Gateway generates a new Route 53 alias DNS record. You can use this record to invoke your private APIs just as you do your public APIs without overriding a Host header or passing an x-apigw-api-id header. The generated base URL is in the following format: https://{rest-api-id}-{vpce-id}.execute-api.{region}.amazonaws.com/{stage} Private REST APIs 970 Amazon API Gateway Developer Guide Associate a VPC endpoint (AWS Management Console) You can associate a VPC endpoint with your private API when you create it, or after it's created. The following procedure shows how to associate a VPC endpoint with a previously created API. To associate a VPC endpoint with a private API 1. Sign in to the API Gateway console at https://console.aws.amazon.com/apigateway. 2. Choose your private API. 3. 4. 5. 6. 7. In the main navigation pane, choose Resource policy. Edit your resource policy to allow calls from your additional VPC endpoint. In the main navigation pane, choose API settings. In the API details section, choose Edit. For VPC endpoint IDs, select additional VPC endpoint IDs. 8. Choose Save. 9. Redeploy your API for the changes to take effect. Dissociate a VPC endpoint (AWS Management Console) To disassociate a VPC endpoint from a private REST API 1. Sign in to the API Gateway console at https://console.aws.amazon.com/apigateway. 2. Choose your private API. 3. 4. 5. 6. 7. In the main navigation pane, choose Resource policy. Edit your resource policy to remove mentions of the VPC endpoint you want to dissociate from your private API. In the main navigation pane, choose API settings. In the API details section, choose Edit. For VPC endpoint IDs, choose the X to dissociate the VPC endpoint. 8. Choose Save. 9. Redeploy your API for the changes to take effect. Associate a VPC endpoint (AWS CLI) The following create-rest-api command associates VPC endpoints at the time of API creation: Private REST APIs 971 Amazon API Gateway Developer Guide aws apigateway create-rest-api \ --name Petstore \ --endpoint-configuration '{ "types": ["PRIVATE"], "vpcEndpointIds" : ["vpce-0212a4ababd5b8c3e", "vpce-0393a628149c867ee"] }' \ --region us-west-2 The output will look like the following: { "apiKeySource": "HEADER", "endpointConfiguration": { "types": [ "PRIVATE"
apigateway-dg-261
apigateway-dg.pdf
261
main navigation pane, choose API settings. In the API details section, choose Edit. For VPC endpoint IDs, choose the X to dissociate the VPC endpoint. 8. Choose Save. 9. Redeploy your API for the changes to take effect. Associate a VPC endpoint (AWS CLI) The following create-rest-api command associates VPC endpoints at the time of API creation: Private REST APIs 971 Amazon API Gateway Developer Guide aws apigateway create-rest-api \ --name Petstore \ --endpoint-configuration '{ "types": ["PRIVATE"], "vpcEndpointIds" : ["vpce-0212a4ababd5b8c3e", "vpce-0393a628149c867ee"] }' \ --region us-west-2 The output will look like the following: { "apiKeySource": "HEADER", "endpointConfiguration": { "types": [ "PRIVATE" ], "vpcEndpointIds": [ "vpce-0212a4ababd5b8c3e", "vpce-0393a628149c867ee" ] }, "id": "u67n3ov968", "createdDate": 1565718256, "name": "Petstore" } The following update-rest-api command associates VPC endpoints to an API that you already created: aws apigateway update-rest-api \ --rest-api-id u67n3ov968 \ --patch-operations "op='add',path='/endpointConfiguration/ vpcEndpointIds',value='vpce-01d622316a7df47f9'" \ --region us-west-2 The output will look like the following: { "name": "Petstore", "apiKeySource": "1565718256", "tags": {}, "createdDate": 1565718256, Private REST APIs 972 Amazon API Gateway Developer Guide "endpointConfiguration": { "vpcEndpointIds": [ "vpce-0212a4ababd5b8c3e", "vpce-0393a628149c867ee", "vpce-01d622316a7df47f9" ], "types": [ "PRIVATE" ] }, "id": "u67n3ov968" } Redeploy your API for the changes to take effect. Disassociate a VPC endpoint (AWS CLI) The following update-rest-api command dissociates a VPC endpoint from a private API: aws apigateway update-rest-api \ --rest-api-id u67n3ov968 \ --patch-operations "op='remove',path='/endpointConfiguration/ vpcEndpointIds',value='vpce-0393a628149c867ee'" \ --region us-west-2 The output will look like the following: { "name": "Petstore", "apiKeySource": "1565718256", "tags": {}, "createdDate": 1565718256, "endpointConfiguration": { "vpcEndpointIds": [ "vpce-0212a4ababd5b8c3e", "vpce-01d622316a7df47f9" ], "types": [ "PRIVATE" ] }, "id": "u67n3ov968" } Private REST APIs 973 Amazon API Gateway Developer Guide Redeploy your API for the changes to take effect. Step 4: Deploy a private API To deploy your API, you create an API deployment and associate it with a stage. The following procedure shows how to deploy your private API. AWS Management Console To deploy a private API 1. Choose your API. 2. Choose Deploy API. 3. 4. 5. For Stage, select New stage. For Stage name, enter a stage name. (Optional) For Description, enter a description. 6. Choose Deploy. AWS CLI The following create-deployment command deploys a private API: aws apigateway create-deployment --rest-api-id a1b2c3 \ --stage-name test \ --stage-description 'Private API test stage' \ --description 'First deployment' Troubleshoot your private API The following provides troubleshooting advice for errors and issues that you might encounter when creating a private API. Issue: I can't connect to my public API from an API Gateway VPC endpoint When you create your VPC, you can configure the DNS settings. We recommend that you turn on private DNS for your VPC. If you choose turn off private DNS, you're only able to access your API via public DNS. Private REST APIs 974 Amazon API Gateway Developer Guide If you enable private DNS, you can't access the default endpoint of a public API Gateway API from your VPC endpoint. You can access an API with a custom domain name. If you create a Regional custom domain name, use an A type alias record, if you create an edge- optimized custom domain name, there are no restrictions for your record type. You can access these public APIs with private DNS enabled. For more information, see Issue: I connect to my public API from an API Gateway VPC endpoint. Issue: My API returns {"Message":"User: anonymous is not authorized to perform: execute-api:Invoke on resource: arn:aws:execute-api:us-east-1:********/ ****/****/"} In your resource policy, if you set the Principal to an AWS principal, such as the following: { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", ""Principal": { "AWS": [ "arn:aws:iam::account-id:role/developer", "arn:aws:iam::account-id:role/Admin" ] }, "Action": "execute-api:Invoke", "Resource": [ "execute-api:/*" ] }, ... } You must use AWS_IAM authorization for every method in your API, or else your API returns the previous error message. For more instructions on how to turn on AWS_IAM authorization for a method, see the section called “Methods”. Issue: I can't tell if my VPC endpoint is associated with my API If you associate or dissociate a VPC endpoint with your private API, you need to redeploy your API. The update operation might take few minutes to complete due to DNS propagation. During this time, your API is available, but DNS propagation for the newly generated DNS URLs may still be in Private REST APIs 975 Amazon API Gateway Developer Guide progress. If after several minutes, your new URLs are not resolving in DNS, we recommend that you redeploy your API. Custom domain names for private APIs in API Gateway You can create a custom domain name for your private APIs. Use a private custom domain name to provide API callers with a simpler and more intuitive URL. With a private custom domain name, you can reduce complexity, configure security measures during the TLS handshake, and control the certificate lifecycle of your domain name using AWS Certificate Manager (ACM).
apigateway-dg-262
apigateway-dg.pdf
262
still be in Private REST APIs 975 Amazon API Gateway Developer Guide progress. If after several minutes, your new URLs are not resolving in DNS, we recommend that you redeploy your API. Custom domain names for private APIs in API Gateway You can create a custom domain name for your private APIs. Use a private custom domain name to provide API callers with a simpler and more intuitive URL. With a private custom domain name, you can reduce complexity, configure security measures during the TLS handshake, and control the certificate lifecycle of your domain name using AWS Certificate Manager (ACM). For more information, see the section called “Securing your certificate's private key for your custom domain name”. Custom domain names for private APIs don’t need to be unique across multiple accounts. You can create example.private.com in account 111122223333 and in account 555555555555, as long as your ACM certificate covers the domain name. To identify a private custom domain name, use the private custom domain name ARN. This identifier is unique to private custom domain names. When you create a private custom domain name in API Gateway, you're an API provider. You can provide your private custom domain name to other AWS accounts using API Gateway or AWS Resource Access Manager (AWS RAM). When you invoke a private custom domain name, you're an API consumer. You can consume a private custom domain name from your own AWS account or from another AWS account. When you consume a private custom domain name, you create a domain name access association between a VPC endpoint and a private custom domain name. With a domain name access association, API consumers can invoke your private custom domain name while isolated from the public internet. For more information, see the section called “API providers and API consumers”. Securing your certificate's private key for your custom domain name When you request an SSL/TLS certificate using ACM to create your custom domain name for private APIs, ACM generates a public/private key pair. When you import a certificate, you generate the key pair. The public key becomes part of the certificate. To safely store the private key, ACM creates another key using AWS KMS, called the KMS key, with the alias aws/acm. AWS KMS uses this key to encrypt your certificate’s private key. For more information, see Data protection in AWS Certificate Manager in the AWS Certificate Manager User Guide. API Gateway uses AWS TLS Connection Manager, a service that is only accessible to AWS services, to secure and use your certificate's private keys. When you use your ACM certificate to create a API Private REST APIs 976 Amazon API Gateway Developer Guide Gateway custom domain name, API Gateway associates your certificate with AWS TLS Connection Manager. We do this by creating a grant in AWS KMS against your AWS managed key. This grant allows TLS Connection Manager to use AWS KMS to decrypt your certificate's private key. TLS Connection Manager uses the certificate and the decrypted (plaintext) private key to establish a secure connection (SSL/TLS session) with clients of API Gateway services. When the certificate is disassociated from a API Gateway service, the grant is retired. For more information, see Grants in the AWS Key Management Service Developer Guide. For more information, see the section called “Encryption at rest”. Considerations for private custom domain names The following considerations might impact your use of private custom domain names: • It takes about 15 minutes for API Gateway to provision your private custom domain name. • If you update your ACM certificate, it takes about 15 minutes for API Gateway to complete the update. During this time, your domain name is in the UPDATING state, and you can still access it. • To invoke a private custom domain name, you must create a domain name access association. After you create a domain name access association, it takes about 15 minutes to be ready. • The private custom domain name ARN contains the account-id. When you create a domain name, API Gateway uses the ARN format of arn:partition:apigateway:region::/ domainnames. When you access a private custom domain name, you use the ARN format of arn:partition:apigateway:region:account-id:/domainnames/domain-name. You might need to modify your IAM permissions to allow access to a private domain name after you create it. • You can't invoke private custom domain names with the same name from the same VPC endpoint. For example, if you wanted to invoke arn:aws:apigateway:us- west-2:111122223333:/domainnames/private.example.com+abcd1234 and arn:aws:apigateway:us-west-2:111122223333:/domainnames/ private.example.com+xyz000, associate each private custom domain name with a different VPC endpoint. • Wildcard certificates are supported, such as a certificate for *.private.example.com. • Wildcard custom domain names aren't supported. • Only RSA certificates with a 2048-bit key length and ECDSA certificates with 256-bit and 384-bit key lengths are supported. Private REST APIs 977 Amazon API Gateway Developer Guide •
apigateway-dg-263
apigateway-dg.pdf
263
to allow access to a private domain name after you create it. • You can't invoke private custom domain names with the same name from the same VPC endpoint. For example, if you wanted to invoke arn:aws:apigateway:us- west-2:111122223333:/domainnames/private.example.com+abcd1234 and arn:aws:apigateway:us-west-2:111122223333:/domainnames/ private.example.com+xyz000, associate each private custom domain name with a different VPC endpoint. • Wildcard certificates are supported, such as a certificate for *.private.example.com. • Wildcard custom domain names aren't supported. • Only RSA certificates with a 2048-bit key length and ECDSA certificates with 256-bit and 384-bit key lengths are supported. Private REST APIs 977 Amazon API Gateway Developer Guide • You can't set the IP address type for private APIs to only allow IPv4 addresses to invoke your private API. Only dualstack is supported. For more information, see the section called “IP address types for REST APIs in API Gateway”. • To send traffic using your private API, you can use all IP address types supported by Amazon VPC. You can send dualstack and IPv6 traffic by configuring the settings on your VPC endpoint. You can't modify this using API Gateway. For more information, see Add IPv6 support for your VPC. • Multi-level base path mapping, such as mapping your private API to /developers/feature, isn't supported. • You can’t set a minimum TLS version for your private custom domain name. All private custom domain names have the security policy of TLS-1-2. • You can use VPC endpoint policy to control access to a private custom domain name. For more information, see examples 4 and 5 in the section called “Use VPC endpoint policies for private APIs”. • You must create a separate resource policy for your private API and for your private custom domain name. To invoke a private custom domain name, an API consumer needs access from the private custom domain name resource policy, the private API resource policy, and any VPC endpoint policies or authorization on the private API. Considerations for using private custom domain names with other API Gateway resources The following considerations might impact how you use private custom domain names with other API Gateway resources: • You can't map a public API to a private custom domain name. • When a private API is mapped to a private custom domain name, you can't change the API's endpoint type. • You can't migrate a public custom domain name to a private custom domain name. • If you have a VPC endpoint that you use to access a public custom domain name, don't use it to create a domain name access association with a private custom domain name. Differences between private custom domain names and public custom domain names The following describes the differences between private and public custom domain names: • Private custom domain names don’t need to be unique across multiple accounts. Private REST APIs 978 Amazon API Gateway Developer Guide • A private domain name has a domain name ID. This ID uniquely identifies a private custom domain name and isn't generated for public custom domain names. • When you use the AWS CLI to update or delete your private custom domain name, you must provide the domain name ID. If you have a private custom domain name called example.com and a public custom domain name called example.com and you don't provide the domain name ID, API Gateway will modify or delete your public custom domain name. Next steps for custom domain names for private APIs For information about the tasks of an API provider and an API consumer, see the section called “API providers and API consumers”. For instructions on creating a private custom domain name that you can invoke in your own AWS account, see the section called “Tutorial: Create and invoke a custom domain name for private APIs”. For instructions on providing another AWS account access to your private custom domain name, see the section called “API provider: Share your private custom domain name using AWS RAM”. For instructions on associating your VPC endpoint with a private custom domain name in another AWS account, see the section called “API consumer: Associate your VPC endpoint with a private custom domain name shared with you”. Tasks of API providers and API consumers for custom domain names for private APIs When you create a private custom domain name, you're an API provider. When you invoke a private custom domain name, you're an API consumer. You can consume a private custom domain name from your own AWS account or from another AWS account. The following section explains the tasks required by the API provider and API consumer to use a private custom domain name. If you want to invoke a private custom domain name in your own AWS account, you are both the API provider and the API consumer. If you want to invoke a
apigateway-dg-264
apigateway-dg.pdf
264
custom domain names for private APIs When you create a private custom domain name, you're an API provider. When you invoke a private custom domain name, you're an API consumer. You can consume a private custom domain name from your own AWS account or from another AWS account. The following section explains the tasks required by the API provider and API consumer to use a private custom domain name. If you want to invoke a private custom domain name in your own AWS account, you are both the API provider and the API consumer. If you want to invoke a private custom domain in another AWS account, depending on the trust relationship between the API provider and API consumer in AWS Organizations, AWS RAM might complete some tasks for you. Tasks of an API provider API providers create private APIs and map them to custom domain names. API providers manage two resource policies to protect their private custom domain names. The first policy is for the execute-api service and controls which VPC endpoints can invoke your Private REST APIs 979 Amazon API Gateway Developer Guide private custom domain name. In the private custom domain name configuration, it's called the policy. The second policy is for the Amazon API Gateway Management service and controls which VPC endpoints in other AWS accounts can form a domain name access association with your private custom domain name. A VPC endpoint needs to form a domain name access association with a private custom domain name to invoke it. In the private custom domain name configuration, it's the managementPolicy. You can use AWS RAM or API Gateway to update this policy. If you don't plan on allowing VPC endpoints in other AWS accounts to invoke your custom domain name, you don't edit the managementPolicy. If you are an API provider, you must do the following: 1. Create a private API. 2. Update your private API's policy to grant your VPC endpoint access to your private API. 3. Create a private custom domain name. 4. Update your private custom domain name's policy to grant your VPC endpoint access to your private custom domain name. 5. Create a base path mapping to map your private API to your private custom domain name. If you want to allow API consumers in other AWS accounts to access your private custom domain name, do the following: 1. Update the managementPolicy of your private custom domain name to allow API consumers in other accounts to associate their VPC endpoints with your private custom domain name. You can do this using the following methods: AWS RAM With AWS RAM, if the API provider and the API consumer are in the same organization using AWS Organizations, the resource share between provider and consumer is automatically accepted. Otherwise, you should wait until the API consumer accepts the resource share. We recommend that you use AWS RAM to share your private custom domain name. API Gateway With API Gateway, only the AWS CLI is supported. You must update your private custom domain name using a patch operation and provide your own policy document for the managementPolicy. Private REST APIs 980 Amazon API Gateway Developer Guide 2. Update the policy of your private custom domain name and any private APIs mapped to it to grant access to the API consumer's VPC endpoint. For instructions on how to provide your API to another AWS account, see the section called “API provider: Share your private custom domain name using AWS RAM”. Tasks of an API consumer API consumers associate their VPC endpoints with a domain name ARN to invoke a private custom domain name. API consumers don't need to create an API Gateway API. If you are an API consumer, do the following: 1. Create a VPC endpoint with private DNS enabled in Amazon VPC. 2. (Optional - if AWS RAM is used) Accept a private custom domain resource share in AWS RAM within 12 hours of the resource share. If you and the API provider are in the same organization, the resource share is automatically accepted. 3. Get the private custom domain name ARN. Because the private custom domain name URL is not unique, you use the private custom domain name ARN to form the domain name access association between your VPC endpoint and the private custom domain name. You can use AWS RAM to retrieve the private custom domain name ARN. 4. Associate the private custom domain ARN with your VPC endpoint in API Gateway. This creates a secure connection between your VPC endpoint and the private custom domain name. Traffic doesn't leave the Amazon network. 5. Wait for the API provider to grant your VPC endpoint access to the private custom domain name and any private APIs mapped to the private custom domain name. If you're
apigateway-dg-265
apigateway-dg.pdf
265
custom domain name ARN to form the domain name access association between your VPC endpoint and the private custom domain name. You can use AWS RAM to retrieve the private custom domain name ARN. 4. Associate the private custom domain ARN with your VPC endpoint in API Gateway. This creates a secure connection between your VPC endpoint and the private custom domain name. Traffic doesn't leave the Amazon network. 5. Wait for the API provider to grant your VPC endpoint access to the private custom domain name and any private APIs mapped to the private custom domain name. If you're both the API provider and the API consumer, you grant your own VPC endpoint invoke access. 6. Create a Route 53 Private Hosted Zone and a Route 53 record to resolve the private custom domain name in Route 53. For instructions on how to consume an API in another AWS account, see the section called “API consumer: Associate your VPC endpoint with a private custom domain name shared with you”. Tutorial: Create and invoke a custom domain name for private APIs In this tutorial, you create a private custom domain name that you can invoke in a VPC in your own account. To accomplish this, you are the API provider and the API consumer. You need an existing Private REST APIs 981 Amazon API Gateway Developer Guide private API and VPC endpoint to complete this tutorial. If you have a VPC endpoint that you use to access a public custom domain name, don't use it for this tutorial or to create any domain name access associations. Step 1: Create a private custom domain name You create your private custom domain name by specifying the domain name, the ACM certificate, and the policy for the execute-api service to control which VPC endpoints can invoke it. AWS Management Console To create a private custom domain name 1. 2. Sign in to the API Gateway console at https://console.aws.amazon.com/apigateway. In the main navigation pane, choose Custom domain names. 3. Choose Add domain name. 4. For Domain name, enter a domain name. Your ACM certificate must cover this domain name, but the domain name doesn't need to be unique. Select Private - new. For ACM certificate, select a certificate. 5. 6. 7. Choose Add domain name. API Gateway provisions a domain name with a deny all resource policy. This is the resource policy for the execute-api service. You need to update this resource policy to grant access to your VPC endpoints to invoke your private custom domain name. To update your resource policy 1. Choose the Resource policy tab, and then choose Edit resource policy. 2. Enter the following resource policy in the code editor. Replace the VPC endpoint vpce- abcd1234efg with your own VPC endpoint ID. { "Version": "2012-10-17", "Statement": [ { Private REST APIs 982 Amazon API Gateway Developer Guide "Effect": "Allow", "Principal": "*", "Action": "execute-api:Invoke", "Resource": [ "execute-api:/*" ] }, { "Effect": "Deny", "Principal": "*", "Action": "execute-api:Invoke", "Resource": [ "execute-api:/*" ], "Condition" : { "StringNotEquals": { "aws:SourceVpce": "vpce-abcd1234efg" } } } ] } 3. Choose Save changes. AWS CLI When you create a private custom domain name using the AWS CLI, you provide a resource policy for the execute-api service to grant access to VPC endpoints to invoke your private custom domain name, using the --policy "{\"jsonEscapedPolicyDocument\"}" parameter. You can modify this policy later. For this example, you'll attach the following resource policy as the policy. This policy only allows incoming traffic to a private custom domain name from the VPC endpoint vpce- abcd1234efg: { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Principal": "*", Private REST APIs 983 Amazon API Gateway Developer Guide "Action": "execute-api:Invoke", "Resource": [ "execute-api:/*" ] }, { "Effect": "Deny", "Principal": "*", "Action": "execute-api:Invoke", "Resource": [ "execute-api:/*" ], "Condition" : { "StringNotEquals": { "aws:SourceVpce": "vpce-abcd1234efg" } } } ] } In this example, you define your policy by using an escaped string. You can also define your policy by loading parameters from a file. The following create-domain-name command creates a private custom domain name: aws apigateway create-domain-name \ --domain-name 'private.example.com' \ --certificate-arn 'arn:aws:acm:us-west-2:111122223333:certificate/ a1b2c3d4-5678-90ab-cdef' \ --security-policy 'TLS_1_2' \ --endpoint-configuration '{"types":["PRIVATE"]}' \ --policy "{\"Version\": \"2012-10-17\",\"Statement\": [{\"Effect\": \"Allow\", \"Principal\": \"*\",\"Action\": \"execute-api:Invoke\",\"Resource\":[\"execute- api:/*\"]},{\"Effect\": \"Deny\",\"Principal\": \"*\",\"Action\": \"execute- api:Invoke\",\"Resource\":[\"execute-api:/*\"],\"Condition\":{\"StringNotEquals\": {\"aws:SourceVpce\": \"vpce-abcd1234efg\"}}}]}" The output will like the following. { "domainName": "private.example.com", "domainNameId": "abcd1234", Private REST APIs 984 Amazon API Gateway Developer Guide "domainNameArn": "arn:aws:apigateway:us-west-2:111122223333:/domainnames/ private.example.com+abcd1234", "certificateArn": "arn:aws:acm:us-west-2:111122223333:certificate/ a1b2c3d4-5678-90ab-cdef", "certificateUploadDate": "2024-09-10T10:31:20-07:00", "endpointConfiguration": { "types": [ "PRIVATE" ] }, "domainNameStatus": "AVAILABLE", "securityPolicy": "TLS_1_2", "policy": "{\\\"Version\\\":\\\"2012-10-17\\\",\\\"Statement\\\":[{\\\"Effect\\ \":\\\"Allow\\\",\\\"Principal\\\":\\\"*\\\",\\\"Action\\\":\\\"execute-api:Invoke \\\",\\\"Resource\\\":\\\"execute-api:\\/*\\\"},{\\\"Effect\\\":\\\"Deny\\\",\\ \"Principal\\\":\\\"*\\\",\\\"Action\\\":\\\"execute-api:Invoke\\\",\\\"Resource \\\":\\\""execute-api:\\/*\\\",\\\"Condition\\\":{\\\"StringNotEquals\\\":{\\ \"aws:SourceVpce\\\":\\\"vpce-abcd1234efg\\\"}}}]}" } Step 2: Create a base path mapping to map your private API to your private custom domain name After you create your private custom domain name, you map a private API to it. A base path mapping makes an API accessible through the combination of the
apigateway-dg-266
apigateway-dg.pdf
266
api:/*\"]},{\"Effect\": \"Deny\",\"Principal\": \"*\",\"Action\": \"execute- api:Invoke\",\"Resource\":[\"execute-api:/*\"],\"Condition\":{\"StringNotEquals\": {\"aws:SourceVpce\": \"vpce-abcd1234efg\"}}}]}" The output will like the following. { "domainName": "private.example.com", "domainNameId": "abcd1234", Private REST APIs 984 Amazon API Gateway Developer Guide "domainNameArn": "arn:aws:apigateway:us-west-2:111122223333:/domainnames/ private.example.com+abcd1234", "certificateArn": "arn:aws:acm:us-west-2:111122223333:certificate/ a1b2c3d4-5678-90ab-cdef", "certificateUploadDate": "2024-09-10T10:31:20-07:00", "endpointConfiguration": { "types": [ "PRIVATE" ] }, "domainNameStatus": "AVAILABLE", "securityPolicy": "TLS_1_2", "policy": "{\\\"Version\\\":\\\"2012-10-17\\\",\\\"Statement\\\":[{\\\"Effect\\ \":\\\"Allow\\\",\\\"Principal\\\":\\\"*\\\",\\\"Action\\\":\\\"execute-api:Invoke \\\",\\\"Resource\\\":\\\"execute-api:\\/*\\\"},{\\\"Effect\\\":\\\"Deny\\\",\\ \"Principal\\\":\\\"*\\\",\\\"Action\\\":\\\"execute-api:Invoke\\\",\\\"Resource \\\":\\\""execute-api:\\/*\\\",\\\"Condition\\\":{\\\"StringNotEquals\\\":{\\ \"aws:SourceVpce\\\":\\\"vpce-abcd1234efg\\\"}}}]}" } Step 2: Create a base path mapping to map your private API to your private custom domain name After you create your private custom domain name, you map a private API to it. A base path mapping makes an API accessible through the combination of the private custom domain name and an associated base path. We recommend that you use a single private custom domain name as the hostname of multiple private APIs. All API providers need to create a base path mapping, even if you don't plan on invoking your own API. You also need to grant access for VPC endpoints to invoke any private APIs that you map to your private custom domain name. AWS Management Console To create a base path mapping 1. 2. Sign in to the API Gateway console at https://console.aws.amazon.com/apigateway. In the main navigation pane, choose Custom domain names. 3. Choose a private custom domain name. 4. On the API mappings tab, choose Configure mappings. Private REST APIs 985 Amazon API Gateway Developer Guide 5. Choose Add new mapping. 6. Enter an API, a Stage, and optionally a Path. 7. Choose Save. AWS CLI The following create-base-path-mapping command creates a mapping between a private API and a private custom domain name: aws apigateway create-base-path-mapping \ --domain-name-id abcd1234 \ --domain-name 'private.example.com' \ --rest-api-id a1b2c3 \ --stage prod \ --base-path v1 The output will look like the following. { "basePath": "v1", "restApiId": "a1b2c3", "stage": "prod" } Note If you want other AWS accounts to invoke your private custom domain name, after you complete this tutorial, follow the steps in the section called “API provider: Share your private custom domain name using AWS RAM”. Step 3: Create a domain name access association between your custom domain name and a VPC endpoint Next, you create a domain name access association between your private custom domain name and your VPC endpoint. Your VPC endpoint uses the domain name access association to invoke your private custom domain name while isolated from the public internet. Private REST APIs 986 Amazon API Gateway AWS Management Console To create a domain name access association Developer Guide 1. 2. Sign in to the API Gateway console at https://console.aws.amazon.com/apigateway. In the main navigation pane, choose Custom domain names. 3. Choose a private custom domain name. 4. 5. 6. In the Resource sharing tab, for Domain name access associations, choose Create domain name access association. For Domain name ARN, select your domain name. For VPC endpoint ID, select the VPC endpoint ID you provided access to in step 1. 7. Choose Domain name access association. You can also create your domain name access association using the Domain name access associations page of the console. AWS CLI The following create-domain-name-access-association command creates a domain name access association between your private custom domain name and your VPC endpoint. aws apigateway create-domain-name-access-association \ --domain-name-arn arn:aws:apigateway:us-west-2:111122223333:/domainnames/ private.example.com+abcd1234 \ --access-association-source vpce-abcd1234efg \ --access-association-source-type VPCE \ --region us-west-2 The output will look like the following. { "domainNameAccessAssociationARN": "arn:aws:apigateway:us-west-2:111122223333:/ domainnameaccessassociations/domainname/private.example.com+abcd1234/vpcesource/ vpce-abcd1234efg", "accessAssociationSource": "vpce-abcd1234efg", "accessAssociationSourceType": "VPCE", "domainNameARN" : "arn:aws:apigateway:us-west-2:111122223333:/domainnames/ private.example.com+abcd1234" } Private REST APIs 987 Amazon API Gateway Developer Guide After you create your domain name access association, it takes about 15 minutes to be ready. While you wait, you can proceed with the following steps. Step 4: Create a Route 53 hosted zone After you update your resource policy and associate your private custom domain name with your VPC endpoint, you create a private hosted zone in Route 53 to resolve your custom domain name. A hosted zone is container that holds information about how you want to route traffic for a domain within one or more VPCs without exposing your resources to the internet. For more information, see Working with private hosted zones. AWS Management Console To use the AWS Management Console, see Creating a private hosted zone in the Amazon Route 53 Developer Guide. For Name, use the name of your private custom domain name. For VPC ID, use the VPC containing the VPC endpoint that you used in the previous steps. AWS CLI The following create-hosted-zone command creates a private hosted zone: aws route53 create-hosted-zone --name private.example.com \ --caller-reference 2014-04-01-18:47 \ --hosted-zone-config Comment="command-line version",PrivateZone=true \ --vpc VPCRegion=us-west-2,VPCId=vpc-abcd1234 The output contains the hosted zone ID. You use the hosted zone ID in the following steps. Step 5: Create a Route 53 DNS record After you create the hosted zone, you create an record to resolve your private custom domain name. You use the hosted zone ID you
apigateway-dg-267
apigateway-dg.pdf
267
the name of your private custom domain name. For VPC ID, use the VPC containing the VPC endpoint that you used in the previous steps. AWS CLI The following create-hosted-zone command creates a private hosted zone: aws route53 create-hosted-zone --name private.example.com \ --caller-reference 2014-04-01-18:47 \ --hosted-zone-config Comment="command-line version",PrivateZone=true \ --vpc VPCRegion=us-west-2,VPCId=vpc-abcd1234 The output contains the hosted zone ID. You use the hosted zone ID in the following steps. Step 5: Create a Route 53 DNS record After you create the hosted zone, you create an record to resolve your private custom domain name. You use the hosted zone ID you created in the previous step. In this example, you create an A record type. If you are using IPv6 for your VPC endpoint, create an AAAA record type. If you are using dualstack for your VPC endpoint, create both an AAAA and an A record type. AWS Management Console To use the AWS Management Console, see Routing traffic to an Amazon API Gateway API by using your domain name. Private REST APIs 988 Amazon API Gateway Developer Guide Use Quick create and turn on Alias. For endpoint, use the VPC endpoint DNS name. AWS CLI To configure your DNS records to map the private custom domain name to its hostname of the given hosted zone ID, you create a JSON file that contains the configuration for setting up a DNS record for the private domain name. The following setup-dns-record.json shows how to create a DNS A record to map a private custom domain name to its private hostname. You provide the DNSName of your VPC DNS ID, and the hosted zone ID you created in the previous step. { "Changes": [ { "Action": "UPSERT", "ResourceRecordSet": { "Name": "private.example.com", "Type": "A", "AliasTarget": { "DNSName": "vpce-abcd1234.execute-api.us-west-2.vpce.amazonaws.com", "HostedZoneId": "Z2OJLYMUO9EFXC", "EvaluateTargetHealth": false } } } ] } The following change-resource-record-sets command creates a DNS record for your private custom domain name: aws route53 change-resource-record-sets \ --hosted-zone-id ZABCDEFG1234 \ --change-batch file://path/to/your/setup-dns-record.json Replace thehosted-zone-id with the Route 53 Hosted Zone ID of the DNS record set in your account. The change-batch parameter value points to a JSON file. If you don't plan on invoking your own private custom domain name, after you confirm your private custom domain name is working, you can delete these resources. Private REST APIs 989 Amazon API Gateway Developer Guide Step 6: Invoke your private custom domain name You can now invoke your private custom domain name in your own AWS account. In your VPC, use the following curl command to access your private custom domain name. curl https://private.example.com/v1 For more information about other ways to invoke your private API, see the section called “Invoke a private API using a custom domain name”. Step 7: Clean up To prevent unnecessary costs, delete the association between your VPC endpoint and your private custom domain name, and then delete your private custom domain name. AWS Management Console To delete the domain name access association 1. 2. 3. Sign in to the API Gateway console at https://console.aws.amazon.com/apigateway. In the main navigation pane, choose Domain name access associations. Select your domain name access association, and then choose Delete. 4. Confirm your choice, and then choose Delete. After you delete your domain name access association, you can delete your private custom domain name. To delete your private custom domain name 1. 2. Sign in to the API Gateway console at https://console.aws.amazon.com/apigateway. In the main navigation pane, choose Custom domain names. 3. Choose your private custom domain name. 4. Choose Delete. 5. Confirm your choice, and then choose Delete. If necessary, you can also delete your VPC endpoint. For more information, see Delete an interface endpoint. Private REST APIs 990 Amazon API Gateway AWS CLI To clean up Developer Guide 1. The following delete-access-association command deletes the domain name access association: aws apigateway delete-domain-name-access-association \ --domain-name-access-association-arn 'arn:aws:apigateway:us- west-2:111122223333:/domainnameaccessassociations/domainname/private.example.com +abcd1234/vpcesource/vpce-abcd1234efg' \ --region us-west-2 2. The following delete-domain-name command deletes your private custom domain name. This command also removes all base path mappings. aws apigateway delete-domain-name \ --domain-name test.private.com \ --domain-name-id abcd1234 If necessary, you can also delete your VPC endpoint. For more information, see Delete an interface endpoint. Best practices We recommend that you use the following best practices when you create your private custom domain name: • Use base path mapping to map multiple private APIs to the same private custom domain name. • When a VPC endpoint no longer needs access to a private custom domain name, delete the association. In addition, remove the VPC endpoint from the policy for the execute-api service for the private custom domain. • Configure at least two Availability Zones per VPC endpoint. • Disable the default endpoint. We recommend that you disable the default endpoint to allow your API consumers to only call your API from the custom domain name. For
apigateway-dg-268
apigateway-dg.pdf
268
when you create your private custom domain name: • Use base path mapping to map multiple private APIs to the same private custom domain name. • When a VPC endpoint no longer needs access to a private custom domain name, delete the association. In addition, remove the VPC endpoint from the policy for the execute-api service for the private custom domain. • Configure at least two Availability Zones per VPC endpoint. • Disable the default endpoint. We recommend that you disable the default endpoint to allow your API consumers to only call your API from the custom domain name. For more information, see the section called “Disable the default endpoint”. Private REST APIs 991 Amazon API Gateway Developer Guide • We recommend that you provision a Route 53 private hosted zone and an A-type record when you set up your private custom domain name. If you don't plan on invoking your own private custom domain name, you can delete these resources later. Working with cross-account private custom domain names This section explains how to work with cross-account private custom domain names. You can provide a private custom domain name to another AWS account and use another AWS account to invoke a private custom domain name. You can share your private custom domain name to another AWS account using AWS Resource Access Manager or API Gateway. AWS Resource Access Manager (AWS RAM) helps you securely share your resources across AWS accounts and within your organization or organizational units (OUs). For more information see, What is AWS Resource Access Manager. For instructions on how to share a private custom domain name with another AWS account using AWS RAM, see the section called “API provider: Share your private custom domain name using AWS RAM”. For instructions on how to share a private custom domain name with another AWS account using API Gateway, see the section called “API provider: Share your private custom domain name using the API Gateway AWS CLI”. For instructions on how to consume a private custom domain name in another AWS account, see the section called “API consumer: Associate your VPC endpoint with a private custom domain name shared with you”. Best practices for working with cross-account private custom domain names We recommend the following best practices for working with cross-account private custom domain names: • Use AWS RAM to share your private custom domain names. When you use AWS RAM, you can reduce operational overhead and you don't have to create a managementPolicy for the Amazon API Gateway Management service. • Use the resource-owner parameter when you list your private custom domain names or domain name access associations. Use the resource-owner parameter to only list the resources owned by you or by other AWS accounts. The following example shows how to get all domain name access associations that you own: Private REST APIs 992 Amazon API Gateway Developer Guide aws apigateway get-domain-name-access-associations --resource-owner SELF Use --resource-owner OTHER_ACCOUNTS to list all the domain name access associations that other accounts have formed with your private custom domain name. API provider: Share your private custom domain name using AWS RAM You can provide API consumers in other AWS accounts access to your private custom domain name. In this section, you learn how to share your private custom domain name using AWS RAM and how to control access to your private custom domain name. Considerations for sharing your private custom domain name The following considerations might impact how you provide access to your private custom domain name using AWS RAM. To learn how to share your private custom domain name without using AWS RAM, see the section called “API provider: Share your private custom domain name using the API Gateway AWS CLI”. • Private custom domain names are shared at the AWS Region level. Both the private custom domain name and the VPC endpoint need to be in the same AWS Region. • You can use one resource share with multiple principals, and after you create the resource share, you can add more principals to it. We recommend that when possible, you reuse your resource share. • You always need to grant the API consumer's VPC endpoint access to invoke your private custom domain name and any private APIs mapped to it. • If the API consumer and API provider are in the same organization using AWS Organizations, the resource share is automatically accepted. You still need to create the resource share using AWS RAM. • If the API consumer and API provider are in the same organization using AWS Organizations and resource sharing within your organization is enabled, any principals in the organization that you share with are automatically granted access to the resource shares. There is no need for an invitation and you can skip the resource share. • If the
apigateway-dg-269
apigateway-dg.pdf
269
domain name and any private APIs mapped to it. • If the API consumer and API provider are in the same organization using AWS Organizations, the resource share is automatically accepted. You still need to create the resource share using AWS RAM. • If the API consumer and API provider are in the same organization using AWS Organizations and resource sharing within your organization is enabled, any principals in the organization that you share with are automatically granted access to the resource shares. There is no need for an invitation and you can skip the resource share. • If the API consumer doesn't accept the resource share within 12 hours, the API provider must share the resource again. • After you create the resource share, AWS RAM updates the managementPolicy for the Amazon API Gateway Management service for your private custom domain name to prevent access to Private REST APIs 993 Amazon API Gateway Developer Guide principals without explicit allow access. For more information, see Determining whether a request is allowed or denied within an account in the IAM User Guide. The updated managementPolicy will look like the following: { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Principal": "*", "Action": "execute-api:Invoke", "Resource": [ "execute-api:/*" ] }, { "Effect": "Deny", "Principal": "*", "Action": "execute-api:Invoke", "Resource": [ "execute-api:/*" ], "Condition" : { "StringNotEquals": { "aws:SourceVpce": "vpce-abcd1234efg" } } } ] } AWS RAM has prevented principals without explicit allow access to create access associations with your private custom domain name, by adding the following: "StringNotEquals": { "aws:PrincipalAccount": "111122223333" } You can still use the principal in the AWS account who created the private custom domain name to create domain name access associations. Private REST APIs 994 Amazon API Gateway Developer Guide Allow other accounts to create domain name access associations with your private custom domain name First, you grant access to another AWS account to create domain name access associations with your private custom domain name. AWS Management Console To use the AWS Management Console, see Creating a resource share in AWS RAM in the AWS RAM User Guide. For Select resource type, choose API Gateway Private Custom Domains. AWS CLI The following create-resource-share creates a resource share for your private custom domain name. It can take a few minutes for the resource and principal associations to complete. For principals, provide an account ID or an Organizations ID, such as arn:aws:organizations::123456789012:organization/o-1234abcd. You can provide multiple principals for your resource share. aws ram create-resource-share \ --region us-west-2 \ --name privateCustomDomain-resource-share \ --permission-arns arn:aws:ram::aws:permission/ APIGatewayPrivateDomainNameManagementPolicyDefaultPermission \ --resource-arns arn:aws:apigateway:us-west-2:111122223333:/domainnames/ private.example.com+abcd1234 \ --principals 222222222222 After you have provided access to another AWS account, API consumers in that account must create a domain name access association between their VPC endpoint with your private custom domain name. You can't create the domain name access association for them. For more information, see the section called “Associate your VPC endpoint with a shared private custom domain name”. Allow other accounts to invoke your private custom domain name Next, you grant access for the API consumer's VPC endpoint to invoke your private custom domain name and any private APIs mapped to it. Private REST APIs 995 Amazon API Gateway AWS Management Console Developer Guide To allow VPC endpoints in other accounts to invoke your private custom domain name 1. 2. Sign in to the API Gateway console at https://console.aws.amazon.com/apigateway. In the main navigation pane, choose Custom domain names. 3. Choose the private custom domain name that you shared with other AWS accounts. 4. On the Resource policy tab, choose Edit resource policy. 5. Add the VPC endpoint ID of the API consumer to your resource policy. You can find the VPC endpoint ID of the API consumer on the Domain name access associations section of the Resource sharing tab on the Domain details page of your private custom domain name. 6. Choose Save changes. AWS CLI The following policy for the execute-api service allows incoming traffic to a private custom domain name from both VPC endpoint vpce-abcd1234efg and vpce-xyz000abc. { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Principal": "*", "Action": "execute-api:Invoke", "Resource": [ "execute-api:/*" ] }, { "Effect": "Deny", "Principal": "*", "Action": "execute-api:Invoke", "Resource": [ "execute-api:/*" ], "Condition" : { "StringNotEquals": { Private REST APIs 996 Amazon API Gateway Developer Guide "aws:SourceVpce": [ "vpce-abcd1234efg", "vpce-xyz000abc" ] } } } ] } The following update-domain-name command uses a patch operation to update the policy for a private custom domain name: aws apigateway update-domain-name --domain-name private.example.com \ --domain-name-id abcd1234 \ --patch-operations op=replace,path=/policy,value='"{\"Version\": \"2012-10-17\", \"Statement\": [{\"Effect\": \"Allow\",\"Principal\": \"*\",\"Action\": \"execute- api:Invoke\",\"Resource\":[\"execute-api:/*\"]},{\"Effect\": \"Deny\",\"Principal \": \"*\",\"Action\": \"execute-api:Invoke\",\"Resource\":[\"execute-api:/*\"], \"Condition\":{\"StringNotEquals\":[\"vpce-abcd1234efg\", \"vpce-xyz000abc\"]}}}]}" API provider: Stop sharing a private custom domain name using AWS RAM To stop sharing your private custom domain name, first you stop the API consumer from creating more domain name access associations by dissociating the resource share.
apigateway-dg-270
apigateway-dg.pdf
270
{ Private REST APIs 996 Amazon API Gateway Developer Guide "aws:SourceVpce": [ "vpce-abcd1234efg", "vpce-xyz000abc" ] } } } ] } The following update-domain-name command uses a patch operation to update the policy for a private custom domain name: aws apigateway update-domain-name --domain-name private.example.com \ --domain-name-id abcd1234 \ --patch-operations op=replace,path=/policy,value='"{\"Version\": \"2012-10-17\", \"Statement\": [{\"Effect\": \"Allow\",\"Principal\": \"*\",\"Action\": \"execute- api:Invoke\",\"Resource\":[\"execute-api:/*\"]},{\"Effect\": \"Deny\",\"Principal \": \"*\",\"Action\": \"execute-api:Invoke\",\"Resource\":[\"execute-api:/*\"], \"Condition\":{\"StringNotEquals\":[\"vpce-abcd1234efg\", \"vpce-xyz000abc\"]}}}]}" API provider: Stop sharing a private custom domain name using AWS RAM To stop sharing your private custom domain name, first you stop the API consumer from creating more domain name access associations by dissociating the resource share. Then, you reject the domain name access association and remove the API consumer's VPC endpoint from your policy for the execute-api service. The API consumer can then delete their domain name access association. Stop sharing your private custom domain name First, you stop the resource share using AWS RAM. AWS Management Console To use the AWS Management Console, see Update a resource share in AWS RAM. AWS CLI The following disassociate-resource-share disassociates a resource share for your private custom domain name. Private REST APIs 997 Amazon API Gateway Developer Guide aws ram disassociate-resource-share \ --region us-west-2 \ --resource-arns arn:aws:apigateway:us-west-2:111122223333:/domainnames/ private.example.com+abcd1234 \ --principals 222222222222 Reject the domain name access association After you stop sharing your resource using AWS RAM, you reject the domain name access association between a VPC endpoint in another account and your private custom domain name. Note You can't reject a domain name access association in your own account. To stop resource sharing, delete the domain name access association. For more information, see Delete a domain name access association. When you reject a domain name access association with a VPC endpoint, if an API consumer tries to call your private custom domain name, API Gateway rejects the call and returns a 403 status code. AWS Management Console To reject a domain name access association 1. 2. Sign in to the API Gateway console at https://console.aws.amazon.com/apigateway. In the main navigation pane, choose Custom domain names. 3. Choose the private custom domain name that you shared with other AWS accounts. 4. On the Resource sharing, choose the domain name access association you want to reject. 5. Choose Reject association. 6. Confirm your choice, and then choose Reject. AWS CLI The following reject-domain-name-access-association command rejects the domain name access association between the VPC endpoint and your private custom domain name: Private REST APIs 998 Amazon API Gateway Developer Guide aws apigateway reject-domain-name-access-association \ --domain-name-access-association-arn arn:aws:apigateway:us-west-2:444455556666:/ domainnameaccessassociations/domainname/private.example.com+abcd1234/vpcesource/ vpce-abcd1234efg \ --domain-name-arn arn:aws:apigateway:us-west-2:111122223333:/domainnames/ private.example.com+abcd1234 Deny the API provider access to invoke your private custom domain name After you reject the domain name access association, you remove the API consumer's VPC endpoint from your policy for the execute-api service. AWS Management Console To remove the API consumer's VPC endpoint from your resource policy 1. 2. Sign in to the API Gateway console at https://console.aws.amazon.com/apigateway. In the main navigation pane, choose Custom domain names. 3. Choose the private custom domain name that you shared with other AWS accounts. 4. On the Resource policy tab, choose Edit. 5. Remove the VPC endpoint from the policy. 6. Choose Save changes. AWS CLI The following update-domain-name command uses a patch operation to update the policy for the execute-api service for a private custom domain name. This new policy removes an additional VPC endpoint ID added in the section called “Allow other accounts to invoke your private custom domain name”: aws apigateway update-domain-name --domain-name private.example.com \ --domain-name-id abcd1234 \ --patch-operations op=replace,path=/policy,value='"{\"Version\": \"2012-10-17\", \"Statement\": [{\"Effect\": \"Allow\",\"Principal\": \"*\",\"Action\": \"execute- api:Invoke\",\"Resource\":[\"execute-api:/*\"]},{\"Effect\": \"Deny\",\"Principal \": \"*\",\"Action\": \"execute-api:Invoke\",\"Resource\":[\"execute-api:/*\"], \"Condition\":{\"StringNotEquals\":{\"aws:SourceVpce\": \"vpce-abcd1234efg\"}}}]}" Private REST APIs 999 Amazon API Gateway Developer Guide The API consumer should then delete the domain name access association. You can't delete it for them. For more information, see the section called “API consumer: Delete your domain name access association with a private custom domain name”. API provider: Share your private custom domain name using the API Gateway AWS CLI You can share a private custom domain name using the API Gateway AWS CLI, but we recommend that you use AWS RAM to reduce your operational overhead. For instructions on how to use AWS RAM to share your private custom domain name, see the section called “API provider: Share your private custom domain name using AWS RAM”. To share a private custom domain name using the API Gateway AWS CLI, you grant other AWS accounts access to create domain name access associations and invoke your private custom domain name. You do this by updating the managementPolicy for the API Gateway Management service and the policy for the execute-api service for your private custom domain name. You also need to grant access for the API consumer's VPC endpoint in the resource policy for any private APIs mapped to your private custom domain name. The API consumer
apigateway-dg-271
apigateway-dg.pdf
271
called “API provider: Share your private custom domain name using AWS RAM”. To share a private custom domain name using the API Gateway AWS CLI, you grant other AWS accounts access to create domain name access associations and invoke your private custom domain name. You do this by updating the managementPolicy for the API Gateway Management service and the policy for the execute-api service for your private custom domain name. You also need to grant access for the API consumer's VPC endpoint in the resource policy for any private APIs mapped to your private custom domain name. The API consumer still needs to create a domain name access association in their own account between their VPC endpoint and your private custom domain name. You can't do this for them. Grant access to your private custom domain name To grant access to your private custom domain name 1. To update the managementPolicy for the API Gateway Management service, you create a JSON file that contains the patch operation to update the policy. The following patch- managementPolicy.json replaces the current managementPolicy with an example policy that grants AWS accounts 111122223333 and 444455556666 access to create domain name access associations with the private custom domain name private.example.com. [{ "op": "replace", "path": "/managementPolicy", "value": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Effect \":\"Allow\",\"Principal\":{\"AWS\":[\"arn:aws:iam::111122223333:root \", \"arn:aws:iam::444455556666:root\"]},\"Action\": \"apigateway:CreateAccessAssociation\",\"Resource\":\"arn:aws:apigateway:us- west-2:111122223333:/domainnames/private.example.com+abcd1234\"}]}" }] Private REST APIs 1000 Amazon API Gateway Developer Guide The following update-domain-name command updates the managementPolicy using patch-managementPolicy.json. aws apigateway update-domain-name \ --domain-name private.example.com \ --domain-name-id abcd1234 \ --patch-operations file://patch-managementPolicy.json Once you grant access, you need to notify the API consumer that they can form the domain name access association. If you use AWS RAM, AWS RAM will do this step for you. 2. To update the policy for the execute-api service, you create a JSON file that contains the patch operation to update the policy. The following patch-policy.json replaces the current policy with an example policy that grants two VPC endpoints to invoke the private custom domain name private.example.com. [{ "op": "replace", "path": "/policy", "value": "{\"Version\": \"2012-10-17\",\"Statement\": [{\"Effect\": \"Allow \",\"Principal\": \"*\",\"Action\": \"execute-api:Invoke\",\"Resource\": \"arn:aws:execute-api:us-west-2:111122223333:/domainnames/private.example.com +abcd1234\"},{\"Effect\": \"Deny\",\"Principal\": \"*\",\"Action\": \"execute- api:Invoke\",\"Resource\": \"arn:aws:execute-api:us-west-2:111122223333:/ domainnames/private.example.com+abcd1234\",\"Condition\": {\"StringNotEquals\": {\"aws:SourceVpce\": [\"vpce-abcd1234efg\",\"vpce-xyz000abc\"]}}}]}" }] Use the following update-domain-name command to update the policy using patch- policy.json. aws apigateway update-domain-name \ --domain-name private.example.com \ --domain-name-id abcd1234 \ --patch-operations file://patch-policy.json Private REST APIs 1001 Amazon API Gateway Developer Guide Deny access to your private custom domain name To stop sharing your private custom domain name, you need to reject the domain name access association between your private custom domain name and the API consumer's VPC endpoint. To deny access to your private custom domain name 1. The following reject-domain-name-access-association command rejects the domain name access association. aws apigateway reject-domain-name-access-association \ --domain-name-access-association-arn arn:aws:apigateway:us- west-2:444455556666:/domainnameaccessassociations/domainname/private.example.com +abcd1234/vpcesource/vpce-abcd1234efg \ --domain-name-arn arn:aws:apigateway:us-west-2:111122223333:/domainnames/ private.example.com+abcd1234 2. Modify the patch-managementPolicy.json to remove access for the API provider's account to create a domain name access association with your private custom domain name. The following patch-managementPolicy.json removes one account from the managementPolicy: [{ "op": "replace", "path": "/managementPolicy", "value": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Effect\":\"Allow\", \"Principal\":\"*\",\"Action\":\"apigateway:CreateAccessAssociation\",\"Resource \":\"arn:aws:apigateway:us-west-2:111122223333:/domainnames/private.example.com +abcd1234\"}]}" }] The following update-domain-name command to updates the managementPolicy using patch-managementPolicy.json. aws apigateway update-domain-name \ --domain-name private.example.com \ --domain-name-id abcd1234 \ --patch-operations file://patch-managementPolicy.json Private REST APIs 1002 Amazon API Gateway Developer Guide 3. Modify the patch-policy.json to remove access for the API provider's VPC endpoint to invoke your private custom domain name. The following patch-policy.json removes the VPC endpoint ID from the policy: [{ "op": "replace", "path": "/policy", "value": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Effect\":\"Allow \",\"Principal\":\"*\",\"Action\":\"execute-api:Invoke\",\"Resource\": \"arn:aws:execute-api:us-west-2:111122223333:/domainnames/private.example.com +abcd1234\"},{\"Effect\":\"Deny\",\"Principal\":\"*\",\"Action\":\"execute- api:Invoke\",\"Resource\":\"arn:aws:execute-api:us-west-2:111122223333:/ domainnames/private.example.com+abcd1234\",\"Condition\":{\"StringNotEquals\": {\"aws:SourceVpce\":\"vpce-abcd1234efg\"}}}]}" }] The following update-domain-name command updates the policy using patch- policy.json. aws apigateway update-domain-name \ --domain-name private.example.com \ --domain-name-id abcd1234 \ --patch-operations file://patch-policy.json Example policies used in this procedure The following section shows the example policies used in the previous procedure. The following example policy is for the managementPolicy for the Amazon API Gateway Management service. This policy grants AWS accounts 111122223333 and 444455556666 access to create domain name access associations with the private custom domain name private.example.com. { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Principal": { "AWS": [ Private REST APIs 1003 Amazon API Gateway Developer Guide "111122223333", "444455556666" ] }, "Action": "apigateway:CreateAccessAssociation", "Resource": "arn:aws:apigateway:us-west-2:111122223333:/domainnames/ private.example.com+a1b2c3" } ] } The following example policy is the policy for the policy for the execute-api service. This policy grants VPC endpoints vpce-abcd1234efg and vpce-xyz000abc access to invoke the private custom domain name. { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Principal": "*", "Action": "execute-api:Invoke", "Resource": "arn:aws:execute-api:us-west-2:111122223333:/domainnames/ private.example.com+abcd1234" }, { "Effect": "Deny", "Principal": "*", "Action": "execute-api:Invoke", "Resource": "arn:aws:execute-api:us-west-2:111122223333:/domainnames/ private.example.com+abcd1234", "Condition": { "StringNotEquals": { "aws:SourceVpce": [ "vpce-abcd1234efg", "vpce-xyz000abc" ] } } } ] } Private REST APIs 1004 Amazon API Gateway Developer Guide API consumer: Associate your VPC endpoint with a private custom domain name shared with you The following procedure shows how to consume a private domain name in another AWS account. Depending on your trust relationship with
apigateway-dg-272
apigateway-dg.pdf
272
policy grants VPC endpoints vpce-abcd1234efg and vpce-xyz000abc access to invoke the private custom domain name. { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Principal": "*", "Action": "execute-api:Invoke", "Resource": "arn:aws:execute-api:us-west-2:111122223333:/domainnames/ private.example.com+abcd1234" }, { "Effect": "Deny", "Principal": "*", "Action": "execute-api:Invoke", "Resource": "arn:aws:execute-api:us-west-2:111122223333:/domainnames/ private.example.com+abcd1234", "Condition": { "StringNotEquals": { "aws:SourceVpce": [ "vpce-abcd1234efg", "vpce-xyz000abc" ] } } } ] } Private REST APIs 1004 Amazon API Gateway Developer Guide API consumer: Associate your VPC endpoint with a private custom domain name shared with you The following procedure shows how to consume a private domain name in another AWS account. Depending on your trust relationship with the API provider, AWS RAM might complete some tasks for you. When you are in a different AWS account from a private custom domain name, you can only associate your VPC endpoint with a private custom domain name and invoke it. You can't view the policy or any other parameters of the private custom domain name. Prerequisites The following prerequisites are required to consume a private custom domain name in another AWS account: • A VPC and a VPC endpoint for the execute-api service. Your VPC must have enableDnsHostnames and enableDnsSupport set to true. • We recommend that you configure at least two Availability Zones per VPC endpoint. (Optional) Accept the private custom domain resource share If your API provider used AWS RAM to create a resource share, you have 12 hours to accept it. If you are in the same organization using AWS Organizations as the API provider, the share is automatically accepted. If you are in an organization that has automatic shared resources enabled, the resource is automatically shared with you. AWS Management Console To use the AWS Management Console, see Accepting and rejecting resource share invitations in the AWS RAM User Guide. AWS CLI To find all resources shared with you, use the following get-resource-share-invitations command: aws ram get-resource-share-invitations \ --region us-west-2 Private REST APIs 1005 Amazon API Gateway Developer Guide Use the resulting resource share ARN to accept the resource share invitation. The following accept-resource-share-invitation command accepts the resource share. aws ram accept-resource-share-invitation \ --resource-share-invitation-arn arn:aws:ram:us-west-2:123456789012:resource- share-invitation/1e3477be-4a95-46b4-bbe0-c4001EXAMPLE \ --region us-west-2 Associate your VPC endpoint with a shared private custom domain name Because private custom domain names aren't unique, you associate your VPC endpoint with the unique custom domain name ARN. After you create your domain name access association, it can take up to 15 minutes for your VPC endpoint to successfully invoke your private custom domain name. If you have a VPC endpoint that you use to access a public custom domain name, don't use it to create any domain name access associations. AWS Management Console To associate your VPC endpoint with a shared private custom domain name 1. 2. Sign in to the API Gateway console at https://console.aws.amazon.com/apigateway. In the main navigation pane, choose Domain name access associations. 3. Choose Create domain name access association. 4. For Domain name ARN, select the domain name ARN that the API provider shared with you. The domain name ARN might not appear in the dropdown list. You can use the AWS RAM console to view domain names shared with you and then copy the domain name ARN and enter it into this field. 5. For VPC endpoint ID, select the VPC endpoint ID you want to form the domain name access association with. 6. Choose Create domain name access association. Private REST APIs 1006 Amazon API Gateway AWS CLI Developer Guide Because private custom domain names aren't unique, you associate your VPC endpoint with the unique custom domain name ARN. To find the domain name ARN, use one of the following commands. 1. AWS RAM The following list-resources command lists resources that are shared with you. The API provider must have used AWS RAM to share their private custom domain with you to use this command. aws ram list-resources \ --resource-owner OTHER-ACCOUNTS \ --region us-west-2 --resource-type apigateway:Domainnames API Gateway The following get-domain-names command lists all private custom domain names owned by other AWS accounts that you can form domain name access associations with. aws apigateway get-domain-names \ --resource-owner OTHER_ACCOUNTS \ --region us-west-2 2. After your retrieve the ARN, use API Gateway to create the domain name access association between your VPC endpoint and a shared private custom domain name. Use the following create-domain-name-access-association command: aws apigateway create-domain-name-access-association \ --access-association-source-type VPCE \ --access-association-source 'vpce-1a2b3c4d5e6f1a2b3' \ --domain-name-arn arn:aws:apigateway:us-west-2:111122223333:/domainnames/ private.example.com+abcd1234" The output will look like the following. { Private REST APIs 1007 Amazon API Gateway Developer Guide "domainNameAccessAssociationARN": "arn:aws:apigateway:us- west-2:444455556666:/domainnameaccessassociations/domainname/private.example.com +abcd1234/vpcesource/vpce-abcd1234efg", "accessAssociationSource": "vpce-1a2b3c4d5e6f1a2b3", "accessAssociationSourceType": "VPCE", "domainNameARN" : "arn:aws:apigateway:us-west-1:111122223333:/domainnames/ private.example.com+a1b2c3" } After you associate your VPC endpoint with the private custom domain name, confirm that your API provider has updated the policy of their private custom domain name to allow your VPC endpoint to invoke their domain name. For more information, see
apigateway-dg-273
apigateway-dg.pdf
273
between your VPC endpoint and a shared private custom domain name. Use the following create-domain-name-access-association command: aws apigateway create-domain-name-access-association \ --access-association-source-type VPCE \ --access-association-source 'vpce-1a2b3c4d5e6f1a2b3' \ --domain-name-arn arn:aws:apigateway:us-west-2:111122223333:/domainnames/ private.example.com+abcd1234" The output will look like the following. { Private REST APIs 1007 Amazon API Gateway Developer Guide "domainNameAccessAssociationARN": "arn:aws:apigateway:us- west-2:444455556666:/domainnameaccessassociations/domainname/private.example.com +abcd1234/vpcesource/vpce-abcd1234efg", "accessAssociationSource": "vpce-1a2b3c4d5e6f1a2b3", "accessAssociationSourceType": "VPCE", "domainNameARN" : "arn:aws:apigateway:us-west-1:111122223333:/domainnames/ private.example.com+a1b2c3" } After you associate your VPC endpoint with the private custom domain name, confirm that your API provider has updated the policy of their private custom domain name to allow your VPC endpoint to invoke their domain name. For more information, see the section called “Allow other accounts to invoke your private custom domain name”. Create a Route 53 hosted zone To resolve the private custom domain name, you need to create a Route 53 private hosted zone. A hosted zone is container that holds information about how you want to route traffic for a domain within one or more VPCs without exposing your resources to the internet. For more information, see Working with private hosted zones. AWS Management Console To use the AWS Management Console, see Creating a private hosted zone in the Amazon Route 53 Developer Guide. For Name, use the name of the private custom domain name. For VPC ID, use the VPC containing the VPC endpoint that you used for your domain name access association. AWS CLI The following create-hosted-zone command creates a private hosted zone: aws route53 create-hosted-zone --name private.example.com \ --caller-reference 2014-04-01-18:47 \ --hosted-zone-config Comment="command-line version",PrivateZone=true \ --vpc VPCRegion=us-west-2,VPCId=vpc-abcd1234 The output contains the hosted zone ID. You use the hosted zone ID in the following steps. Private REST APIs 1008 Amazon API Gateway Create a Route 53 DNS record Developer Guide After you create the hosted zone, you create an record to resolve the private custom domain. In this example, you create an A record type. If you are using IPv6 for your VPC endpoint, create an AAAA record type. If you are using dualstack for your VPC endpoint, create both an AAAA and an A record type. AWS Management Console To use the AWS Management Console, see Routing traffic to an Amazon API Gateway API by using your domain name. Use Quick create and turn on Alias. For endpoint, use the VPC endpoint DNS name. AWS CLI To configure your DNS records to map the private custom domain name to its hostname of the given hosted zone ID, first create a JSON file that contains the configuration for setting up a DNS record for the private domain name. The following setup-dns-record.json shows how to create a DNS A record to map a private custom domain name to its private hostname. You provide the DNSName of your VPC DNS ID, and the hosted zone ID you created in the previous step. { "Changes": [ { "Action": "UPSERT", "ResourceRecordSet": { "Name": "private.example.com", "Type": "A", "AliasTarget": { "DNSName": "vpce-abcd1234.execute-api.us-west-2.vpce.amazonaws.com", "HostedZoneId": "Z2OJLYMUO9EFXC", "EvaluateTargetHealth": false } } } ] } The following change-resource-record-sets command creates a DNS record for the private custom domain name: Private REST APIs 1009 Amazon API Gateway Developer Guide aws route53 change-resource-record-sets \ --hosted-zone-id ZABCDEFG1234 \ --change-batch file://path/to/your/setup-dns-record.json Replace thehosted-zone-id with the Route 53 Hosted Zone ID of the DNS record set in your account. The change-batch parameter value points to a JSON file. Next steps for an API consumer You can now invoke the private API in your own AWS account. In your VPC, you can use the following curl command to access your private custom domain name. curl https://private.example.com/v1 For more information about other ways to invoke your private API, see the section called “Invoke a private API using a custom domain name”. API consumer: Delete your domain name access association with a private custom domain name If you are an API consumer, at any time, you can delete the access association resource. The API provider can't delete the domain name access association for you. We recommend that you always delete a domain name access association when you're no longer using it. AWS Management Console To delete the domain name access association 1. 2. 3. Sign in to the API Gateway console at https://console.aws.amazon.com/apigateway. In the main navigation pane, choose Domain name access associations. Select your domain name access association, and then choose Delete. 4. Confirm your choice, and then choose Delete. AWS CLI The following delete-access-association command deletes the access association: aws apigateway delete-domain-name-access-association \ Private REST APIs 1010 Amazon API Gateway Developer Guide --domain-name-access-association-arn 'arn:aws:apigateway:us- west-2:444455556666:/domainnameaccessassociations/domainname/private.example.com +abcd1234/vpcesource/vpce-abcd1234efg' Create a custom domain name for private APIs using AWS CloudFormation The following example AWS CloudFormation template creates a private API and a private custom domain name, maps the private API to the custom domain name, and then creates a domain name access association. You need to provide your own VPC endpoint, domain name, and
apigateway-dg-274
apigateway-dg.pdf
274
Select your domain name access association, and then choose Delete. 4. Confirm your choice, and then choose Delete. AWS CLI The following delete-access-association command deletes the access association: aws apigateway delete-domain-name-access-association \ Private REST APIs 1010 Amazon API Gateway Developer Guide --domain-name-access-association-arn 'arn:aws:apigateway:us- west-2:444455556666:/domainnameaccessassociations/domainname/private.example.com +abcd1234/vpcesource/vpce-abcd1234efg' Create a custom domain name for private APIs using AWS CloudFormation The following example AWS CloudFormation template creates a private API and a private custom domain name, maps the private API to the custom domain name, and then creates a domain name access association. You need to provide your own VPC endpoint, domain name, and certificate ARN. The following considerations might impact your use of AWS CloudFormation to create a private custom domain name: • You can't reject a domain name access association using AWS CloudFormation. To reject a domain name access association, use the AWS CLI. • Use the AWS::ApiGateway::DomainNameV2 AWS CloudFormation property to create a private custom domain name. • Use the AWS::ApiGateway:BasePathMappingV2 AWS CloudFormation property to create a base path mapping. AWSTemplateFormatVersion: 2010-09-09 Parameters: EndpointID: Type: String Default: vpce-abcd1234567efg Description: A VPC endpoint with enableDnsHostnames and enableDnsSupport set to true. DomainName: Type: String Default: private.example.com Description: A domain name that you own. CertificateArn: Type: String Default: arn:aws:acm:us-west-2:123456789:certificate/abcd-000-1234-0000-000000abcd Description: An ACM certificate that covers the domain name. Resources: PrivateApi: Type: 'AWS::ApiGateway::RestApi' Properties: EndpointConfiguration: Private REST APIs 1011 Amazon API Gateway Developer Guide Types: - PRIVATE VpcEndpointIds: - !Ref EndpointID Name: private-api Policy: Statement: - Action: 'execute-api:Invoke' Effect: Allow Principal: '*' Resource: 'execute-api:/*' - Action: 'execute-api:Invoke' Condition: StringNotEquals: 'aws:SourceVpce': !Ref EndpointID Effect: Deny Principal: '*' Resource: 'execute-api:/*' Version: 2012-10-17 PrivateApiDeployment: Type: 'AWS::ApiGateway::Deployment' Properties: RestApiId: !Ref PrivateApi Description: Private API deployment DependsOn: - PrivateApiMethod PrivateApiStage: Type: 'AWS::ApiGateway::Stage' Properties: RestApiId: !Ref PrivateApi DeploymentId: !Ref PrivateApiDeployment StageName: prod PrivateApiMethod: Type: 'AWS::ApiGateway::Method' Properties: HttpMethod: ANY ResourceId: !GetAtt PrivateApi.RootResourceId RestApiId: !Ref PrivateApi AuthorizationType: NONE Integration: Type: MOCK RequestTemplates: application/json: "{\"statusCode\": 200}" IntegrationResponses: Private REST APIs 1012 Amazon API Gateway Developer Guide - StatusCode: '200' MethodResponses: - StatusCode: '200' PrivateDomainName: Type: AWS::ApiGateway::DomainNameV2 Properties: DomainName: !Ref DomainName CertificateArn: !Ref CertificateArn EndpointConfiguration: Types: - PRIVATE SecurityPolicy: TLS_1_2 Policy: Statement: - Action: 'execute-api:Invoke' Effect: Allow Principal: '*' Resource: 'execute-api:/*' - Action: 'execute-api:Invoke' Condition: StringNotEquals: 'aws:SourceVpce': !Ref EndpointID Effect: Deny Principal: '*' Resource: 'execute-api:/*' Version: 2012-10-17 PrivateBasePathMapping: Type: AWS::ApiGateway::BasePathMappingV2 DependsOn: - PrivateApiStage Properties: BasePath: prod DomainNameArn: !GetAtt PrivateDomainName.DomainNameArn RestApiId: !Ref PrivateApi Stage: prod DomainNameAccessAssociation: Type: AWS::ApiGateway::DomainNameAccessAssociation Properties: DomainNameArn: !GetAtt PrivateDomainName.DomainNameArn AccessAssociationSource: !Ref EndpointID AccessAssociationSourceType: VPCE Private REST APIs 1013 Amazon API Gateway Invoke a private API Developer Guide You can only invoke a private API from within a VPC using a VPC endpoint. Your private API must have a resource policy that allows specific VPCs and VPC endpoints to invoke your API. Invoke a private API using a custom domain name To invoke a private API using a custom domain name, your VPC endpoint needs a domain name access association with a custom domain name, and the custom domain name needs to allow access for the VPC endpoint to invoke it. For more information, see the section called “Custom domain names for private APIs”. There are no differences between invoking a private custom domain name in a VPC in your own AWS account or in a different AWS account. Use your custom domain name Inside your VPC, you can invoke your API using the custom domain name. The following example is a curl command to invoke your private custom domain name: curl https://private.example.com Use endpoint-specific private DNS hostnames You can invoke your API using the custom domain name and the endpoint-specific private DNS hostname. curl https://private-dns-hostname.execute-api.region.vpce.amazonaws.com/basepath -H 'Host:custom-domain-name' The following example is a curl command to invoke your custom domain name using an endpoint- specific private DNS hostname: curl https://vpce-123456-abc000.execute-api.us-east-2.vpce.amazonaws.com/test -H 'Host:private.example.com' Invoke a private API without using a custom domain name To invoke your private API without using a custom domain name, you need to identify the DNS names for your API. The following procedure shows how to find your DNS names. Private REST APIs 1014 Amazon API Gateway AWS Management Console To find the DNS names Developer Guide 1. Sign in to the AWS Management Console and open the Amazon VPC console at https:// console.aws.amazon.com/vpc/. 2. 3. In the main navigation pane, choose Endpoints and then choose your interface VPC endpoint for API Gateway. In the Details pane, you'll see five values in the DNS names field. The first three are the public DNS names for your API. The other two are the private DNS names for it. AWS CLI Use the following describe-vpc-endpoints command to list your DNS values. aws ec2 describe-vpc-endpoints --vpc-endpoint-ids vpce-01234567abcdef012 The first three are the public DNS names for your API. The other two are the private DNS names for it. Invoke a private API using a Route53 alias You can associate or disassociate a VPC endpoint
apigateway-dg-275
apigateway-dg.pdf
275
choose Endpoints and then choose your interface VPC endpoint for API Gateway. In the Details pane, you'll see five values in the DNS names field. The first three are the public DNS names for your API. The other two are the private DNS names for it. AWS CLI Use the following describe-vpc-endpoints command to list your DNS values. aws ec2 describe-vpc-endpoints --vpc-endpoint-ids vpce-01234567abcdef012 The first three are the public DNS names for your API. The other two are the private DNS names for it. Invoke a private API using a Route53 alias You can associate or disassociate a VPC endpoint with your private API. For more information, see the section called “(Optional) Associate or disassociate a VPC endpoint with a private API”. After you associate your VPC endpoints with your private API, you can use the following base URL to invoke the API: https://{rest-api-id}-{vpce-id}.execute-api.{region}.amazonaws.com/{stage} For example, if you set up the GET /pets method for the test stage, and your REST API ID was 01234567ab, and your VPC endpoint ID was vpce-01234567abcdef012, and your Region was us-west-2, you can invoke your API as: curl -v https://01234567ab-vpce-01234567abcdef012.execute-api.us-west-2.amazonaws.com/ test/pets Private REST APIs 1015 Amazon API Gateway Developer Guide Invoke a private API using private DNS names If you've enabled private DNS, you can access your private API using the following private DNS name: {restapi-id}.execute-api.{region}.amazonaws.com The base URL to invoke the API is in the following format: https://{restapi-id}.execute-api.{region}.amazonaws.com/{stage} For example, if you set up the GET /pets method for the test stage, and your REST API ID was 01234567ab and your Region was us-west-2, you could invoke your private API by entering the following URL in a browser: https://01234567ab.execute-api.us-west-2.amazonaws.com/test/pets Alternatively, you could use the following cURL command to invoke your private API: curl -X GET https://01234567ab.execute-api.us-west-2.amazonaws.com/test/pets Warning If you enable private DNS for your VPC endpoint, you won't be able to access the default endpoint for public APIs. For more information, see Why can't I connect to my public API from an API Gateway VPC endpoint?. Invoke a private API using AWS Direct Connect You can use AWS Direct Connect to establish a dedicated private connection from an on-premises network to Amazon VPC and access your private API endpoint over that connection by using public DNS names. You can also use private DNS names to access your private API from an on-premises network by setting up an Amazon Route 53 Resolver inbound endpoint and forwarding it all DNS queries of the private DNS from your remote network. For more information, see Forwarding inbound DNS queries to your VPCs in the Amazon Route 53 Developer Guide. Private REST APIs 1016 Amazon API Gateway Developer Guide Invoke a private API using endpoint-specific public DNS hostnames You can access your private API using endpoint-specific DNS hostnames. These are public DNS hostnames containing the VPC endpoint ID or API ID for your private API. The generated base URL is in the following format: https://{public-dns-hostname}.execute-api.{region}.vpce.amazonaws.com/{stage} For example, if you set up the GET /pets method for the test stage, and your REST API ID was abc1234, its public DNS hostname was vpce-def-01234567, and your Region was us-west-2, you could invoke your private API using its VPCe ID by using the Host header in a cURL command: curl -v https://vpce-def-01234567.execute-api.us-west-2.vpce.amazonaws.com/test/pets -H 'Host: abc1234.execute-api.us-west-2.amazonaws.com' Alternatively, you can invoke your private API via its API ID by using the x-apigw-api-id header in a cURL command in the following format: curl -v https://{public-dns-hostname}.execute-api.{region}.vpce.amazonaws.com/{stage} - H 'x-apigw-api-id:{api-id}' Monitor REST APIs in API Gateway In this section, you can learn how to monitor your API by using CloudWatch metrics, CloudWatch Logs, Firehose, and AWS X-Ray. By combining CloudWatch execution logs and CloudWatch metrics, you can log errors and execution traces, and monitor your API's performance. You might also want to log API calls to Firehose. You can also use AWS X-Ray to trace calls through the downstream services that make up your API. Note API Gateway might not generate logs and metrics in the following cases: • 413 Request Entity Too Large errors • Excessive 429 Too Many Requests errors • 400 series errors from requests sent to a custom domain that has no API mapping • 500 series errors caused by internal failures Monitor 1017 Amazon API Gateway Developer Guide API Gateway will not generate logs and metrics when testing a REST API method. The CloudWatch entries are simulated. For more information, see the section called “Use the console to test a REST API method”. Topics • Monitor REST API execution with Amazon CloudWatch metrics • Set up CloudWatch logging for REST APIs in API Gateway • Log REST API calls to Amazon Data Firehose in API Gateway • Variables for access logging for API Gateway • Trace user requests to REST APIs using X-Ray in API Gateway Monitor REST API execution with
apigateway-dg-276
apigateway-dg.pdf
276
Monitor 1017 Amazon API Gateway Developer Guide API Gateway will not generate logs and metrics when testing a REST API method. The CloudWatch entries are simulated. For more information, see the section called “Use the console to test a REST API method”. Topics • Monitor REST API execution with Amazon CloudWatch metrics • Set up CloudWatch logging for REST APIs in API Gateway • Log REST API calls to Amazon Data Firehose in API Gateway • Variables for access logging for API Gateway • Trace user requests to REST APIs using X-Ray in API Gateway Monitor REST API execution with Amazon CloudWatch metrics You can monitor API execution by using CloudWatch, which collects and processes raw data from API Gateway into readable, near-real-time metrics. These statistics are recorded for a period of 15 months so you can access historical information and gain a better perspective on how your web application or service is performing. By default, API Gateway metric data is automatically sent to CloudWatch in one-minute periods. For more information, see What Is Amazon CloudWatch? in the Amazon CloudWatch User Guide. The metrics reported by API Gateway provide information that you can analyze in different ways. The following list shows some common uses for the metrics that are suggestions to get you started: • Monitor the IntegrationLatency metrics to measure the responsiveness of the backend. • Monitor the Latency metrics to measure the overall responsiveness of your API calls. • Monitor the CacheHitCount and CacheMissCount metrics to optimize cache capacities to achieve a desired performance. Topics • Amazon API Gateway dimensions and metrics • View CloudWatch metrics with the API dashboard in API Gateway CloudWatch metrics 1018 Amazon API Gateway Developer Guide • View API Gateway metrics in the CloudWatch console • View API Gateway log events in the CloudWatch console • Monitoring tools in AWS for API Gateway Amazon API Gateway dimensions and metrics The metrics and dimensions that API Gateway sends to Amazon CloudWatch are listed below. For more information, see Monitor REST API execution with Amazon CloudWatch metrics. API Gateway metrics Amazon API Gateway sends metric data to CloudWatch every minute. The AWS/ApiGateway namespace includes the following metrics. Metric 4XXError 5XXError Description The number of client-side errors captured in a given period. API Gateway counts modified gateway response status codes as 4XXError errors. The Sum statistic represents this metric, namely, the total count of the 4XXError errors in the given peri od. The Average statistic represents the 4XXError error rate, namely, the total count of the 4XXError errors divided by the total number of requests during the period. The denominator corresponds to the Count metric (below). Unit: Count The number of server-side errors captured in a given period. The Sum statistic represents this metric, namely, the total count of the 5XXError errors in the given peri od. The Average statistic represents the 5XXError CloudWatch metrics 1019 Amazon API Gateway Metric CacheHitCount CacheMissCount Developer Guide Description error rate, namely, the total count of the 5XXError errors divided by the total number of requests during the period. The denominator corresponds to the Count metric (below). Unit: Count The number of requests served from the API cache in a given period. The Sum statistic represents this metric, namely, the total count of the cache hits in the given period. The Average statistic represents the cache hit rate, namely, the total count of the cache hits divided by the total number of requests during the period. The denominator corresponds to the Count metric (below). Unit: Count The number of requests served from the backend in a given period, when API caching is enabled. The Sum statistic represents this metric, namely, the total count of the cache misses in the given period. The Average statistic represents the cache miss rate, namely, the total count of the cache misses divided by the total number of requests during the period. The denominator corresponds to the Count metric (below). Unit: Count Count The total number API requests in a given period. The SampleCount statistic represents this metric. Unit: Count CloudWatch metrics 1020 Amazon API Gateway Metric IntegrationLatency Latency Developer Guide Description The time between when API Gateway relays a request to the backend and when it receives a response from the backend. Unit: Millisecond The time between when API Gateway receives a request from a client and when it returns a response to the client. The latency includes the integration latency and other API Gateway overhead. Unit: Millisecond Dimensions for metrics You can use the dimensions in the following table to filter API Gateway metrics. Note API Gateway removes non-ASCII characters from the ApiName dimension before sending metrics to CloudWatch. If the APIName contains no ASCII characters, the API ID is used as the ApiName. Dimension ApiName ApiName, Method, Resource, Stage Description Filters API
apigateway-dg-277
apigateway-dg.pdf
277
when it receives a response from the backend. Unit: Millisecond The time between when API Gateway receives a request from a client and when it returns a response to the client. The latency includes the integration latency and other API Gateway overhead. Unit: Millisecond Dimensions for metrics You can use the dimensions in the following table to filter API Gateway metrics. Note API Gateway removes non-ASCII characters from the ApiName dimension before sending metrics to CloudWatch. If the APIName contains no ASCII characters, the API ID is used as the ApiName. Dimension ApiName ApiName, Method, Resource, Stage Description Filters API Gateway metrics for the REST API with the specified API name. Filters API Gateway metrics for the API method with the specified API name, stage, resource, and method. API Gateway will not send these metrics unless you have explicitly enabled detailed CloudWatc CloudWatch metrics 1021 Amazon API Gateway Dimension ApiName, Stage Developer Guide Description h metrics. In the console, choose a stage, and then for Logs and tracing, select Edit. Select Detailed metrics, and then choose Save changes. Alternatively, you can call the update-stage AWS CLI command to update the metricsEnabled property to true. Enabling these metrics will incur additional charges to your account. For pricing information, see Amazon CloudWatch Pricing. Filters API Gateway metrics for the API stage resource with the specified API name and stage. View CloudWatch metrics with the API dashboard in API Gateway You can use the API dashboard in the API Gateway Console to display the CloudWatch metrics of your deployed API in API Gateway. These are shown as a summary of API activity over time. Topics • Prerequisites • Examine API activities in the dashboard Prerequisites 1. You must have an API created in API Gateway. Follow the instructions in Develop REST APIs in API Gateway. 2. You must have the API deployed at least once. Follow the instructions in Deploy REST APIs in API Gateway. Examine API activities in the dashboard 1. Sign in to the API Gateway console at https://console.aws.amazon.com/apigateway. 2. Choose an API. CloudWatch metrics 1022 Amazon API Gateway Developer Guide 3. 4. In the main navigation pane, choose Dashboard. For Stage, choose the desired stage. 5. Choose Date range to specify a range of dates. 6. Refresh, if needed, and view individual metrics displayed in separate graphs titled API calls, Latency, Integration latency, Latency, 4xx error and 5xx error. Tip To examine method-level CloudWatch metrics, make sure that you have enabled CloudWatch Logs on a method level. For more information about how to set up method-level logging, see Override stage-level settings. View API Gateway metrics in the CloudWatch console Metrics are grouped first by the service namespace, and then by the various dimension combinations within each namespace. To view the metrics at the method-level for your API, turn on detailed metrics. For more information, see the section called “Update stage settings”. To view API Gateway metrics using the CloudWatch console 1. Open the CloudWatch console at https://console.aws.amazon.com/cloudwatch/. 2. If necessary, change the AWS Region. From the navigation bar, select the Region where your 3. 4. 5. 6. AWS resources reside. In the navigation pane, choose Metrics. In the All metrics tab, choose API Gateway. To view metrics by stage, choose the By Stage panel. Then, select your APIs and metric names. To view metrics by specific API, choose the By Api Name panel. Then, select your APIs and metric names. To view metrics using the AWS CLI 1. Use the following list-metrics command to list metrics: aws cloudwatch list-metrics --namespace "AWS/ApiGateway" CloudWatch metrics 1023 Amazon API Gateway Developer Guide After you create a metric, allow up to 15 minutes for the metric to appear. To see metric statistics sooner, use get-metric-data or get-metric-statistics. 2. Use the following get-metrics-statistics command to view the average over a period of time using 5 minute intervals: aws cloudwatch get-metric-statistics --namespace AWS/ApiGateway --metric-name Count --start-time 2011-10-03T23:00:00Z --end-time 2017-10-05T23:00:00Z --period 300 -- statistics Average View API Gateway log events in the CloudWatch console The following section explains the necessary prerequisites and how to view API Gateway log events in the CloudWatch console. Prerequisites 1. You must have an API created in API Gateway. Follow the instructions in Develop REST APIs in API Gateway. 2. You must have the API deployed and invoked at least once. Follow the instructions in Deploy REST APIs in API Gateway and Invoke REST APIs in API Gateway. 3. You must have CloudWatch Logs enabled for a stage. Follow the instructions in Set up CloudWatch logging for REST APIs in API Gateway. To view logged API requests and responses using the CloudWatch console 1. Open the CloudWatch console at https://console.aws.amazon.com/cloudwatch/. 2. If necessary, change the AWS Region. From the navigation bar, select the Region where your AWS resources reside. For more information,
apigateway-dg-278
apigateway-dg.pdf
278
in Develop REST APIs in API Gateway. 2. You must have the API deployed and invoked at least once. Follow the instructions in Deploy REST APIs in API Gateway and Invoke REST APIs in API Gateway. 3. You must have CloudWatch Logs enabled for a stage. Follow the instructions in Set up CloudWatch logging for REST APIs in API Gateway. To view logged API requests and responses using the CloudWatch console 1. Open the CloudWatch console at https://console.aws.amazon.com/cloudwatch/. 2. If necessary, change the AWS Region. From the navigation bar, select the Region where your AWS resources reside. For more information, see Regions and Endpoints. 3. In the navigation pane, choose Logs, Log groups. 4. Under the Log Groups table, choose a log group of the API-Gateway-Execution-Logs_{rest- api-id}/{stage-name} name. 5. Under the Log Streams table, choose a log stream. You can use the timestamp to help locate the log stream of your interest. 6. Choose Text to view raw text or choose Row to view the event row by row. CloudWatch metrics 1024 Amazon API Gateway Important Developer Guide CloudWatch lets you delete log groups or streams. Do not manually delete API Gateway API log groups or streams; let API Gateway manage these resources. Manually deleting log groups or streams may cause API requests and responses not to be logged. If that happens, you can delete the entire log group for the API and redeploy the API. This is because API Gateway creates log groups or log streams for an API stage at the time when it is deployed. Monitoring tools in AWS for API Gateway AWS provides various tools that you can use to monitor API Gateway. You can configure some of these tools to do the monitoring for you automatically, while other tools require manual intervention. We recommend that you automate monitoring tasks as much as possible. Automated monitoring tools in AWS You can use the following automated monitoring tools to watch API Gateway and report when something is wrong: • Amazon CloudWatch Alarms – Watch a single metric over a time period that you specify, and perform one or more actions based on the value of the metric relative to a given threshold over a number of time periods. The action is a notification sent to an Amazon Simple Notification Service (Amazon SNS) topic or Amazon EC2 Auto Scaling policy. CloudWatch alarms do not invoke actions simply because they are in a particular state; the state must have changed and been maintained for a specified number of periods. For more information, see Monitor REST API execution with Amazon CloudWatch metrics. • Amazon CloudWatch Logs – Monitor, store, and access your log files from AWS CloudTrail or other sources. For more information, see What is CloudWatch Logs? in the Amazon CloudWatch User Guide. • Amazon EventBridge (formerly called CloudWatch Events) – Match events and route them to one or more target functions or streams to make changes, capture state information, and take corrective action. For more information, see What Is Amazon EventBridge? in the EventBridge User Guide. • AWS CloudTrail Log Monitoring – Share log files between accounts, monitor CloudTrail log files in real time by sending them to CloudWatch Logs, write log processing applications in Java, and validate that your log files have not changed after delivery by CloudTrail. For more information, see Working with CloudTrail Log Files in the AWS CloudTrail User Guide. CloudWatch metrics 1025 Amazon API Gateway Manual monitoring tools Developer Guide Another important part of monitoring API Gateway involves manually monitoring those items that the CloudWatch alarms don't cover. The API Gateway, CloudWatch, and other AWS console dashboards provide an at-a-glance view of the state of your AWS environment. We recommend that you also check the log files on API execution. • API Gateway dashboard shows the following statistics for a given API stage during a specified period of time: • API Calls • Cache Hit, only when API caching is enabled. • Cache Miss, only when API caching is enabled. • Latency • Integration Latency • 4XX Error • 5XX Error • The CloudWatch home page shows: • Current alarms and status • Graphs of alarms and resources • Service health status In addition, you can use CloudWatch to do the following: • Create customized dashboards to monitor the services you care about • Graph metric data to troubleshoot issues and discover trends • Search and browse all your AWS resource metrics • Create and edit alarms to be notified of problems Creating CloudWatch alarms to monitor API Gateway You can create a CloudWatch alarm that sends an Amazon SNS message when the alarm changes state. An alarm watches a single metric over a time period you specify, and performs one or more actions based on the value of the metric relative to
apigateway-dg-279
apigateway-dg.pdf
279
addition, you can use CloudWatch to do the following: • Create customized dashboards to monitor the services you care about • Graph metric data to troubleshoot issues and discover trends • Search and browse all your AWS resource metrics • Create and edit alarms to be notified of problems Creating CloudWatch alarms to monitor API Gateway You can create a CloudWatch alarm that sends an Amazon SNS message when the alarm changes state. An alarm watches a single metric over a time period you specify, and performs one or more actions based on the value of the metric relative to a given threshold over a number of time periods. The action is a notification sent to an Amazon SNS topic or Auto Scaling policy. Alarms invoke actions for sustained state changes only. CloudWatch alarms do not invoke actions simply CloudWatch metrics 1026 Amazon API Gateway Developer Guide because they are in a particular state; the state must have changed and been maintained for a specified number of periods. Set up CloudWatch logging for REST APIs in API Gateway To help debug issues related to request execution or client access to your API, you can enable Amazon CloudWatch Logs to log API calls. For more information about CloudWatch, see the section called “CloudWatch metrics”. CloudWatch log formats for API Gateway There are two types of API logging in CloudWatch: execution logging and access logging. In execution logging, API Gateway manages the CloudWatch Logs. The process includes creating log groups and log streams, and reporting to the log streams any caller's requests and responses. The logged data includes errors or execution traces (such as request or response parameter values or payloads), data used by Lambda authorizers (formerly known as custom authorizers), whether API keys are required, whether usage plans are enabled, and other information. API Gateway redacts authorization headers, API key values, and similar sensitive request parameters from the logged data. To improve your security posture, we recommend that you use execution logging at the ERROR or INFO level. You might need to do this to comply with various compliance frameworks. For more information, see Amazon API Gateway controls in the AWS Security Hub User Guide. When you deploy an API, API Gateway creates a log group and log streams under the log group. The log group is named following the API-Gateway-Execution-Logs_{rest-api-id}/ {stage_name} format. Within each log group, the logs are further divided into log streams, which are ordered by Last Event Time as logged data is reported. In access logging, you, as an API developer, want to log who has accessed your API and how the caller accessed the API. You can create your own log group or choose an existing log group that could be managed by API Gateway. To specify the access details, you select $context variables, a log format, and a log group destination. The access log format must include at least $context.requestId or $context.extendedRequestId. As a best practice, include $context.requestId and $context.extendedRequestId in your log format. CloudWatch logs 1027 Amazon API Gateway $context.requestId Developer Guide This logs the value in the x-amzn-RequestId header. Clients can override the value in the x-amzn-RequestId header with a value in the format of a universally unique identifier (UUID). API Gateway returns this request ID in the x-amzn-RequestId response header. API Gateway replaces overridden request IDs that aren't in the format of a UUID with UUID_REPLACED_INVALID_REQUEST_ID in your access logs. $context.extendedRequestId The extendedRequestID is a unique ID that API Gateway generates. API Gateway returns this request ID in the x-amz-apigw-id response header. An API caller can't provide or override this request ID. You might need to provide this value to AWS Support to help troubleshoot your API. For more information, see the section called “Variables for access logging for API Gateway”. Choose a log format that is also adopted by your analytic backend, such as Common Log Format (CLF), JSON, XML, or CSV. You can then feed the access logs to it directly to have your metrics computed and rendered. To define the log format, set the log group ARN on the accessLogSettings/destinationArn property on the stage. You can obtain a log group ARN in the CloudWatch console. To define the access log format, set a chosen format on the accessLogSetting/format property on the stage. Examples of some commonly used access log formats are shown in the API Gateway console and are listed as follows. • CLF (Common Log Format): $context.identity.sourceIp $context.identity.caller $context.identity.user [$context.requestTime]"$context.httpMethod $context.resourcePath $context.protocol" $context.status $context.responseLength $context.requestId $context.extendedRequestId • JSON: { "requestId":"$context.requestId", "extendedRequestId":"$context.extendedRequestId","ip": "$context.identity.sourceIp", "caller":"$context.identity.caller", "user":"$context.identity.user", "requestTime":"$context.requestTime", "httpMethod":"$context.httpMethod", "resourcePath":"$context.resourcePath", "status":"$context.status", "protocol":"$context.protocol", "responseLength":"$context.responseLength" } CloudWatch logs 1028 Amazon API Gateway • XML: Developer Guide <request id="$context.requestId"> <extendedRequestId>$context.extendedRequestId</ extendedRequestId> <ip>$context.identity.sourceIp</ip> <caller> $context.identity.caller</caller> <user>$context.identity.user</user> <requestTime> $context.requestTime</requestTime> <httpMethod>$context.httpMethod</httpMethod> <resourcePath>$context.resourcePath</resourcePath> <status>$context.status</status> <protocol>$context.protocol</protocol> <responseLength>$context.responseLength</ responseLength> </request> • CSV (comma-separated values): $context.identity.sourceIp,$context.identity.caller,$context.identity.user, $context.requestTime,$context.httpMethod,$context.resourcePath,$context.protocol, $context.status,$context.responseLength,$context.requestId,$context.extendedRequestId Permissions for CloudWatch
apigateway-dg-280
apigateway-dg.pdf
280
log format, set a chosen format on the accessLogSetting/format property on the stage. Examples of some commonly used access log formats are shown in the API Gateway console and are listed as follows. • CLF (Common Log Format): $context.identity.sourceIp $context.identity.caller $context.identity.user [$context.requestTime]"$context.httpMethod $context.resourcePath $context.protocol" $context.status $context.responseLength $context.requestId $context.extendedRequestId • JSON: { "requestId":"$context.requestId", "extendedRequestId":"$context.extendedRequestId","ip": "$context.identity.sourceIp", "caller":"$context.identity.caller", "user":"$context.identity.user", "requestTime":"$context.requestTime", "httpMethod":"$context.httpMethod", "resourcePath":"$context.resourcePath", "status":"$context.status", "protocol":"$context.protocol", "responseLength":"$context.responseLength" } CloudWatch logs 1028 Amazon API Gateway • XML: Developer Guide <request id="$context.requestId"> <extendedRequestId>$context.extendedRequestId</ extendedRequestId> <ip>$context.identity.sourceIp</ip> <caller> $context.identity.caller</caller> <user>$context.identity.user</user> <requestTime> $context.requestTime</requestTime> <httpMethod>$context.httpMethod</httpMethod> <resourcePath>$context.resourcePath</resourcePath> <status>$context.status</status> <protocol>$context.protocol</protocol> <responseLength>$context.responseLength</ responseLength> </request> • CSV (comma-separated values): $context.identity.sourceIp,$context.identity.caller,$context.identity.user, $context.requestTime,$context.httpMethod,$context.resourcePath,$context.protocol, $context.status,$context.responseLength,$context.requestId,$context.extendedRequestId Permissions for CloudWatch logging To enable CloudWatch Logs, you must grant API Gateway permission to read and write logs to CloudWatch for your account. The AmazonAPIGatewayPushToCloudWatchLogs has all the required permissions. Note API Gateway calls AWS Security Token Service in order to assume the IAM role, so make sure that AWS STS is enabled for the Region. For more information, see Managing AWS STS in an AWS Region. To grant these permissions to your account, create an IAM role with apigateway.amazonaws.com as its trusted entity, attach the preceding policy to the IAM role, and set the IAM role ARN on the cloudWatchRoleArn property on your Account. You must set the cloudWatchRoleArn property separately for each AWS Region in which you want to enable CloudWatch Logs. If you receive an error when setting the IAM role ARN, check your AWS Security Token Service account settings to make sure that AWS STS is enabled in the Region that you're using. For more information about enabling AWS STS, see Managing AWS STS in an AWS Region in the IAM User Guide. CloudWatch logs 1029 Amazon API Gateway Developer Guide Set up CloudWatch API logging using the API Gateway console To set up CloudWatch API logging, you must have deployed the API to a stage. You must also have configured an appropriate CloudWatch Logs role ARN for your account. 1. Sign in to the API Gateway console at https://console.aws.amazon.com/apigateway. 2. On the main navigation pane, choose Settings, and then under Logging, choose Edit. 3. For CloudWatch log role ARN, enter an ARN of an IAM role with appropriate permissions. You need to do this once for each AWS account that creates APIs using API Gateway. 4. In the main navigation pane, choose APIs, and then do one of the following: a. Choose an existing API, and then choose a stage. b. Create an API, and then deploy it to a stage. 5. 6. 7. In the main navigation pane, choose Stages. In the Logs and tracing section, choose Edit. To enable execution logging: a. Select a logging level from the CloudWatch Logs dropdown menu. The logging levels are the following: • Off – Logging is not turned on for this stage. • Errors only – Logging is enabled for errors only. • Errors and info logs – Logging is enabled for all events. b. (Optional) Select Data tracing to turn on data trace logging for your stage. This can be useful to troubleshoot APIs, but can result in logging sensitive data. Note We recommend that you don't use Data tracing for production APIs. c. (Optional) Select Detailed metrics to turn on detailed CloudWatch metrics. For more information about CloudWatch metrics, see the section called “CloudWatch metrics”. 8. To enable access logging: a. Turn on Custom access logging. CloudWatch logs 1030 Amazon API Gateway Developer Guide b. For Access log destination ARN, enter the ARN of a log group. The ARN format is arn:aws:logs:{region}:{account-id}:log-group:log-group-name. c. For Log Format, enter a log format. You can choose CLF, JSON, XML, or CSV. To learn more about example log formats, see the section called “CloudWatch log formats for API Gateway”. 9. Choose Save changes. Note You can enable execution logging and access logging independently of each other. API Gateway is now ready to log requests to your API. You don't need to redeploy the API when you update the stage settings, logs, or stage variables. Set up CloudWatch API logging using AWS CloudFormation Use the following example AWS CloudFormation template to create an Amazon CloudWatch Logs log group and configure execution and access logging for a stage. To enable CloudWatch Logs, you must grant API Gateway permission to read and write logs to CloudWatch for your account. To learn more, see Associate account with IAM role in the AWS CloudFormation User Guide. TestStage: Type: AWS::ApiGateway::Stage Properties: StageName: test RestApiId: !Ref MyAPI DeploymentId: !Ref Deployment Description: "test stage description" MethodSettings: - ResourcePath: "/*" HttpMethod: "*" LoggingLevel: INFO AccessLogSetting: DestinationArn: !GetAtt MyLogGroup.Arn Format: $context.extendedRequestId $context.identity.sourceIp $context.identity.caller $context.identity.user [$context.requestTime] "$context.httpMethod $context.resourcePath $context.protocol" $context.status $context.responseLength $context.requestId CloudWatch logs 1031 Amazon API Gateway MyLogGroup: Type: AWS::Logs::LogGroup Properties: LogGroupName: !Join - '-' - - !Ref MyAPI - access-logs Developer Guide Log REST API calls to Amazon Data
apigateway-dg-281
apigateway-dg.pdf
281
you must grant API Gateway permission to read and write logs to CloudWatch for your account. To learn more, see Associate account with IAM role in the AWS CloudFormation User Guide. TestStage: Type: AWS::ApiGateway::Stage Properties: StageName: test RestApiId: !Ref MyAPI DeploymentId: !Ref Deployment Description: "test stage description" MethodSettings: - ResourcePath: "/*" HttpMethod: "*" LoggingLevel: INFO AccessLogSetting: DestinationArn: !GetAtt MyLogGroup.Arn Format: $context.extendedRequestId $context.identity.sourceIp $context.identity.caller $context.identity.user [$context.requestTime] "$context.httpMethod $context.resourcePath $context.protocol" $context.status $context.responseLength $context.requestId CloudWatch logs 1031 Amazon API Gateway MyLogGroup: Type: AWS::Logs::LogGroup Properties: LogGroupName: !Join - '-' - - !Ref MyAPI - access-logs Developer Guide Log REST API calls to Amazon Data Firehose in API Gateway To help debug issues related to client access to your API, you can log API calls to Amazon Data Firehose. For more information about Firehose, see What Is Amazon Data Firehose?. For access logging, you can only enable CloudWatch or Firehose—you can't enable both. However, you can enable CloudWatch for execution logging and Firehose for access logging. Topics • Firehose log formats for API Gateway • Permissions for Firehose logging • Set up Firehose access logging by using the API Gateway console Firehose log formats for API Gateway Firehose logging uses the same format as CloudWatch logging. Permissions for Firehose logging When Firehose access logging is enabled on a stage, API Gateway creates a service-linked role in your account if the role doesn't exist already. The role is named AWSServiceRoleForAPIGateway and has the APIGatewayServiceRolePolicy managed policy attached to it. For more information about service-linked roles, see Using Service-Linked Roles. Note The name of your Firehose stream must be amazon-apigateway-{your-stream-name}. Firehose 1032 Amazon API Gateway Developer Guide Set up Firehose access logging by using the API Gateway console To set up API logging, you must have deployed the API to a stage. You must also have created a Firehose stream. 1. Sign in to the API Gateway console at https://console.aws.amazon.com/apigateway. 2. Do one of the following: a. Choose an existing API, and then choose a stage. b. Create an API and deploy it to a stage. In the main navigation pane, choose Stages. In the Logs and tracing section, choose Edit. To enable access logging to a Firehose stream: 3. 4. 5. a. b. Turn on Custom access logging. For Access log destination ARN, enter the ARN of a Firehose stream. The ARN format is arn:aws:firehose:{region}:{account-id}:deliverystream/amazon- apigateway-{your-stream-name}. Note The name of your Firehose stream must be amazon-apigateway-{your- stream-name}. c. For Log format, enter a log format. You can choose CLF, JSON, XML, or CSV. To learn more about example log formats, see the section called “CloudWatch log formats for API Gateway”. 6. Choose Save changes. API Gateway is now ready to log requests to your API to Firehose. You don't need to redeploy the API when you update the stage settings, logs, or stage variables. Variables for access logging for API Gateway In access logging, you, as an API developer, want to log who has accessed your API and how the caller accessed the API. You can create your own log group or choose an existing log group that Variables for access logging for API Gateway 1033 Amazon API Gateway Developer Guide could be managed by API Gateway. To specify the access details, you can use the following case- sensitive $context variables. For a list of reference variables for data transformations, see the section called “Variables for data transformations”. Parameter Description $context.accountId The API owner's AWS account ID. $context.apiId The identifier API Gateway assigns to your API. $context.authorize.error The authorization error message. $context.authorize.latency The authorization latency in ms. $context.authorize.status $context.authorizer.claims. property The status code returned from an authoriza tion attempt. A property of the claims returned from the Amazon Cognito user pool after the method caller is successfully authenticated. For more information, see the section called “Use Amazon Cognito user pool as authorizer for a REST API”. Note Calling $context.authorize r.claims returns null. $context.authorizer.error The error message returned from an authorize r. $context.authorizer.integra The authorizer integration latency in ms. tionLatency $context.authorizer.integra tionStatus The status code returned from a Lambda authorizer. Variables for access logging for API Gateway 1034 Amazon API Gateway Parameter Description Developer Guide $context.authorizer.latency The authorizer latency in ms. $context.authorizer.principalId The principal user identification associated with the token sent by the client and returned from an API Gateway Lambda authorizer (formerly known as a custom authorizer). For more information, see the section called “Use Lambda authorizers”. $context.authorizer. property The stringified value of the specified key-value pair of the context map returned from an API Gateway Lambda authorizer function. For example, if the authorizer returns the following context map: "context" : { "key": "value", "numKey": 1, "boolKey": true } Calling $context.authorizer.key returns the "value" string, calling $context.authorizer.numKey the "1" string, and calling $context. returns the authorizer.boolKey "true" string. returns For property, the only supported special character
apigateway-dg-282
apigateway-dg.pdf
282
with the token sent by the client and returned from an API Gateway Lambda authorizer (formerly known as a custom authorizer). For more information, see the section called “Use Lambda authorizers”. $context.authorizer. property The stringified value of the specified key-value pair of the context map returned from an API Gateway Lambda authorizer function. For example, if the authorizer returns the following context map: "context" : { "key": "value", "numKey": 1, "boolKey": true } Calling $context.authorizer.key returns the "value" string, calling $context.authorizer.numKey the "1" string, and calling $context. returns the authorizer.boolKey "true" string. returns For property, the only supported special character is the underscore (_) character. For more information, see the section called “Use Lambda authorizers”. $context.authorizer.requestId The AWS endpoint's request ID. $context.authorizer.status The status code returned from an authorizer. Variables for access logging for API Gateway 1035 Amazon API Gateway Parameter Description Developer Guide $context.authenticate.error The error message returned from an authentic ation attempt. $context.authenticate.latency The authentication latency in ms. $context.authenticate.status The status code returned from an authentic ation attempt. $context.awsEndpointRequestId The AWS endpoint's request ID. $context.customDomain.baseP athMatched The path for an API mapping that an incoming request matched. Applicable when a client uses a custom domain name to access an API. For example if a client sends a request to https://api.example.com/v1/ orders/1234 , and the request matches the API mapping with the path v1/orders , the value is v1/orders . To learn more, see the section called “API mappings”. $context.deploymentId The ID of the API deployment. $context.domainName $context.domainPrefix The full domain name used to invoke the API. This should be the same as the incoming Host header. The first label of the $context.domainNam e . $context.endpointType The endpoint type of the API. Variables for access logging for API Gateway 1036 Amazon API Gateway Parameter $context.error.message $context.error.messageString $context.error.responseType Developer Guide Description A string containing an API Gateway error message. This variable can only be used for simple variable substitution in a GatewayRe sponse body-mapping template, which is not processed by the Velocity Template Language engine, and in access logging. For more information, see the section called “Metrics” and the section called “Setting up gateway responses to customize error responses”. The quoted value of $context.error.mes sage , namely "$context.error.me ssage" . A type of GatewayResponse. This variable can only be used for simple variable substitut ion in a GatewayResponse body-mapping template, which is not processed by the Velocity Template Language engine, and in access logging. For more information, see the section called “Metrics” and the section called “Setting up gateway responses to customize error responses”. $context.error.validationEr rorString A string containing a detailed validation error message. $context.extendedRequestId $context.httpMethod The extended ID that API Gateway generates and assigns to the API request. The extended request ID contains useful information for debugging and troubleshooting. The HTTP method used. Valid values include: DELETE, GET, HEAD, OPTIONS, PATCH, POST, and PUT. Variables for access logging for API Gateway 1037 Amazon API Gateway Parameter $context.identity.accountId $context.identity.apiKey $context.identity.apiKeyId $context.identity.caller $context.identity.cognitoAu thenticationProvider Developer Guide Description The AWS account ID associated with the request. For API methods that require an API key, this variable is the API key associated with the method request. For methods that don't require an API key, this variable is null. For more information, see the section called “Usage plans”. The API key ID associated with an API request that requires an API key. The principal identifier of the caller that signed the request. Supported for resources that use IAM authorization. A comma-separated list of all the Amazon Cognito authentication providers used by the caller making the request. Available only if the request was signed with Amazon Cognito credentials. For example, for an identity from an Amazon Cognito user pool, cognito-idp. region.amazonaws.com/ user_pool _id ,cognito-idp. region.amazonaw s.com/ user_pool_id :CognitoS ignIn: token subject claim For information about the available Amazon Cognito authentication providers, see Using Federated Identities in the Amazon Cognito Developer Guide. Variables for access logging for API Gateway 1038 Amazon API Gateway Parameter $context.identity.cognitoAu thenticationType $context.identity.cognitoId entityId $context.identity.cognitoId entityPoolId Developer Guide Description The Amazon Cognito authentication type of the caller making the request. Available only if the request was signed with Amazon Cognito credentials. Possible values include authenticated for authenticated identities and unauthenticated for unauthenticated identities. The Amazon Cognito identity ID of the caller making the request. Available only if the request was signed with Amazon Cognito credentials. The Amazon Cognito identity pool ID of the caller making the request. Available only if the request was signed with Amazon Cognito credentials. $context.identity.principalOrgId The AWS organization ID. $context.identity.sourceIp $context.identity.clientCer t.clientCertPem The source IP address of the immediate TCP connection making the request to the API Gateway endpoint. The PEM-encoded client certificate that the client presented during mutual TLS authentic ation. Present when a client accesses an API by using a custom domain name that has mutual
apigateway-dg-283
apigateway-dg.pdf
283
identities. The Amazon Cognito identity ID of the caller making the request. Available only if the request was signed with Amazon Cognito credentials. The Amazon Cognito identity pool ID of the caller making the request. Available only if the request was signed with Amazon Cognito credentials. $context.identity.principalOrgId The AWS organization ID. $context.identity.sourceIp $context.identity.clientCer t.clientCertPem The source IP address of the immediate TCP connection making the request to the API Gateway endpoint. The PEM-encoded client certificate that the client presented during mutual TLS authentic ation. Present when a client accesses an API by using a custom domain name that has mutual TLS enabled. Present only in access logs if mutual TLS authentication fails. Variables for access logging for API Gateway 1039 Amazon API Gateway Parameter $context.identity.clientCer t.subjectDN $context.identity.clientCer t.issuerDN $context.identity.clientCer t.serialNumber $context.identity.clientCer t.validity.notBefore $context.identity.clientCer t.validity.notAfter $context.identity.vpcId Developer Guide Description The distinguished name of the subject of the certificate that a client presents. Present when a client accesses an API by using a custom domain name that has mutual TLS enabled. Present only in access logs if mutual TLS authentication fails. The distinguished name of the issuer of the certificate that a client presents. Present when a client accesses an API by using a custom domain name that has mutual TLS enabled. Present only in access logs if mutual TLS authentication fails. The serial number of the certificate. Present when a client accesses an API by using a custom domain name that has mutual TLS enabled. Present only in access logs if mutual TLS authentication fails. The date before which the certificate is invalid. Present when a client accesses an API by using a custom domain name that has mutual TLS enabled. Present only in access logs if mutual TLS authentication fails. The date after which the certificate is invalid. Present when a client accesses an API by using a custom domain name that has mutual TLS enabled. Present only in access logs if mutual TLS authentication fails. The VPC ID of the VPC making the request to the API Gateway endpoint. Variables for access logging for API Gateway 1040 Amazon API Gateway Parameter $context.identity.vpceId $context.identity.user Developer Guide Description The VPC endpoint ID of the VPC endpoint making the request to the API Gateway endpoint. Present only when you have a private API. The principal identifier of the user that will be authorized against resource access. Supported for resources that use IAM authorization. $context.identity.userAgent The User-Agent header of the API caller. $context.identity.userArn $context.integration.error $context.integration.integr ationStatus The Amazon Resource Name (ARN) of the effective user identified after authentication. For more information, see https://docs.aws. amazon.com/IAM/latest/UserGuide/id_users. html. The error message returned from an integrati on. For Lambda proxy integration, the status code returned from AWS Lambda, not from the backend Lambda function code. $context.integration.latency The integration latency in ms. Equivalent to $context.integrationLatency . $context.integration.requestId The AWS endpoint's request ID. Equivalent to $context.integration.status $context.awsEndpointRequestId . The status code returned from an integrati on. For Lambda proxy integrations, this is the status code that your Lambda function code returns. $context.integrationLatency The integration latency in ms. Variables for access logging for API Gateway 1041 Amazon API Gateway Parameter $context.integrationStatus $context.isCanaryRequest $context.path Developer Guide Description For Lambda proxy integration, this parameter represents the status code returned from AWS Lambda, not from the backend Lambda function code. Returns true if the request was directed to the canary and false if the request was not directed to the canary. Present only when you have a canary enabled. The request path. For example, for a non- proxy request URL of https://{rest- api-id}.execute-api.{region}.am azonaws.com/{stage}/root/child the $context.path value is /{stage}/ , root/child . $context.protocol The request protocol, for example, HTTP/1.1. Note API Gateway APIs can accept HTTP/2 requests, but API Gateway sends requests to backend integrations using HTTP/1.1. As a result, the request protocol is logged as HTTP/1.1 even if a client sends a request that uses HTTP/2. An ID for the request. Clients can override this request ID. Use $context.extendedR equestId for a unique request ID that API Gateway generates. $context.requestId Variables for access logging for API Gateway 1042 Amazon API Gateway Parameter $context.requestOverride.he ader. header_name $context.requestOverride.pa th. path_name $context.requestOverride.qu erystring. querystring_name Developer Guide Description The request header override. If this parameter is defined, it contains the headers to be used instead of the HTTP Headers that are defined in the Integration Request pane. For more information, see Override your API's request and response parameters and status codes for REST APIs in API Gateway. The request path override. If this parameter is defined, it contains the request path to be used instead of the URL Path Parameters that are defined in the Integration Request pane. For more information, see Override your API's request and response parameters and status codes for REST APIs in API Gateway. The request query string override. If this parameter
apigateway-dg-284
apigateway-dg.pdf
284
defined, it contains the headers to be used instead of the HTTP Headers that are defined in the Integration Request pane. For more information, see Override your API's request and response parameters and status codes for REST APIs in API Gateway. The request path override. If this parameter is defined, it contains the request path to be used instead of the URL Path Parameters that are defined in the Integration Request pane. For more information, see Override your API's request and response parameters and status codes for REST APIs in API Gateway. The request query string override. If this parameter is defined, it contains the request query strings to be used instead of the URL Query String Parameters that are defined in the Integration Request pane. For more information, see Override your API's request and response parameters and status codes for REST APIs in API Gateway. $context.responseLatency The response latency in ms. $context.responseLength The response payload length in bytes. Variables for access logging for API Gateway 1043 Amazon API Gateway Parameter $context.responseOverride.h eader. header_name $context.responseOverride.status Developer Guide Description The response header override. If this parameter is defined, it contains the header to be returned instead of the Response header that is defined as the Default mapping in the Integration Response pane. For more information, see Override your API's request and response parameters and status codes for REST APIs in API Gateway. The response status code override. If this parameter is defined, it contains the status code to be returned instead of the Method response status that is defined as the Default mapping in the Integration Response pane. For more information, see Override your API's request and response parameters and status codes for REST APIs in API Gateway. $context.requestTime The CLF-formatted request time (dd/MMM/yy $context.requestTimeEpoch yy:HH:mm:ss +-hhmm ). The Epoch-formatted request time, in milliseconds. $context.resourceId The identifier that API Gateway assigns to your resource. $context.resourcePath The path to your resource. For example, for the non-proxy request URI of https:// {rest-api-id}.execute-api.{r egion}.amazonaws.com/{stage}/ root/child , The $context.resourceP ath value is /root/child . For more information, see Tutorial: Create a REST API with an HTTP non-proxy integration. Variables for access logging for API Gateway 1044 Amazon API Gateway Parameter Description Developer Guide $context.stage The deployment stage of the API request (for example, Beta or Prod). $context.status The method response status. $context.waf.error The error message returned from AWS WAF. $context.waf.latency The AWS WAF latency in ms. $context.waf.status The status code returned from AWS WAF. $context.xrayTraceId The trace ID for the X-Ray trace. For more information, see the section called “Set up AWS X-Ray”. $context.wafResponseCode The response received from AWS WAF: $context.webaclArn WAF_ALLOW or WAF_BLOCK . Will not be set if the stage is not associated with a web ACL. For more information, see the section called “AWS WAF”. The complete ARN of the web ACL that is used to decide whether to allow or block the request. Will not be set if the stage is not associated with a web ACL. For more informati on, see the section called “AWS WAF”. Trace user requests to REST APIs using X-Ray in API Gateway You can use AWS X-Ray to trace and analyze user requests as they travel through your Amazon API Gateway REST APIs to the underlying services. API Gateway supports X-Ray tracing for all API Gateway REST API endpoint types: Regional, edge-optimized, and private. You can use X-Ray with Amazon API Gateway in all AWS Regions where X-Ray is available. Because X-Ray gives you an end-to-end view of an entire request, you can analyze latencies in your APIs and their backend services. You can use an X-Ray service map to view the latency of an entire X-Ray 1045 Amazon API Gateway Developer Guide request and that of the downstream services that are integrated with X-Ray. You can also configure sampling rules to tell X-Ray which requests to record and at what sampling rates, according to criteria that you specify. If you call an API Gateway API from a service that's already being traced, API Gateway passes the trace through, even if X-Ray tracing isn't enabled on the API. You can enable X-Ray for an API stage by using the API Gateway console, or by using the API Gateway API or CLI. Topics • Set up AWS X-Ray with API Gateway REST APIs • Use AWS X-Ray service maps and trace views with API Gateway • Configure AWS X-Ray sampling rules for API Gateway APIs • AWS X-Ray traces for Amazon API Gateway APIs Set up AWS X-Ray with API Gateway REST APIs In this section you can find detailed information on how to set up AWS X-Ray with API Gateway REST APIs. Topics • X-Ray tracing modes for API Gateway • Permissions for X-Ray tracing • Enabling X-Ray tracing in the API Gateway console •
apigateway-dg-285
apigateway-dg.pdf
285
the API Gateway API or CLI. Topics • Set up AWS X-Ray with API Gateway REST APIs • Use AWS X-Ray service maps and trace views with API Gateway • Configure AWS X-Ray sampling rules for API Gateway APIs • AWS X-Ray traces for Amazon API Gateway APIs Set up AWS X-Ray with API Gateway REST APIs In this section you can find detailed information on how to set up AWS X-Ray with API Gateway REST APIs. Topics • X-Ray tracing modes for API Gateway • Permissions for X-Ray tracing • Enabling X-Ray tracing in the API Gateway console • Enabling AWS X-Ray tracing using the API Gateway CLI X-Ray tracing modes for API Gateway The path of a request through your application is tracked with a trace ID. A trace collects all of the segments generated by a single request, typically an HTTP GET or POST request. There are two modes of tracing for an API Gateway API: • Passive: This is the default setting if you have not enabled X-Ray tracing on an API stage. This approach means that the API Gateway API is only traced if X-Ray has been enabled on an upstream service. X-Ray 1046 Amazon API Gateway Developer Guide • Active: When an API Gateway API stage has this setting, API Gateway automatically samples API invocation requests, based on the sampling algorithm specified by X-Ray. When active tracing is enabled on a stage, API Gateway creates a service-linked role in your account, if the role does not exist already. The role is named AWSServiceRoleForAPIGateway and will have the APIGatewayServiceRolePolicy managed policy attached to it. For more information about service-linked roles, see Using Service-Linked Roles. Note X-Ray applies a sampling algorithm to ensure that tracing is efficient, while still providing a representative sample of the requests that your API receives. The default sampling algorithm is 1 request per second, with 5 percent of requests sampled past that limit. You can change the tracing mode for your API by using the API Gateway management console, the API Gateway CLI, or an AWS SDK. Permissions for X-Ray tracing When you enable X-Ray tracing on a stage, API Gateway creates a service-linked role in your account, if the role does not exist already. The role is named AWSServiceRoleForAPIGateway and will have the APIGatewayServiceRolePolicy managed policy attached to it. For more information about service-linked roles, see Using Service-Linked Roles. Enabling X-Ray tracing in the API Gateway console You can use the Amazon API Gateway console to enable active tracing on an API stage. These steps assume that you have already deployed the API to a stage. 1. Sign in to the API Gateway console at https://console.aws.amazon.com/apigateway. 2. Choose your API, and then in the main navigation pane, choose Stages. 3. 4. 5. In the Stages pane, choose a stage. In the Logs and tracing section, choose Edit. To enable active X-Ray tracing, select X-Ray tracing to turn on X-Ray tracing. 6. Choose Save changes. X-Ray 1047 Amazon API Gateway Developer Guide Once you've enabled X-Ray for your API stage, you can use the X-Ray management console to view the traces and service maps. Enabling AWS X-Ray tracing using the API Gateway CLI The following create-stage command creates a stage with active X-Ray tracing: aws apigateway create-stage \ --rest-api-id rest-api-id \ --stage-name stage-name \ --deployment-id deployment-id \ --region region \ --tracing-enabled=true The output will look like the following: { "tracingEnabled": true, "stageName": stage-name, "cacheClusterEnabled": false, "cacheClusterStatus": "NOT_AVAILABLE", "deploymentId": deployment-id, "lastUpdatedDate": 1533849811, "createdDate": 1533849811, "methodSettings": {} } The following create-stage command creates a stage without active X-Ray tracing: aws apigateway create-stage \ --rest-api-id rest-api-id \ --stage-name stage-name \ --deployment-id deployment-id \ --region region \ --tracing-enabled=false The output will look like the following: { "tracingEnabled": false, "stageName": stage-name, "cacheClusterEnabled": false, X-Ray 1048 Amazon API Gateway Developer Guide "cacheClusterStatus": "NOT_AVAILABLE", "deploymentId": deployment-id, "lastUpdatedDate": 1533849811, "createdDate": 1533849811, "methodSettings": {} } The following update-stage turns on active X-Ray tracing for a deployed API: aws apigateway update-stage \ --rest-api-id rest-api-id \ --stage-name stage-name \ --patch-operations op=replace,path=/tracingEnabled,value=true The following update-stage turns off active X-Ray tracing for a deployed API: aws apigateway update-stage \ --rest-api-id rest-api-id \ --stage-name stage-name \ --region region \ --patch-operations op=replace,path=/tracingEnabled,value=false The output will look like the following: { "tracingEnabled": false, "stageName": stage-name, "cacheClusterEnabled": false, "cacheClusterStatus": "NOT_AVAILABLE", "deploymentId": deployment-id, "lastUpdatedDate": 1533850033, "createdDate": 1533849811, "methodSettings": {} } Once you've enabled X-Ray for your API stage, use the X-Ray CLI to retrieve trace information. For more information, see Using the X-Ray API with the AWS CLI. Use AWS X-Ray service maps and trace views with API Gateway In this section you can find detailed information on how to use AWS X-Ray service maps and trace views with API Gateway. X-Ray 1049 Amazon API Gateway Topics • Example X-Ray service map • Example X-Ray trace view Example X-Ray
apigateway-dg-286
apigateway-dg.pdf
286
like the following: { "tracingEnabled": false, "stageName": stage-name, "cacheClusterEnabled": false, "cacheClusterStatus": "NOT_AVAILABLE", "deploymentId": deployment-id, "lastUpdatedDate": 1533850033, "createdDate": 1533849811, "methodSettings": {} } Once you've enabled X-Ray for your API stage, use the X-Ray CLI to retrieve trace information. For more information, see Using the X-Ray API with the AWS CLI. Use AWS X-Ray service maps and trace views with API Gateway In this section you can find detailed information on how to use AWS X-Ray service maps and trace views with API Gateway. X-Ray 1049 Amazon API Gateway Topics • Example X-Ray service map • Example X-Ray trace view Example X-Ray service map Developer Guide AWS X-Ray service maps show information about your API and all of its downstream services. When X-Ray is enabled for an API stage in API Gateway, you'll see a node in the service map containing information about the overall time spent in the API Gateway service. You can get detailed information about the response status and a histogram of the API response time for the selected timeframe. For APIs integrating with AWS services such as AWS Lambda and Amazon DynamoDB, you will see more nodes providing performance metrics related to those services. There will be a service map for each API stage. The following example shows a service map for the test stage of an API called xray. This API has two Lambda integrations. The nodes represent the API Gateway service and the two Lambda functions. For a detailed explanation of service map structure, see Use the X-Ray trace map. X-Ray 1050 Amazon API Gateway Developer Guide From the service map, you can zoom in to see a trace view of your API stage. The trace will display in-depth information regarding your API, represented as segments and subsegments. For example, the trace for the service map shown above would include segments for the Lambda service and Lambda function. For more information, see AWS Lambda and AWS X-Ray. If you choose a node or edge on an X-Ray service map, the X-Ray console shows a latency distribution histogram. You can use a latency histogram to see how long it takes for a service to complete its requests. Following is a histogram of the API Gateway stage named xray/test in the previous service map. For a detailed explanation of latency distribution histograms, see Use Latency Histograms. X-Ray 1051 Amazon API Gateway Developer Guide X-Ray 1052 Amazon API Gateway Example X-Ray trace view Developer Guide The following diagram shows a trace view generated for the example API described above, with a Lambda backend function. A successful API method request is shown with a response code of 200. For a detailed explanation of trace views, see View traces and trace details. Configure AWS X-Ray sampling rules for API Gateway APIs You can use AWS X-Ray console or SDK to configure sampling rules for your Amazon API Gateway API. A sampling rule specifies which requests X-Ray should record for your API. By customizing sampling rules, you can control the amount of data that you record, and modify sampling behavior on the fly without modifying or redeploying your code. Before you specify your X-Ray sampling rules, read the following topics in the X-Ray Developer Guide: • Configure sampling rules • Using Sampling Rules with the X-Ray API Topics • X-Ray sampling rule option values for API Gateway APIs • X-Ray sampling rule examples X-Ray 1053 Amazon API Gateway Developer Guide X-Ray sampling rule option values for API Gateway APIs The following X-Ray sampling options are relevant for API Gateway. String values can use wildcards to match a single character (?) or zero or more characters (*). For more details, including a detailed explanation of how the Reservoir and Rate settings are used, Configure sampling rules. • Rule name (string) — A unique name for the rule. • Priority (integer between 1 and 9999) — The priority of the sampling rule. Services evaluate rules in ascending order of priority, and make a sampling decision with the first rule that matches. • Reservoir (nonnegative integer) — A fixed number of matching requests to instrument per second, before applying the fixed rate. The reservoir is not used directly by services, but applies to all services using the rule collectively. • Rate (number between 0 and 100) — The percentage of matching requests to instrument, after the reservoir is exhausted. • Service name (string) — API stage name, in the form {api-name}/{stage-name}. For example, if you were to deploy the PetStore sample API to a stage named test, the Service name value to specify in your sampling rule would be pets/test. • Service type (string) — For an API Gateway API, either AWS::ApiGateway::Stage or AWS::ApiGateway::* can be specified. • Host (string) — The hostname from the HTTP host header. Set this to * to match against
apigateway-dg-287
apigateway-dg.pdf
287
using the rule collectively. • Rate (number between 0 and 100) — The percentage of matching requests to instrument, after the reservoir is exhausted. • Service name (string) — API stage name, in the form {api-name}/{stage-name}. For example, if you were to deploy the PetStore sample API to a stage named test, the Service name value to specify in your sampling rule would be pets/test. • Service type (string) — For an API Gateway API, either AWS::ApiGateway::Stage or AWS::ApiGateway::* can be specified. • Host (string) — The hostname from the HTTP host header. Set this to * to match against all hostnames. Or you can specify a full or partial hostname to match, for example, api.example.com or *.example.com. • Resource ARN (string) — The ARN of the API stage, for example, arn:aws:apigateway:region::/restapis/api-id/stages/stage-name. The stage name can be obtained from the console or the API Gateway CLI or API. For more information about ARN formats, see the Amazon Web Services General Reference. • HTTP method (string) — The method to be sampled, for example, GET. • URL path (string) — The URL path of the request. • (optional) Attributes (key and value) — Headers from the original HTTP request, for example, Connection, Content-Length, or Content-Type. Each attribute value can be up to 32 characters long. X-Ray 1054 Amazon API Gateway X-Ray sampling rule examples Sampling rule example #1 This rule samples all GET requests for the testxray API at the test stage. Developer Guide • Rule name — test-sampling • Priority — 17 • Reservoir size — 10 • Fixed rate — 10 • Service name — testxray/test • Service type — AWS::ApiGateway::Stage • HTTP method — GET • Resource ARN — * • Host — * Sampling rule example #2 This rule samples all requests for the testxray API at the prod stage. • Rule name — prod-sampling • Priority — 478 • Reservoir size — 1 • Fixed rate — 60 • Service name — testxray/prod • Service type — AWS::ApiGateway::Stage • HTTP method — * • Resource ARN — * • Host — * • Attributes — {} AWS X-Ray traces for Amazon API Gateway APIs This section discusses AWS X-Ray trace segments, subsegments, and other trace fields for Amazon API Gateway APIs. X-Ray 1055 Amazon API Gateway Developer Guide Before you read this section, review the following topics in the X-Ray Developer Guide: • Use an AWS Management Console • X-Ray segment documents • Concepts Topics • Examples of trace objects for an API Gateway API • Understanding the trace Examples of trace objects for an API Gateway API This section discusses some of the objects you may see in a trace for an API Gateway API. Annotations Annotations can appear in segments and subsegments. They are used as filtering expressions in sampling rules to filter traces. For more information, see Configure sampling rules. Following is an example of an annotations object, in which an API stage is identified by the API ID and the API stage name: "annotations": { "aws:api_id": "a1b2c3d4e5", "aws:api_stage": "dev" } For more information about annotations, see X-Ray segment documents, and then choose X-Ray segment documents, Annotations. AWS resource data The aws object appears only in segments. Following is an example of an aws object that matches the Default sampling rule. For an in-depth explanation of sampling rules, see Configure sampling rules. "aws": { "xray": { "sampling_rule_name": "Default" }, X-Ray 1056 Amazon API Gateway Developer Guide "api_gateway": { "account_id": "123412341234", "rest_api_id": "a1b2c3d4e5", "stage": "dev", "request_id": "a1b2c3d4-a1b2-a1b2-a1b2-a1b2c3d4e5f6" } } For more information about the aws object, see X-Ray segment documents, and then choose X-Ray segment documents, AWS resource data. Understanding the trace Following is a trace segment for an API Gateway stage. For a detailed explanation of the fields that make up the trace segment, see X-Ray segment documents. { "Document": { "id": "a1b2c3d4a1b2c3d4", "name": "testxray/dev", "start_time": 1533928226.229, "end_time": 1533928226.614, "metadata": { "default": { "extended_request_id": "abcde12345abcde=", "request_id": "a1b2c3d4-a1b2-a1b2-a1b2-a1b2c3d4e5f6" } }, "http": { "request": { "url": "https://example.com/dev? username=demo&message=hellofromdemo/", "method": "GET", "client_ip": "192.0.2.0", "x_forwarded_for": true }, "response": { "status": 200, "content_length": 0 } }, "aws": { "xray": { X-Ray 1057 Amazon API Gateway Developer Guide "sampling_rule_name": "Default" }, "api_gateway": { "account_id": "123412341234", "rest_api_id": "a1b2c3d4e5", "stage": "dev", "request_id": "a1b2c3d4-a1b2-a1b2-a1b2-a1b2c3d4e5f6" } }, "annotations": { "aws:api_id": "a1b2c3d4e5", "aws:api_stage": "dev" }, "trace_id": "1-a1b2c3d4-a1b2c3d4a1b2c3d4a1b2c3d4", "origin": "AWS::ApiGateway::Stage", "resource_arn": "arn:aws:apigateway:us-east-1::/restapis/a1b2c3d4e5/ stages/dev", "subsegments": [ { "id": "abcdefgh12345678", "name": "Lambda", "start_time": 1533928226.233, "end_time": 1533928226.6130002, "http": { "request": { "url": "https://example.com/2015-03-31/functions/ arn:aws:lambda:us-east-1:123412341234:function:xray123/invocations", "method": "GET" }, "response": { "status": 200, "content_length": 62 } }, "aws": { "function_name": "xray123", "region": "us-east-1", "operation": "Invoke", "resource_names": [ "xray123" ] }, "namespace": "aws" } X-Ray 1058 Amazon API Gateway ] }, "Id": "a1b2c3d4a1b2c3d4" } Developer Guide X-Ray 1059 Amazon API Gateway Developer Guide API Gateway HTTP APIs REST APIs and HTTP APIs are both RESTful API products. REST APIs support more
apigateway-dg-288
apigateway-dg.pdf
288
"request_id": "a1b2c3d4-a1b2-a1b2-a1b2-a1b2c3d4e5f6" } }, "annotations": { "aws:api_id": "a1b2c3d4e5", "aws:api_stage": "dev" }, "trace_id": "1-a1b2c3d4-a1b2c3d4a1b2c3d4a1b2c3d4", "origin": "AWS::ApiGateway::Stage", "resource_arn": "arn:aws:apigateway:us-east-1::/restapis/a1b2c3d4e5/ stages/dev", "subsegments": [ { "id": "abcdefgh12345678", "name": "Lambda", "start_time": 1533928226.233, "end_time": 1533928226.6130002, "http": { "request": { "url": "https://example.com/2015-03-31/functions/ arn:aws:lambda:us-east-1:123412341234:function:xray123/invocations", "method": "GET" }, "response": { "status": 200, "content_length": 62 } }, "aws": { "function_name": "xray123", "region": "us-east-1", "operation": "Invoke", "resource_names": [ "xray123" ] }, "namespace": "aws" } X-Ray 1058 Amazon API Gateway ] }, "Id": "a1b2c3d4a1b2c3d4" } Developer Guide X-Ray 1059 Amazon API Gateway Developer Guide API Gateway HTTP APIs REST APIs and HTTP APIs are both RESTful API products. REST APIs support more features than HTTP APIs, while HTTP APIs are designed with minimal features so that they can be offered at a lower price. For more information, see the section called “Choose between REST APIs and HTTP APIs ”. You can use HTTP APIs to send requests to AWS Lambda functions or to any routable HTTP endpoint. For example, you can create an HTTP API that integrates with a Lambda function on the backend. When a client calls your API, API Gateway sends the request to the Lambda function and returns the function's response to the client. HTTP APIs support OpenID Connect and OAuth 2.0 authorization. They come with built-in support for cross-origin resource sharing (CORS) and automatic deployments. You can create HTTP APIs by using the AWS Management Console, the AWS CLI, APIs, AWS CloudFormation, or SDKs. Topics • Develop HTTP APIs in API Gateway • Publish HTTP APIs for customers to invoke • Protect your HTTP APIs in API Gateway • Monitor HTTP APIs in API Gateway • Troubleshooting issues with HTTP APIs in API Gateway Develop HTTP APIs in API Gateway This section provides details about API Gateway capabilities that you need while you're developing your API Gateway APIs. As you're developing your API Gateway API, you decide on a number of characteristics of your API. These characteristics depend on the use case of your API. For example, you might want to only allow certain clients to call your API, or you might want it to be available to everyone. You might want an API call to execute a Lambda function, make a database query, or call an application. Topics Develop 1060 Developer Guide Amazon API Gateway • Create an HTTP API • Create routes for HTTP APIs in API Gateway • IP address types for HTTP APIs in API Gateway • Control and manage access to HTTP APIs in API Gateway • Create integrations for HTTP APIs in API Gateway • Configure CORS for HTTP APIs in API Gateway • Transform API requests and responses for HTTP APIs in API Gateway • Use OpenAPI definitions for HTTP APIs in API Gateway Create an HTTP API To create a functional API, you must have at least one route, integration, stage, and deployment. The following examples show how to create an API with an AWS Lambda or HTTP integration, a route, and a default stage that is configured to automatically deploy changes. This guide assumes that you're already familiar with API Gateway and Lambda. For a more detailed guide, see Get started. Topics • Create an HTTP API by using the AWS Management Console • Create an HTTP API by using the AWS CLI Create an HTTP API by using the AWS Management Console 1. Open the API Gateway console. 2. Choose Create API. 3. Under HTTP API, choose Build. 4. Choose Add integration, and then choose an AWS Lambda function or enter an HTTP endpoint. 5. For Name, enter a name for your API. 6. Choose Review and create. 7. Choose Create. Creating an HTTP API 1061 Amazon API Gateway Developer Guide Now your API is ready to invoke. You can test your API by entering its invoke URL in a browser, or by using Curl. curl https://api-id.execute-api.us-east-2.amazonaws.com Create an HTTP API by using the AWS CLI You can use quick create to create an API with a Lambda or HTTP integration, a default catch- all route, and a default stage that is configured to automatically deploy changes. The following create-api command uses quick create to create an API that integrates with a Lambda function on the backend. Note To invoke a Lambda integration, API Gateway must have the required permissions. You can use a resource-based policy or an IAM role to grant API Gateway permissions to invoke a Lambda function. To learn more, see AWS Lambda Permissions in the AWS Lambda Developer Guide. Example aws apigatewayv2 create-api --name my-api --protocol-type HTTP --target arn:aws:lambda:us-east-2:123456789012:function:function-name Now your API is ready to invoke. You can test your API by entering its invoke URL in a browser, or by using Curl. curl https://api-id.execute-api.us-east-2.amazonaws.com Create routes for HTTP APIs in API Gateway Routes direct incoming API requests to backend resources. Routes consist of
apigateway-dg-289
apigateway-dg.pdf
289
To invoke a Lambda integration, API Gateway must have the required permissions. You can use a resource-based policy or an IAM role to grant API Gateway permissions to invoke a Lambda function. To learn more, see AWS Lambda Permissions in the AWS Lambda Developer Guide. Example aws apigatewayv2 create-api --name my-api --protocol-type HTTP --target arn:aws:lambda:us-east-2:123456789012:function:function-name Now your API is ready to invoke. You can test your API by entering its invoke URL in a browser, or by using Curl. curl https://api-id.execute-api.us-east-2.amazonaws.com Create routes for HTTP APIs in API Gateway Routes direct incoming API requests to backend resources. Routes consist of two parts: an HTTP method and a resource path—for example, GET /pets. You can define specific HTTP methods for your route. Or, you can use the ANY method to match all methods that you haven't defined for a resource. You can create a $default route that acts as a catch-all for requests that don’t match any other routes. Routes 1062 Amazon API Gateway Note Developer Guide API Gateway decodes URL-encoded request parameters before passing them to your backend integration. Working with path variables You can use path variables in HTTP API routes. For example, the GET /pets/{petID} route catches a GET request that a client submits to https://api-id.execute-api.us-east-2.amazonaws.com/pets/6. A greedy path variable catches all child resources of a route. To create a greedy path variable, add + to the variable name—for example, {proxy+}. The greedy path variable must be at the end of the resource path. Working with query string parameters By default, API Gateway sends query string parameters to your backend integration if they are included in a request to an HTTP API. For example, when a client sends a request to https://api-id.execute-api.us- east-2.amazonaws.com/pets?id=4&type=dog, the query string parameters ? id=4&type=dog are sent to your integration. Working with the $default route The $default route catches requests that don't explicitly match other routes in your API. When the $default route receives a request, API Gateway sends the full request path to the integration. For example, you can create an API with only a $default route and integrate it on the ANY method with the https://petstore-demo-endpoint.execute- api.com HTTP endpoint. When you send a request to https://api-id.execute-api.us- east-2.amazonaws.com/store/checkout, API Gateway sends a request to https:// petstore-demo-endpoint.execute-api.com/store/checkout. To learn more about HTTP integrations, see Create HTTP proxy integrations for HTTP APIs. Routes 1063 Amazon API Gateway Routing API requests Developer Guide When a client sends an API request, API Gateway first determines which stage to route the request to. If the request explicitly matches a stage, API Gateway sends the request to that stage. If no stage fully matches the request, API Gateway sends the request to the $default stage. If there's no $default stage, then the API returns {"message":"Not Found"} and does not generate CloudWatch logs. After selecting a stage, API Gateway selects a route. API Gateway selects the route with the most- specific match, using the following priorities: 1. Full match for a route and method. 2. Match for a route and method with a greedy path variable ({proxy+}). 3. The $default route. If no routes match a request, API Gateway returns {"message":"Not Found"} to the client. For example, consider an API with a $default stage and the following example routes: 1. GET /pets/dog/1 2. GET /pets/dog/{id} 3. GET /pets/{proxy+} 4. ANY /{proxy+} 5. $default The following table summarizes how API Gateway routes requests to the example routes. Request Selected route Explanation GET https://api- GET /pets/dog/1 id.execute- api. region.amazonaw s.com/pets/dog/1 GET https://api- GET /pets/dog/{id} id.execute- Routes The request fully matches this static route. The request fully matches this route. 1064 Amazon API Gateway Developer Guide Request Selected route Explanation api. region.amazonaw s.com/pets/dog/2 GET https://api- GET /pets/{proxy+} id.execute- api. region.amazonaw s.com/pets/cat/1 POST https://api- ANY /{proxy+} id.execute- api. region.amazonaw s.com/test/5 The request doesn't fully match a route. The route with a GET method and a greedy path variable catches this request. The ANY method matches all methods that you haven't defined for a route. Routes with greedy path variables have higher priority than the $default route. IP address types for HTTP APIs in API Gateway When you create an API, you specify the type of IP addresses that can invoke your API. You can choose IPv4 to allow IPv4 addresses to invoke your API, or you can choose dualstack to allow both IPv4 and IPv6 addresses to invoke your API. You might want to set the IP address type to dualstack to alleviate IP space exhaustion or for your security posture. For more information about the benefits of a dualstack IP address type, see IPv6 on AWS. Considerations for IP address types The following considerations might impact your use of IP address types: • The default IP address type for HTTP APIs is IPv4. • If you change the IP address type for an
apigateway-dg-290
apigateway-dg.pdf
290
choose IPv4 to allow IPv4 addresses to invoke your API, or you can choose dualstack to allow both IPv4 and IPv6 addresses to invoke your API. You might want to set the IP address type to dualstack to alleviate IP space exhaustion or for your security posture. For more information about the benefits of a dualstack IP address type, see IPv6 on AWS. Considerations for IP address types The following considerations might impact your use of IP address types: • The default IP address type for HTTP APIs is IPv4. • If you change the IP address type for an existing API from IPv4 to dualstack, confirm that any policies controlling access to your APIs have been updated to account for IPv6 calls. When you change the IP address type, the change takes effect immediately. • Your API can be mapped to a custom domain name with a different IP address type than your API. If you disable your default API endpoint, this might affect how callers can invoke your API. IP address types for HTTP APIs in API Gateway 1065 Amazon API Gateway Developer Guide Change the IP address type of an HTTP API You can change the IP address type by updating the API’s configuration. You can update the API's configuration by using the AWS Management Console, the AWS CLI, AWS CloudFormation, or an AWS SDK. If you change the API’s IP address type, you don't redeploy your API for the changes to take effect. AWS Management Console To change the IP address type of an HTTP API 1. Sign in to the API Gateway console at https://console.aws.amazon.com/apigateway. 2. Choose an HTTP API. 3. 4. For API settings, choose Edit. For IP address type, select either IPv4 or Dualstack. 5. Choose Save. The change to your API's configuration will take effect immediately. AWS CLI The following update-api command updates an API to have an IP address type of dualstack: aws apigatewayv2 update-api \ --api-id abcd1234 \ --ip-address-type dualstack The output will look like the following: { "ApiEndpoint": "https://abcd1234.execute-api.us-east-1.amazonaws.com", "ApiId": "abcd1234", "ApiKeySelectionExpression": "$request.header.x-api-key", "CreatedDate": "2025-02-04T22:20:20+00:00", "DisableExecuteApiEndpoint": false, "Name": "My-HTTP-API", "ProtocolType": "HTTP", "RouteSelectionExpression": "$request.method $request.path", "Tags": {}, IP address types for HTTP APIs in API Gateway 1066 Amazon API Gateway Developer Guide "NotificationUris": [], "IpAddressType": "dualstack" } Control and manage access to HTTP APIs in API Gateway API Gateway supports multiple mechanisms for controlling and managing access to your HTTP API: • Lambda authorizers use Lambda functions to control access to APIs. For more information, see Control access to HTTP APIs with AWS Lambda authorizers. • JWT authorizers use JSON web tokens to control access to APIs. For more information, see Control access to HTTP APIs with JWT authorizers in API Gateway. • Standard AWS IAM roles and policies offer flexible and robust access controls. You can use IAM roles and policies to control who can create and manage your APIs, as well as who can invoke them. For more information, see Control access to HTTP APIs with IAM authorization in API Gateway. To improve your security posture, we recommend that you configure an authorizer for all routes on your HTTP API. You might need to do this to comply with various compliance frameworks. For more information, see Amazon API Gateway controls in the AWS Security Hub User Guide. Control access to HTTP APIs with AWS Lambda authorizers You use a Lambda authorizer to use a Lambda function to control access to your HTTP API. Then, when a client calls your API, API Gateway invokes your Lambda function. API Gateway uses the response from your Lambda function to determine whether the client can access your API. Payload format version The authorizer payload format version specifies the format of the data that API Gateway sends to a Lambda authorizer, and how API Gateway interprets the response from Lambda. If you don't specify a payload format version, the AWS Management Console uses the latest version by default. If you create a Lambda authorizer by using the AWS CLI, AWS CloudFormation, or an SDK, you must specify an authorizerPayloadFormatVersion. The supported values are 1.0 and 2.0. If you need compatibility with REST APIs, use version 1.0. The following examples show the structure of each payload format version. Access control 1067 Amazon API Gateway 2.0 { "version": "2.0", "type": "REQUEST", Developer Guide "routeArn": "arn:aws:execute-api:us-east-1:123456789012:abcdef123/test/GET/ request", "identitySource": ["user1", "123"], "routeKey": "$default", "rawPath": "/my/path", "rawQueryString": "parameter1=value1&parameter1=value2&parameter2=value", "cookies": ["cookie1", "cookie2"], "headers": { "header1": "value1", "header2": "value2" }, "queryStringParameters": { "parameter1": "value1,value2", "parameter2": "value" }, "requestContext": { "accountId": "123456789012", "apiId": "api-id", "authentication": { "clientCert": { "clientCertPem": "CERT_CONTENT", "subjectDN": "www.example.com", "issuerDN": "Example issuer", "serialNumber": "1", "validity": { "notBefore": "May 28 12:30:02 2019 GMT", "notAfter": "Aug 5 09:36:04 2021 GMT" } } }, "domainName": "id.execute-api.us-east-1.amazonaws.com", "domainPrefix": "id", "http": { "method": "POST", "path": "/my/path", "protocol": "HTTP/1.1", "sourceIp": "IP", "userAgent": "agent" },
apigateway-dg-291
apigateway-dg.pdf
291
each payload format version. Access control 1067 Amazon API Gateway 2.0 { "version": "2.0", "type": "REQUEST", Developer Guide "routeArn": "arn:aws:execute-api:us-east-1:123456789012:abcdef123/test/GET/ request", "identitySource": ["user1", "123"], "routeKey": "$default", "rawPath": "/my/path", "rawQueryString": "parameter1=value1&parameter1=value2&parameter2=value", "cookies": ["cookie1", "cookie2"], "headers": { "header1": "value1", "header2": "value2" }, "queryStringParameters": { "parameter1": "value1,value2", "parameter2": "value" }, "requestContext": { "accountId": "123456789012", "apiId": "api-id", "authentication": { "clientCert": { "clientCertPem": "CERT_CONTENT", "subjectDN": "www.example.com", "issuerDN": "Example issuer", "serialNumber": "1", "validity": { "notBefore": "May 28 12:30:02 2019 GMT", "notAfter": "Aug 5 09:36:04 2021 GMT" } } }, "domainName": "id.execute-api.us-east-1.amazonaws.com", "domainPrefix": "id", "http": { "method": "POST", "path": "/my/path", "protocol": "HTTP/1.1", "sourceIp": "IP", "userAgent": "agent" }, Access control 1068 Amazon API Gateway Developer Guide "requestId": "id", "routeKey": "$default", "stage": "$default", "time": "12/Mar/2020:19:03:58 +0000", "timeEpoch": 1583348638390 }, "pathParameters": { "parameter1": "value1" }, "stageVariables": { "stageVariable1": "value1", "stageVariable2": "value2" } 1.0 } { "version": "1.0", "type": "REQUEST", "methodArn": "arn:aws:execute-api:us-east-1:123456789012:abcdef123/test/GET/ request", "identitySource": "user1,123", "authorizationToken": "user1,123", "resource": "/request", "path": "/request", "httpMethod": "GET", "headers": { "X-AMZ-Date": "20170718T062915Z", "Accept": "*/*", "HeaderAuth1": "headerValue1", "CloudFront-Viewer-Country": "US", "CloudFront-Forwarded-Proto": "https", "CloudFront-Is-Tablet-Viewer": "false", "CloudFront-Is-Mobile-Viewer": "false", "User-Agent": "..." }, "queryStringParameters": { "QueryString1": "queryValue1" }, "pathParameters": {}, "stageVariables": { "StageVar1": "stageValue1" }, "requestContext": { "path": "/request", "accountId": "123456789012", "resourceId": "05c7jb", Access control 1069 Amazon API Gateway Developer Guide "stage": "test", "requestId": "...", "identity": { "apiKey": "...", "sourceIp": "...", "clientCert": { "clientCertPem": "CERT_CONTENT", "subjectDN": "www.example.com", "issuerDN": "Example issuer", "serialNumber": "a1:a1:a1:a1:a1:a1:a1:a1:a1:a1:a1:a1:a1:a1:a1:a1", "validity": { "notBefore": "May 28 12:30:02 2019 GMT", "notAfter": "Aug 5 09:36:04 2021 GMT" } } }, "resourcePath": "/request", "httpMethod": "GET", "apiId": "abcdef123" } } Lambda authorizer response format The payload format version also determines the structure of the response that you must return from your Lambda function. Lambda function response for format 1.0 If you choose the 1.0 format version, Lambda authorizers must return an IAM policy that allows or denies access to your API route. You can use standard IAM policy syntax in the policy. For examples of IAM policies, see the section called “Control access for invoking an API”. You can pass context properties to Lambda integrations or access logs by using $context.authorizer.property. The context object is optional and claims is a reserved placeholder and cannot be used as the context object. To learn more, see the section called “Logging variables”. Example { "principalId": "abcdef", // The principal user identification associated with the token sent by the client. "policyDocument": { Access control 1070 Amazon API Gateway Developer Guide "Version": "2012-10-17", "Statement": [ { "Action": "execute-api:Invoke", "Effect": "Allow|Deny", "Resource": "arn:aws:execute-api:{regionId}:{accountId}:{apiId}/{stage}/ {httpVerb}/[{resource}/[{child-resources}]]" } ] }, "context": { "exampleKey": "exampleValue" } } Lambda function response for format 2.0 If you choose the 2.0 format version, you can return a Boolean value or an IAM policy that uses standard IAM policy syntax from your Lambda function. To return a Boolean value, enable simple responses for the authorizer. The following examples demonstrate the format that you must code your Lambda function to return. The context object is optional. You can pass context properties to Lambda integrations or access logs by using $context.authorizer.property. To learn more, see the section called “Logging variables”. Simple response { "isAuthorized": true/false, "context": { "exampleKey": "exampleValue" } } IAM policy { "principalId": "abcdef", // The principal user identification associated with the token sent by the client. "policyDocument": { "Version": "2012-10-17", "Statement": [ { Access control 1071 Amazon API Gateway Developer Guide "Action": "execute-api:Invoke", "Effect": "Allow|Deny", "Resource": "arn:aws:execute-api:{regionId}:{accountId}:{apiId}/{stage}/ {httpVerb}/[{resource}/[{child-resources}]]" } ] }, "context": { "exampleKey": "exampleValue" } } Example Lambda authorizer functions The following example Node.js Lambda functions demonstrate the required response formats you need to return from your Lambda function for the 2.0 payload format version. Simple response - Node.js export const handler = async(event) => { let response = { "isAuthorized": false, "context": { "stringKey": "value", "numberKey": 1, "booleanKey": true, "arrayKey": ["value1", "value2"], "mapKey": {"value1": "value2"} } }; if (event.headers.authorization === "secretToken") { console.log("allowed"); response = { "isAuthorized": true, "context": { "stringKey": "value", "numberKey": 1, "booleanKey": true, "arrayKey": ["value1", "value2"], "mapKey": {"value1": "value2"} } Access control 1072 Developer Guide Amazon API Gateway }; } return response; }; Simple response - Python import json def lambda_handler(event, context): response = { "isAuthorized": False, "context": { "stringKey": "value", "numberKey": 1, "booleanKey": True, "arrayKey": ["value1", "value2"], "mapKey": {"value1": "value2"} } } try: if (event["headers"]["authorization"] == "secretToken"): response = { "isAuthorized": True, "context": { "stringKey": "value", "numberKey": 1, "booleanKey": True, "arrayKey": ["value1", "value2"], "mapKey": {"value1": "value2"} } } print('allowed') return response else: print('denied') return response except BaseException: print('denied') Access control 1073 Amazon API Gateway return response IAM policy - Node.js Developer Guide export const handler = async(event) => { if (event.headers.authorization == "secretToken") { console.log("allowed"); return { "principalId": "abcdef", // The principal user identification associated with the token sent by the client. "policyDocument": { "Version": "2012-10-17", "Statement": [{ "Action": "execute-api:Invoke", "Effect": "Allow", "Resource": event.routeArn }] }, "context": { "stringKey": "value", "numberKey": 1, "booleanKey": true, "arrayKey": ["value1", "value2"], "mapKey": { "value1": "value2" }
apigateway-dg-292
apigateway-dg.pdf
292
"context": { "stringKey": "value", "numberKey": 1, "booleanKey": True, "arrayKey": ["value1", "value2"], "mapKey": {"value1": "value2"} } } print('allowed') return response else: print('denied') return response except BaseException: print('denied') Access control 1073 Amazon API Gateway return response IAM policy - Node.js Developer Guide export const handler = async(event) => { if (event.headers.authorization == "secretToken") { console.log("allowed"); return { "principalId": "abcdef", // The principal user identification associated with the token sent by the client. "policyDocument": { "Version": "2012-10-17", "Statement": [{ "Action": "execute-api:Invoke", "Effect": "Allow", "Resource": event.routeArn }] }, "context": { "stringKey": "value", "numberKey": 1, "booleanKey": true, "arrayKey": ["value1", "value2"], "mapKey": { "value1": "value2" } } }; } else { console.log("denied"); return { "principalId": "abcdef", // The principal user identification associated with the token sent by the client. "policyDocument": { "Version": "2012-10-17", "Statement": [{ "Action": "execute-api:Invoke", "Effect": "Deny", "Resource": event.routeArn }] }, "context": { "stringKey": "value", "numberKey": 1, Access control 1074 Amazon API Gateway Developer Guide "booleanKey": true, "arrayKey": ["value1", "value2"], "mapKey": { "value1": "value2" } } }; } }; IAM policy - Python import json def lambda_handler(event, context): response = { # The principal user identification associated with the token sent by # the client. "principalId": "abcdef", "policyDocument": { "Version": "2012-10-17", "Statement": [{ "Action": "execute-api:Invoke", "Effect": "Deny", "Resource": event["routeArn"] }] }, "context": { "stringKey": "value", "numberKey": 1, "booleanKey": True, "arrayKey": ["value1", "value2"], "mapKey": {"value1": "value2"} } } try: if (event["headers"]["authorization"] == "secretToken"): response = { # The principal user identification associated with the token # sent by the client. "principalId": "abcdef", "policyDocument": { "Version": "2012-10-17", Access control 1075 Amazon API Gateway Developer Guide "Statement": [{ "Action": "execute-api:Invoke", "Effect": "Allow", "Resource": event["routeArn"] }] }, "context": { "stringKey": "value", "numberKey": 1, "booleanKey": True, "arrayKey": ["value1", "value2"], "mapKey": {"value1": "value2"} } } print('allowed') return response else: print('denied') return response except BaseException: print('denied') return response Identity sources You can optionally specify identity sources for a Lambda authorizer. Identity sources specify the location of data that's required to authorize a request. For example, you can specify header or query string values as identity sources. If you specify identity sources, clients must include them in the request. If the client's request doesn't include the identity sources, API Gateway doesn't invoke your Lambda authorizer, and the client receives a 401 error. The following table describes the supported identity sources for a Lambda authorizer. Type Example Notes Header value $request.header.name Query string value $request.querystring.name Header names are case-inse nsitive. Query string names are case- sensitive. Access control 1076 Amazon API Gateway Developer Guide Type Example Notes Context variable $context.variableName The value of a supported context variable. Stage variable $stageVariables.variableN The value of a stage variable. ame You can also directly return {"errorMessage" : "Unauthorized"} from your Lambda function to return a 401 error to your clients. If you directly return a 401 error from your Lambda function to your clients, don't specify any identity sources when you create your Lambda authorizer. Caching authorizer responses You can enable caching for a Lambda authorizer by specifying an authorizerResultTtlInSeconds. When caching is enabled for an authorizer, API Gateway uses the authorizer's identity sources as the cache key. If a client specifies the same parameters in identity sources within the configured TTL, API Gateway uses the cached authorizer result, rather than invoking your Lambda function. To enable caching, your authorizer must have at least one identity source. If you enable simple responses for an authorizer, the authorizer's response fully allows or denies all API requests that match the cached identity source values. For more granular permissions, disable simple responses and return an IAM policy. By default, API Gateway uses the cached authorizer response for all routes of an API that use the authorizer. To cache responses per route, add $context.routeKey to your authorizer's identity sources. Create a Lambda authorizer When you create a Lambda authorizer, you specify the Lambda function for API Gateway to use. You must grant API Gateway permission to invoke the Lambda function by using either the function's resource policy or an IAM role. The following create-authorizer command creates a Lambda authorizer: aws apigatewayv2 create-authorizer \ --api-id abcdef123 \ Access control 1077 Amazon API Gateway Developer Guide --authorizer-type REQUEST \ --identity-source '$request.header.Authorization' \ --name lambda-authorizer \ --authorizer-uri 'arn:aws:apigateway:us-west-2:lambda:path/2015-03-31/ functions/arn:aws:lambda:us-west-2:123456789012:function:my-function/invocations' \ --authorizer-payload-format-version '2.0' \ --enable-simple-responses The following add-permission command updates the Lambda function's resource policy to grant API Gateway permission to invoke the function. If API Gateway doesn't have permission to invoke your function, clients receive a 500 Internal Server Error. aws lambda add-permission \ --function-name my-authorizer-function \ --statement-id apigateway-invoke-permissions-abc123 \ --action lambda:InvokeFunction \ --principal apigateway.amazonaws.com \ --source-arn "arn:aws:execute-api:us-west-2:123456789012:api- id/authorizers/authorizer-id" After you've created an authorizer and granted API Gateway permission to invoke it, update your route to use the authorizer. The following update-route command adds the Lambda authorizer to the route. aws apigatewayv2 update-route \ --api-id abcdef123 \ --route-id abc123 \ --authorization-type CUSTOM \
apigateway-dg-293
apigateway-dg.pdf
293
--enable-simple-responses The following add-permission command updates the Lambda function's resource policy to grant API Gateway permission to invoke the function. If API Gateway doesn't have permission to invoke your function, clients receive a 500 Internal Server Error. aws lambda add-permission \ --function-name my-authorizer-function \ --statement-id apigateway-invoke-permissions-abc123 \ --action lambda:InvokeFunction \ --principal apigateway.amazonaws.com \ --source-arn "arn:aws:execute-api:us-west-2:123456789012:api- id/authorizers/authorizer-id" After you've created an authorizer and granted API Gateway permission to invoke it, update your route to use the authorizer. The following update-route command adds the Lambda authorizer to the route. aws apigatewayv2 update-route \ --api-id abcdef123 \ --route-id abc123 \ --authorization-type CUSTOM \ --authorizer-id def123 Troubleshooting Lambda authorizers If API Gateway can't invoke your Lambda authorizer, or your Lambda authorizer returns a response in an invalid format, clients receive a 500 Internal Server Error. To troubleshoot errors, enable access logging for your API stage. Include the $context.authorizer.error logging variable in your log format. If the logs indicate that API Gateway doesn't have permission to invoke your function, update your function's resource policy or provide an IAM role to grant API Gateway permission to invoke your authorizer. Access control 1078 Amazon API Gateway Developer Guide If the logs indicate that your Lambda function returns an invalid response, verify that your Lambda function returns a response in the required format. Control access to HTTP APIs with JWT authorizers in API Gateway You can use JSON Web Tokens (JWTs) as a part of OpenID Connect (OIDC) and OAuth 2.0 frameworks to restrict client access to your APIs. If you configure a JWT authorizer for a route of your API, API Gateway validates the JWTs that clients submit with API requests. API Gateway allows or denies requests based on token validation, and optionally, scopes in the token. If you configure scopes for a route, the token must include at least one of the route's scopes. You can configure distinct authorizers for each route of an API, or use the same authorizer for multiple routes. Note There is no standard mechanism to differentiate JWT access tokens from other types of JWTs, such as OpenID Connect ID tokens. Unless you require ID tokens for API authorization, we recommend that you configure your routes to require authorization scopes. You can also configure your JWT authorizers to require issuers or audiences that your identity provider uses only when issuing JWT access tokens. Authorizing API requests with a JWT authorizer API Gateway uses the following general workflow to authorize requests to routes that are configured to use a JWT authorizer. 1. Check the identitySource for a token. The identitySource can include only the token, or the token prefixed with Bearer. 2. Decode the token. 3. Check the token's algorithm and signature by using the public key that is fetched from the issuer's jwks_uri. Currently, only RSA-based algorithms are supported. API Gateway can cache the public key for two hours. As a best practice, when you rotate keys, allow a grace period during which both the old and new keys are valid. 4. Validate claims. API Gateway evaluates the following token claims: Access control 1079 Amazon API Gateway Developer Guide • kid – The token must have a header claim that matches the key in the jwks_uri that signed the token. • iss – Must match the issuer that is configured for the authorizer. • aud or client_id – Must match one of the audience entries that is configured for the authorizer. API Gateway validates client_id only if aud is not present. When both aud and client_id are present, API Gateway evaluates aud. • exp – Must be after the current time in UTC. • nbf – Must be before the current time in UTC. • iat – Must be before the current time in UTC. • scope or scp – The token must include at least one of the scopes in the route's authorizationScopes. If any of these steps fail, API Gateway denies the API request. After validating the JWT, API Gateway passes the claims in the token to the API route’s integration. Backend resources, such as Lambda functions, can access the JWT claims. For example, if the JWT includes an identity claim emailID, it's available to a Lambda integration in $event.requestContext.authorizer.jwt.claims.emailID. For more information about the payload that API Gateway sends to Lambda integrations, see the section called “AWS Lambda integrations”. Create a JWT authorizer Before you create a JWT authorizer, you must register a client application with an identity provider. You must also have created an HTTP API. For examples of creating an HTTP API, see Create an HTTP API. Create a JWT authorizer using the console The following steps show how to create JWT authorizer using the console. To create a JWT authorizer using the console 1. Sign in to the API Gateway console at https://console.aws.amazon.com/apigateway. 2. Choose an
apigateway-dg-294
apigateway-dg.pdf
294
For more information about the payload that API Gateway sends to Lambda integrations, see the section called “AWS Lambda integrations”. Create a JWT authorizer Before you create a JWT authorizer, you must register a client application with an identity provider. You must also have created an HTTP API. For examples of creating an HTTP API, see Create an HTTP API. Create a JWT authorizer using the console The following steps show how to create JWT authorizer using the console. To create a JWT authorizer using the console 1. Sign in to the API Gateway console at https://console.aws.amazon.com/apigateway. 2. Choose an HTTP API. 3. In the main navigation pane, choose Authorization. 4. Choose the Manage authorizers tab. Access control 1080 Amazon API Gateway 5. Choose Create. 6. For Authorizer type, choose JWT. Developer Guide 7. Configure your JWT authorizer, and specify an Identity source that defines the source of the token. 8. Choose Create. Create a JWT authorizer using the AWS CLI The following create-authorizer command creates a JWT authorizer. For jwt-configuration, specify the Audience and Issuer for your identity provider. If you use Amazon Cognito as an identity provider, the IssuerUrl is https://cognito-idp.us- east-2.amazonaws.com/userPoolID. aws apigatewayv2 create-authorizer \ --name authorizer-name \ --api-id api-id \ --authorizer-type JWT \ --identity-source '$request.header.Authorization' \ --jwt-configuration Audience=audience,Issuer=IssuerUrl Create a JWT authorizer using AWS CloudFormation The following AWS CloudFormation template creates an HTTP API with a JWT authorizer that uses Amazon Cognito as an identity provider. The output of the AWS CloudFormation template is a URL for an Amazon Cognito hosted UI where clients can sign up and sign in to receive a JWT. After a client signs in, the client is redirected to your HTTP API with an access token in the URL. To invoke the API with the access token, change the # in the URL to a ? to use the token as a query string parameter. Example AWS CloudFormation template AWSTemplateFormatVersion: '2010-09-09' Description: | Example HTTP API with a JWT authorizer. This template includes an Amazon Cognito user pool as the issuer for the JWT authorizer and an Amazon Cognito app client as the audience for the authorizer. The outputs include a URL for an Amazon Cognito hosted UI where clients can sign up and sign in to receive a JWT. After a client signs in, the client is redirected to your HTTP API with an access token Access control 1081 Amazon API Gateway Developer Guide in the URL. To invoke the API with the access token, change the '#' in the URL to a '?' to use the token as a query string parameter. Resources: MyAPI: Type: AWS::ApiGatewayV2::Api Properties: Description: Example HTTP API Name: api-with-auth ProtocolType: HTTP Target: !GetAtt MyLambdaFunction.Arn DefaultRouteOverrides: Type: AWS::ApiGatewayV2::ApiGatewayManagedOverrides Properties: ApiId: !Ref MyAPI Route: AuthorizationType: JWT AuthorizerId: !Ref JWTAuthorizer JWTAuthorizer: Type: AWS::ApiGatewayV2::Authorizer Properties: ApiId: !Ref MyAPI AuthorizerType: JWT IdentitySource: - '$request.querystring.access_token' JwtConfiguration: Audience: - !Ref AppClient Issuer: !Sub https://cognito-idp.${AWS::Region}.amazonaws.com/${UserPool} Name: test-jwt-authorizer MyLambdaFunction: Type: AWS::Lambda::Function Properties: Runtime: nodejs18.x Role: !GetAtt FunctionExecutionRole.Arn Handler: index.handler Code: ZipFile: | exports.handler = async (event) => { const response = { statusCode: 200, body: JSON.stringify('Hello from the ' + event.routeKey + ' route!'), }; return response; Access control 1082 Amazon API Gateway }; APIInvokeLambdaPermission: Type: AWS::Lambda::Permission Properties: FunctionName: !Ref MyLambdaFunction Action: lambda:InvokeFunction Principal: apigateway.amazonaws.com SourceArn: !Sub arn:${AWS::Partition}:execute-api:${AWS::Region}: ${AWS::AccountId}:${MyAPI}/$default/$default Developer Guide FunctionExecutionRole: Type: AWS::IAM::Role Properties: AssumeRolePolicyDocument: Version: '2012-10-17' Statement: - Effect: Allow Principal: Service: - lambda.amazonaws.com Action: - 'sts:AssumeRole' ManagedPolicyArns: - arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole UserPool: Type: AWS::Cognito::UserPool Properties: UserPoolName: http-api-user-pool AutoVerifiedAttributes: - email Schema: - Name: name AttributeDataType: String Mutable: true Required: true - Name: email AttributeDataType: String Mutable: false Required: true AppClient: Type: AWS::Cognito::UserPoolClient Properties: AllowedOAuthFlows: - implicit AllowedOAuthScopes: Access control 1083 Amazon API Gateway Developer Guide - aws.cognito.signin.user.admin - email - openid - profile AllowedOAuthFlowsUserPoolClient: true ClientName: api-app-client CallbackURLs: - !Sub https://${MyAPI}.execute-api.${AWS::Region}.amazonaws.com ExplicitAuthFlows: - ALLOW_USER_PASSWORD_AUTH - ALLOW_REFRESH_TOKEN_AUTH UserPoolId: !Ref UserPool SupportedIdentityProviders: - COGNITO HostedUI: Type: AWS::Cognito::UserPoolDomain Properties: Domain: !Join - '-' - - !Ref MyAPI - !Ref AppClient UserPoolId: !Ref UserPool Outputs: SignupURL: Value: !Sub https://${HostedUI}.auth.${AWS::Region}.amazoncognito.com/login? client_id=${AppClient}&response_type=token&scope=email+profile&redirect_uri=https:// ${MyAPI}.execute-api.${AWS::Region}.amazonaws.com Update a route to use a JWT authorizer You can use the console, the AWS CLI, or an AWS SDK to update a route to use a JWT authorizer. Update a route to use a JWT authorizer by using the console The following steps show how to update a route to use JWT authorizer using the console. To create a JWT authorizer using the console 1. Sign in to the API Gateway console at https://console.aws.amazon.com/apigateway. 2. Choose an HTTP API. 3. In the main navigation pane, choose Authorization. Access control 1084 Amazon API Gateway Developer Guide 4. Choose a method, and then select your authorizer from the dropdown menu, and choose Attach authorizer. Update a route to use a JWT authorizer by using the AWS CLI The following update-route command updates a route to use a
apigateway-dg-295
apigateway-dg.pdf
295
authorizer by using the console The following steps show how to update a route to use JWT authorizer using the console. To create a JWT authorizer using the console 1. Sign in to the API Gateway console at https://console.aws.amazon.com/apigateway. 2. Choose an HTTP API. 3. In the main navigation pane, choose Authorization. Access control 1084 Amazon API Gateway Developer Guide 4. Choose a method, and then select your authorizer from the dropdown menu, and choose Attach authorizer. Update a route to use a JWT authorizer by using the AWS CLI The following update-route command updates a route to use a JWT authorizer: aws apigatewayv2 update-route \ --api-id api-id \ --route-id route-id \ --authorization-type JWT \ --authorizer-id authorizer-id \ --authorization-scopes user.email Control access to HTTP APIs with IAM authorization in API Gateway You can enable IAM authorization for HTTP API routes. When IAM authorization is enabled, clients must use Signature Version 4 (SigV4) to sign their requests with AWS credentials. API Gateway invokes your API route only if the client has execute-api permission for the route. IAM authorization for HTTP APIs is similar to that for REST APIs. Note Resource policies aren't currently supported for HTTP APIs. For examples of IAM policies that grant clients the permission to invoke APIs, see the section called “Control access for invoking an API”. Enable IAM authorization for a route The following update-route command enables IAM authorization for an HTTP API route: aws apigatewayv2 update-route \ --api-id abc123 \ --route-id abcdef \ --authorization-type AWS_IAM Access control 1085 Amazon API Gateway Developer Guide Create integrations for HTTP APIs in API Gateway Integrations connect a route to backend resources. HTTP APIs support Lambda proxy, AWS service, and HTTP proxy integrations. For example, you can configure a POST request to the /signup route of your API to integrate with a Lambda function that handles signing up customers. Topics • Create AWS Lambda proxy integrations for HTTP APIs in API Gateway • Create HTTP proxy integrations for HTTP APIs • Create AWS service integrations for HTTP APIs in API Gateway • Create private integrations for HTTP APIs in API Gateway Create AWS Lambda proxy integrations for HTTP APIs in API Gateway A Lambda proxy integration enables you to integrate an API route with a Lambda function. When a client calls your API, API Gateway sends the request to the Lambda function and returns the function's response to the client. For examples of creating an HTTP API, see Create an HTTP API. Payload format version The payload format version specifies the format of the event that API Gateway sends to a Lambda integration, and how API Gateway interprets the response from Lambda. If you don't specify a payload format version, the AWS Management Console uses the latest version by default. If you create a Lambda integration by using the AWS CLI, AWS CloudFormation, or an SDK, you must specify a payloadFormatVersion. The supported values are 1.0 and 2.0. For more information about how to set the payloadFormatVersion, see create-integration. For more information about how to determine the payloadFormatVersion of an existing integration, see get-integration Payload format differences The following list shows differences between the 1.0 and 2.0 payload format versions: • Format 2.0 doesn't have multiValueHeaders or multiValueQueryStringParameters fields. Duplicate headers are combined with commas and included in the headers field. Duplicate query strings are combined with commas and included in the queryStringParameters field. Integrations 1086 Amazon API Gateway Developer Guide • Format 2.0 has rawPath. If you use an API mapping to connect your stage to a custom domain name, rawPath won't provide the API mapping value. Use format 1.0 and path to access the API mapping for your custom domain name. • Format 2.0 includes a new cookies field. All cookie headers in the request are combined with commas and added to the cookies field. In the response to the client, each cookie becomes a set-cookie header. Payload format structure The following examples show the structure of each payload format version. All headernames are lowercased. 2.0 { "version": "2.0", "routeKey": "$default", "rawPath": "/my/path", "rawQueryString": "parameter1=value1&parameter1=value2&parameter2=value", "cookies": [ "cookie1", "cookie2" ], "headers": { "header1": "value1", "header2": "value1,value2" }, "queryStringParameters": { "parameter1": "value1,value2", "parameter2": "value" }, "requestContext": { "accountId": "123456789012", "apiId": "api-id", "authentication": { "clientCert": { "clientCertPem": "CERT_CONTENT", "subjectDN": "www.example.com", "issuerDN": "Example issuer", "serialNumber": "a1:a1:a1:a1:a1:a1:a1:a1:a1:a1:a1:a1:a1:a1:a1:a1", "validity": { Integrations 1087 Amazon API Gateway Developer Guide "notBefore": "May 28 12:30:02 2019 GMT", "notAfter": "Aug 5 09:36:04 2021 GMT" } } }, "authorizer": { "jwt": { "claims": { "claim1": "value1", "claim2": "value2" }, "scopes": [ "scope1", "scope2" ] } }, "domainName": "id.execute-api.us-east-1.amazonaws.com", "domainPrefix": "id", "http": { "method": "POST", "path": "/my/path", "protocol": "HTTP/1.1", "sourceIp": "192.0.2.1", "userAgent": "agent" }, "requestId": "id", "routeKey": "$default", "stage": "$default", "time": "12/Mar/2020:19:03:58 +0000", "timeEpoch": 1583348638390 }, "body": "Hello from Lambda", "pathParameters": { "parameter1": "value1" }, "isBase64Encoded": false, "stageVariables": { "stageVariable1":
apigateway-dg-296
apigateway-dg.pdf
296
"apiId": "api-id", "authentication": { "clientCert": { "clientCertPem": "CERT_CONTENT", "subjectDN": "www.example.com", "issuerDN": "Example issuer", "serialNumber": "a1:a1:a1:a1:a1:a1:a1:a1:a1:a1:a1:a1:a1:a1:a1:a1", "validity": { Integrations 1087 Amazon API Gateway Developer Guide "notBefore": "May 28 12:30:02 2019 GMT", "notAfter": "Aug 5 09:36:04 2021 GMT" } } }, "authorizer": { "jwt": { "claims": { "claim1": "value1", "claim2": "value2" }, "scopes": [ "scope1", "scope2" ] } }, "domainName": "id.execute-api.us-east-1.amazonaws.com", "domainPrefix": "id", "http": { "method": "POST", "path": "/my/path", "protocol": "HTTP/1.1", "sourceIp": "192.0.2.1", "userAgent": "agent" }, "requestId": "id", "routeKey": "$default", "stage": "$default", "time": "12/Mar/2020:19:03:58 +0000", "timeEpoch": 1583348638390 }, "body": "Hello from Lambda", "pathParameters": { "parameter1": "value1" }, "isBase64Encoded": false, "stageVariables": { "stageVariable1": "value1", "stageVariable2": "value2" } } Integrations 1088 Developer Guide Amazon API Gateway 1.0 { "version": "1.0", "resource": "/my/path", "path": "/my/path", "httpMethod": "GET", "headers": { "header1": "value1", "header2": "value2" }, "multiValueHeaders": { "header1": [ "value1" ], "header2": [ "value1", "value2" ] }, "queryStringParameters": { "parameter1": "value1", "parameter2": "value" }, "multiValueQueryStringParameters": { "parameter1": [ "value1", "value2" ], "parameter2": [ "value" ] }, "requestContext": { "accountId": "123456789012", "apiId": "id", "authorizer": { "claims": null, "scopes": null }, "domainName": "id.execute-api.us-east-1.amazonaws.com", "domainPrefix": "id", "extendedRequestId": "request-id", "httpMethod": "GET", Integrations 1089 Amazon API Gateway Developer Guide "identity": { "accessKey": null, "accountId": null, "caller": null, "cognitoAuthenticationProvider": null, "cognitoAuthenticationType": null, "cognitoIdentityId": null, "cognitoIdentityPoolId": null, "principalOrgId": null, "sourceIp": "192.0.2.1", "user": null, "userAgent": "user-agent", "userArn": null, "clientCert": { "clientCertPem": "CERT_CONTENT", "subjectDN": "www.example.com", "issuerDN": "Example issuer", "serialNumber": "a1:a1:a1:a1:a1:a1:a1:a1:a1:a1:a1:a1:a1:a1:a1:a1", "validity": { "notBefore": "May 28 12:30:02 2019 GMT", "notAfter": "Aug 5 09:36:04 2021 GMT" } } }, "path": "/my/path", "protocol": "HTTP/1.1", "requestId": "id=", "requestTime": "04/Mar/2020:19:15:17 +0000", "requestTimeEpoch": 1583349317135, "resourceId": null, "resourcePath": "/my/path", "stage": "$default" }, "pathParameters": null, "stageVariables": null, "body": "Hello from Lambda!", "isBase64Encoded": false } Integrations 1090 Amazon API Gateway Developer Guide Lambda function response format The payload format version determines the structure of the response that your Lambda function must return. Lambda function response for format 1.0 With the 1.0 format version, Lambda integrations must return a response in the following JSON format: Example { "isBase64Encoded": true|false, "statusCode": httpStatusCode, "headers": { "headername": "headervalue", ... }, "multiValueHeaders": { "headername": ["headervalue", "headervalue2", ...], ... }, "body": "..." } Lambda function response for format 2.0 With the 2.0 format version, API Gateway can infer the response format for you. API Gateway makes the following assumptions if your Lambda function returns valid JSON and doesn't return a statusCode: • isBase64Encoded is false. • statusCode is 200. • content-type is application/json. • body is the function's response. The following examples show the output of a Lambda function and API Gateway's interpretation. Lambda function output API Gateway interpretation "Hello from Lambda!" { "isBase64Encoded": false, "statusCode": 200, "body": "Hello from Lambda!", "headers": { Integrations 1091 Amazon API Gateway Developer Guide Lambda function output API Gateway interpretation { "message": "Hello from Lambda!" } "content-type": "application/ json" } } { "isBase64Encoded": false, "statusCode": 200, "body": "{ \"message\": \"Hello from Lambda!\" }", "headers": { "content-type": "application/ json" } } To customize the response, your Lambda function should return a response with the following format. { "cookies" : ["cookie1", "cookie2"], "isBase64Encoded": true|false, "statusCode": httpStatusCode, "headers": { "headername": "headervalue", ... }, "body": "Hello from Lambda!" } Create HTTP proxy integrations for HTTP APIs An HTTP proxy integration enables you to connect an API route to a publicly routable HTTP endpoint. With this integration type, API Gateway passes the entire request and response between the frontend and the backend. To create an HTTP proxy integration, provide the URL of a publicly routable HTTP endpoint. HTTP proxy integration with path variables You can use path variables in HTTP API routes. Integrations 1092 Amazon API Gateway Developer Guide For example, the route /pets/{petID} catches requests to /pets/6. You can reference path variables in the integration URI to send the variable's contents to an integration. An example is / pets/extendedpath/{petID}. You can use greedy path variables to catch all child resources of a route. To create a greedy path variable, add + to the variable name—for example, {proxy+}. To set up a route with an HTTP proxy integration that catches all requests, create an API route with a greedy path variable (for example, /parent/{proxy+}). Integrate the route with an HTTP endpoint (for example, https://petstore-demo-endpoint.execute-api.com/petstore/ {proxy}) on the ANY method. The greedy path variable must be at the end of the resource path. Create AWS service integrations for HTTP APIs in API Gateway You can integrate your HTTP API with AWS services by using first-class integrations. A first-class integration connects an HTTP API route to an AWS service API. When a client invokes a route that's backed by a first-class integration, API Gateway invokes an AWS service API for you. For example, you can use first-class integrations to send a message to an Amazon Simple Queue Service queue, or to start an AWS Step Functions state machine. For supported service actions, see the section called “AWS service integrations reference”. Mapping
apigateway-dg-297
apigateway-dg.pdf
297
the resource path. Create AWS service integrations for HTTP APIs in API Gateway You can integrate your HTTP API with AWS services by using first-class integrations. A first-class integration connects an HTTP API route to an AWS service API. When a client invokes a route that's backed by a first-class integration, API Gateway invokes an AWS service API for you. For example, you can use first-class integrations to send a message to an Amazon Simple Queue Service queue, or to start an AWS Step Functions state machine. For supported service actions, see the section called “AWS service integrations reference”. Mapping request parameters First-class integrations have required and optional parameters. You must configure all required parameters to create an integration. You can use static values or map parameters that are dynamically evaluated at runtime. For a full list of supported integrations and parameters, see the section called “AWS service integrations reference”. The following table describes the supported mapping request parameters. Type Example Notes Header value $request.header.name Header names are case- insensitive. API Gateway combines multiple header values with commas, for example "header1": "value1,value2" . Integrations 1093 Amazon API Gateway Developer Guide Type Example Notes Query string value $request.querystring.name Path parameter $request.path.name Request body passthrough $request.body Query string names are case-sensitive. API Gateway combines multiple values with commas, for example "querystring1": "Value1,Value2" . The value of a path parameter in the request. For example if the route is /pets/{petId} , you can map the petId parameter from the request with $request.path.petId . API Gateway passes the entire request body through. Integrations 1094 Amazon API Gateway Developer Guide Type Example Notes Request body $request.body.name A JSON path expressio n. Recursive descent ($request.body.. name) and filter expressions (? (expression )) aren't supported. Note When you specify a JSON path, API Gateway truncates the request body at 100 KB and then applies the selection expression. To send payloads larger than 100 KB, specify $request.body . Context variable $context.variableName The value of a supported context variable. Stage variable $stageVariables.variableN The value of a stage variable. Static value ame string A constant value. Create a first-class integration Before you create a first-class integration, you must create an IAM role that grants API Gateway permissions to invoke the AWS service action that you're integrating with. To learn more, see Creating a role for an AWS service. Integrations 1095 Amazon API Gateway Developer Guide To create a first-class integration, choose a supported AWS service action, such as SQS- SendMessage, configure the request parameters, and provide a role that grants API Gateway permissions to invoke the integrated AWS service API. Depending on the integration subtype, different request parameters are required. To learn more, see the section called “AWS service integrations reference”. The following create-integration command creates an integration that sends an Amazon SQS message: aws apigatewayv2 create-integration \ --api-id abcdef123 \ --integration-subtype SQS-SendMessage \ --integration-type AWS_PROXY \ --payload-format-version 1.0 \ --credentials-arn arn:aws:iam::123456789012:role/apigateway-sqs \ --request-parameters '{"QueueUrl": "$request.header.queueUrl", "MessageBody": "$request.body.message"}' Create a first-class integration using AWS CloudFormation The following example shows an AWS CloudFormation snippet that creates a /{source}/ {detailType} route with a first-class integration with Amazon EventBridge. The Source parameter is mapped to the {source} path parameter, the DetailType is mapped to the {DetailType} path parameter, and the Detail parameter is mapped to the request body. The snippet does not show the event bus or the IAM role that grants API Gateway permissions to invoke the PutEvents action. Route: Type: AWS::ApiGatewayV2::Route Properties: ApiId: !Ref HttpApi AuthorizationType: None RouteKey: 'POST /{source}/{detailType}' Target: !Join - / - - integrations - !Ref Integration Integration: Type: AWS::ApiGatewayV2::Integration Integrations 1096 Developer Guide Amazon API Gateway Properties: ApiId: !Ref HttpApi IntegrationType: AWS_PROXY IntegrationSubtype: EventBridge-PutEvents CredentialsArn: !GetAtt EventBridgeRole.Arn RequestParameters: Source: $request.path.source DetailType: $request.path.detailType Detail: $request.body EventBusName: !GetAtt EventBus.Arn PayloadFormatVersion: "1.0" Integration subtype reference The following integration subtypes are supported for HTTP APIs. Integration subtypes • EventBridge-PutEvents 1.0 • SQS-SendMessage 1.0 • SQS-ReceiveMessage 1.0 • SQS-DeleteMessage 1.0 • SQS-PurgeQueue 1.0 • AppConfig-GetConfiguration 1.0 • Kinesis-PutRecord 1.0 • StepFunctions-StartExecution 1.0 • StepFunctions-StartSyncExecution 1.0 • StepFunctions-StopExecution 1.0 EventBridge-PutEvents 1.0 Sends custom events to Amazon EventBridge so that they can be matched to rules. Parameter Detail DetailType Integrations Required True True 1097 Developer Guide Amazon API Gateway Parameter Source Time EventBusName Resources Region TraceHeader Required True False False False False False To learn more, see PutEvents in the Amazon EventBridge API Reference. SQS-SendMessage 1.0 Delivers a message to the specified queue. Parameter QueueUrl MessageBody DelaySeconds MessageAttributes MessageDeduplicationId MessageGroupId MessageSystemAttributes Region Required True True False False False False False False To learn more, see SendMessage in the Amazon Simple Queue Service API Reference. Integrations 1098 Amazon API Gateway SQS-ReceiveMessage 1.0 Developer Guide Retrieves one or more messages (up to 10), from the specified queue. Parameter QueueUrl AttributeNames MaxNumberOfMessages MessageAttributeNames ReceiveRequestAttemptId VisibilityTimeout WaitTimeSeconds Region Required True False False False False False False False To
apigateway-dg-298
apigateway-dg.pdf
298
Region TraceHeader Required True False False False False False To learn more, see PutEvents in the Amazon EventBridge API Reference. SQS-SendMessage 1.0 Delivers a message to the specified queue. Parameter QueueUrl MessageBody DelaySeconds MessageAttributes MessageDeduplicationId MessageGroupId MessageSystemAttributes Region Required True True False False False False False False To learn more, see SendMessage in the Amazon Simple Queue Service API Reference. Integrations 1098 Amazon API Gateway SQS-ReceiveMessage 1.0 Developer Guide Retrieves one or more messages (up to 10), from the specified queue. Parameter QueueUrl AttributeNames MaxNumberOfMessages MessageAttributeNames ReceiveRequestAttemptId VisibilityTimeout WaitTimeSeconds Region Required True False False False False False False False To learn more, see ReceiveMessage in the Amazon Simple Queue Service API Reference. SQS-DeleteMessage 1.0 Deletes the specified message from the specified queue. Parameter ReceiptHandle QueueUrl Region Required True True False To learn more, see DeleteMessage in the Amazon Simple Queue Service API Reference. SQS-PurgeQueue 1.0 Deletes all messages in the specified queue. Integrations 1099 Amazon API Gateway Developer Guide Parameter QueueUrl Region Required True False To learn more, see PurgeQueue in the Amazon Simple Queue Service API Reference. AppConfig-GetConfiguration 1.0 Receive information about a configuration. Parameter Application Environment Configuration ClientId ClientConfigurationVersion Region Required True True True True False False To learn more, see GetConfiguration in the AWS AppConfig API Reference. Kinesis-PutRecord 1.0 Writes a single data record into an Amazon Kinesis data stream. Parameter StreamName Data PartitionKey Integrations Required True True True 1100 Amazon API Gateway Parameter SequenceNumberForOrdering ExplicitHashKey Region Required False False False Developer Guide To learn more, see PutRecord in the Amazon Kinesis Data Streams API Reference. StepFunctions-StartExecution 1.0 Starts a state machine execution. Parameter StateMachineArn Name Input Region Required True False False False To learn more, see StartExecution in the AWS Step Functions API Reference. StepFunctions-StartSyncExecution 1.0 Starts a synchronous state machine execution. Parameter StateMachineArn Name Input Region Integrations Required True False False False 1101 Amazon API Gateway Parameter TraceHeader Required False Developer Guide To learn more, see StartSyncExecution in the AWS Step Functions API Reference. StepFunctions-StopExecution 1.0 Stops an execution. Parameter ExecutionArn Cause Error Region Required True False False False To learn more, see StopExecution in the AWS Step Functions API Reference. Create private integrations for HTTP APIs in API Gateway Private integrations enable you to create API integrations with private resources in a VPC, such as Application Load Balancers or Amazon ECS container-based applications. You can expose your resources in a VPC for access by clients outside of the VPC by using private integrations. You can control access to your API by using any of the authorization methods that API Gateway supports. To create a private integration, you must first create a VPC link. To learn more about VPC links, see Set up VPC links for HTTP APIs in API Gateway. After you’ve created a VPC link, you can set up private integrations that connect to an Application Load Balancer, Network Load Balancer, or resources registered with an AWS Cloud Map service. To create a private integration, all resources must be owned by the same AWS account (including the load balancer or AWS Cloud Map service, VPC link and HTTP API). Integrations 1102 Amazon API Gateway Developer Guide By default, private integration traffic uses the HTTP protocol. You can specify a tlsConfig if you require private integration traffic to use HTTPS. To do this using the AWS Management Console, when you create your private integration, choose Advanced settings and then enter a secure server name. Note For private integrations, API Gateway includes the stage portion of the API endpoint in the request to your backend resources. For example, a request to the test stage of an API includes test/route-path in the request to your private integration. To remove the stage name from the request to your backend resources, use parameter mapping to overwrite the request path to $request.path. Create a private integration using an Application Load Balancer or Network Load Balancer Before you create a private integration, you must create a VPC link. To learn more about VPC links, see Set up VPC links for HTTP APIs in API Gateway. To create a private integration with an Application Load Balancer or Network Load Balancer, create an HTTP proxy integration, specify the VPC link to use, and provide the listener ARN of the load balancer. The following create-integration command creates a private integration that connects to a load balancer by using a VPC link: aws apigatewayv2 create-integration --api-id api-id --integration-type HTTP_PROXY \ --integration-method GET --connection-type VPC_LINK \ --connection-id VPC-link-ID \ --integration-uri arn:aws:elasticloadbalancing:us-east-2:123456789012:listener/app/ my-load-balancer/50dc6c495c0c9188/0467ef3c8400ae65 --payload-format-version 1.0 Create a private integration using AWS Cloud Map service discovery Before you create a private integration, you must create a VPC link. To learn more about VPC links, see Set up VPC links for HTTP APIs in API Gateway. For integrations with AWS Cloud Map, API Gateway uses DiscoverInstances to identify
apigateway-dg-299
apigateway-dg.pdf
299
and provide the listener ARN of the load balancer. The following create-integration command creates a private integration that connects to a load balancer by using a VPC link: aws apigatewayv2 create-integration --api-id api-id --integration-type HTTP_PROXY \ --integration-method GET --connection-type VPC_LINK \ --connection-id VPC-link-ID \ --integration-uri arn:aws:elasticloadbalancing:us-east-2:123456789012:listener/app/ my-load-balancer/50dc6c495c0c9188/0467ef3c8400ae65 --payload-format-version 1.0 Create a private integration using AWS Cloud Map service discovery Before you create a private integration, you must create a VPC link. To learn more about VPC links, see Set up VPC links for HTTP APIs in API Gateway. For integrations with AWS Cloud Map, API Gateway uses DiscoverInstances to identify resources. You can use query parameters to target specific resources. The registered resources' Integrations 1103 Amazon API Gateway Developer Guide attributes must include IP addresses and ports. API Gateway distributes requests across healthy resources that are returned from DiscoverInstances. To learn more, see DiscoverInstances in the AWS Cloud Map API Reference. Note If you use Amazon ECS to populate entries in AWS Cloud Map, you must configure your Amazon ECS task to use SRV records with Amazon ECS Service Discovery or turn on Amazon ECS Service Connect. For more information, see Interconnecting services in the Amazon Elastic Container Service Developer Guide. To create a private integration with AWS Cloud Map, create an HTTP proxy integration, specify the VPC link to use, and provide the ARN of the AWS Cloud Map service. The following create-integration command creates a private integration that uses AWS Cloud Map service discovery to identify resources: aws apigatewayv2 create-integration --api-id api-id --integration-type HTTP_PROXY \ --integration-method GET --connection-type VPC_LINK \ --connection-id VPC-link-ID \ --integration-uri arn:aws:servicediscovery:us-east-2:123456789012:service/srv-id? stage=prod&deployment=green_deployment --payload-format-version 1.0 Set up VPC links for HTTP APIs in API Gateway VPC links enable you to create private integrations that connect your HTTP API routes to private resources in a VPC, such as Application Load Balancers or Amazon ECS container-based applications. To learn more about creating private integrations, see Create private integrations for HTTP APIs in API Gateway. A private integration uses a VPC link to encapsulate connections between API Gateway and targeted VPC resources. You can reuse VPC links across different routes and APIs. When you create a VPC link, API Gateway creates and manages elastic network interfaces for the VPC link in your account. This process can take a few minutes. When a VPC link is ready to use, its state transitions from PENDING to AVAILABLE. Integrations 1104 Amazon API Gateway Note Developer Guide If no traffic is sent over the VPC link for 60 days, it becomes INACTIVE. When a VPC link is in an INACTIVE state, API Gateway deletes all of the VPC link’s network interfaces. This causes API requests that depend on the VPC link to fail. If API requests resume, API Gateway reprovisions network interfaces. It can take a few minutes to create the network interfaces and reactivate the VPC link. You can use the VPC link status to monitor the state of your VPC link. Create a VPC link by using the AWS CLI To create a VPC link, all resources involved must be owned by the same AWS account. The following create-vpc-link command creates a VPC link: aws apigatewayv2 create-vpc-link --name MyVpcLink \ --subnet-ids subnet-aaaa subnet-bbbb \ --security-group-ids sg1234 sg5678 Note VPC links are immutable. After you create a VPC link, you can’t change its subnets or security groups. Delete a VPC link by using the AWS CLI The following delete-vpc-link command deletes a VPC link. aws apigatewayv2 delete-vpc-link --vpc-link-id abcd123 Availability by Region VPC links for HTTP APIs are supported in the following Regions and Availability Zones: Region name Region Supported Availability Zones us-east-2 use2-az1, use2-az2, use2-az3 US East (Ohio) Integrations 1105 Amazon API Gateway Developer Guide Region name Region Supported Availability Zones US East (N. Virginia) US West (N. California) US West (Oregon) Asia Pacific (Hong Kong) Asia Pacific (Mumbai) us-east-1 use1-az1, use1-az2, use1-az4, use1-az5, use1-az6 us-west-1 usw1-az1, usw1-az3 us-west-2 usw2-az1, usw2-az2, usw2-az3, usw2-az4 ap-east-1 ape1-az2, ape1-az3 ap-south-1 aps1-az1, aps1-az2, aps1-az3 Asia Pacific (Seoul) ap-northe ast-2 Asia Pacific (Singapore) ap-southe ast-1 Asia Pacific (Sydney) ap-southe ast-2 Asia Pacific (Tokyo) ap-northe ast-1 apne2-az1, apne2-az2, apne2-az3 apse1-az1, apse1-az2, apse1-az3 apse2-az1, apse2-az2, apse2-az3 apne1-az1, apne1-az2, apne1-az4 ca-central-1 cac1-az1, cac1-az2 eu-central-1 euc1-az1, euc1-az2, euc1-az3 eu-west-1 euw1-az1, euw1-az2, euw1-az3 eu-west-2 euw2-az1, euw2-az2, euw2-az3 Canada (Central) Europe (Frankfurt) Europe (Ireland) Europe (London) Integrations 1106 Amazon API Gateway Developer Guide Region name Region Supported Availability Zones Europe (Paris) Europe (Spain) Europe (Stockholm) Middle East (Bahrain) South America (São Paulo) AWS GovCloud (US-West) eu-west-3 euw3-az1, euw3-az3 eu-south-2 eus2-az1, eus2-az2, eus2-az3 eu-north-1 eun1-az1, eun1-az2, eun1-az3 me-south-1 mes1-az1, mes1-az2, mes1-az3 sa-east-1 sae1-az1, sae1-az2, sae1-az3 us-gov-we st-1 usgw1-az1, usgw1-az2, usgw1-az3 Configure CORS for HTTP APIs in API Gateway Cross-origin resource sharing (CORS) is a browser security feature that restricts HTTP requests that are initiated from scripts running in the browser. If you
apigateway-dg-300
apigateway-dg.pdf
300
euw1-az1, euw1-az2, euw1-az3 eu-west-2 euw2-az1, euw2-az2, euw2-az3 Canada (Central) Europe (Frankfurt) Europe (Ireland) Europe (London) Integrations 1106 Amazon API Gateway Developer Guide Region name Region Supported Availability Zones Europe (Paris) Europe (Spain) Europe (Stockholm) Middle East (Bahrain) South America (São Paulo) AWS GovCloud (US-West) eu-west-3 euw3-az1, euw3-az3 eu-south-2 eus2-az1, eus2-az2, eus2-az3 eu-north-1 eun1-az1, eun1-az2, eun1-az3 me-south-1 mes1-az1, mes1-az2, mes1-az3 sa-east-1 sae1-az1, sae1-az2, sae1-az3 us-gov-we st-1 usgw1-az1, usgw1-az2, usgw1-az3 Configure CORS for HTTP APIs in API Gateway Cross-origin resource sharing (CORS) is a browser security feature that restricts HTTP requests that are initiated from scripts running in the browser. If you cannot access your API and receive an error message that contains Cross-Origin Request Blocked, you might need to enable CORS. For more information, see What is CORS?. CORS is typically required to build web applications that access APIs hosted on a different domain or origin. You can enable CORS to allow requests to your API from a web application hosted on a different domain. For example, if your API is hosted on https://{api_id}.execute-api. {region}.amazonaws.com/ and you want to call your API from a web application hosted on example.com, your API must support CORS. If you configure CORS for an API, API Gateway automatically sends a response to preflight OPTIONS requests, even if there isn't an OPTIONS route configured for your API. For a CORS request, API Gateway adds the configured CORS headers to the response from an integration. CORS 1107 Amazon API Gateway Note Developer Guide If you configure CORS for an API, API Gateway ignores CORS headers returned from your backend integration. You can specify the following parameters in a CORS configuration. To add these parameters using the API Gateway HTTP API console, choose Add after you enter your value. CORS headers CORS configuration property Example values Access-Control-Allow-Origin allowOrigins • https://www.exampl e.com • * (allow all origins) • https://* (allow any origin that begins with https://) • http://* (allow any origin that begins with http://) Access-Control-Allow-Creden tials Access-Control-Expose-Heade rs allowCredentials true exposeHeaders Date, x-api-id, * Access-Control-Max-Age maxAge 300 Access-Control-Allow-Method s Access-Control-Allow-Header s allowMethods GET, POST, DELETE, * allowHeaders Authorization, * To return CORS headers, your request must contain an origin header. For the OPTIONS method, your request must contain an origin header and an Access-Control-Request-Method header. CORS 1108 Amazon API Gateway Developer Guide Your CORS configuration might look similar to the following: Configuring CORS for an HTTP API with a $default route and an authorizer You can enable CORS and configure authorization for any route of an HTTP API. When you enable CORS and authorization for the $default route, there are some special considerations. The $default route catches requests for all methods and routes that you haven't explicitly defined, including OPTIONS requests. To support unauthorized OPTIONS requests, add an OPTIONS / {proxy+} route to your API that doesn't require authorization and attach an integration to the route. The OPTIONS /{proxy+} route has higher priority than the $default route. As a result, it enables clients to submit OPTIONS requests to your API without authorization. For more information about routing priorities, see Routing API requests. Configure CORS for an HTTP API by using the AWS CLI The following update-api command enables CORS requests from https://www.example.com: CORS 1109 Amazon API Gateway Example Developer Guide aws apigatewayv2 update-api --api-id api-id --cors-configuration AllowOrigins="https:// www.example.com" For more information, see CORS in the Amazon API Gateway Version 2 API Reference. Transform API requests and responses for HTTP APIs in API Gateway You can modify API requests from clients before they reach your backend integrations. You can also change the response from integrations before API Gateway returns the response to clients. You use parameter mapping to modify API requests and responses for HTTP APIs. To use parameter mapping, you specify API request or response parameters to modify, and specify how to modify those parameters. Transforming API requests You use request parameters to change requests before they reach your backend integrations. You can modify headers, query strings, or the request path. Request parameters are a key-value map. The key identifies the location of the request parameter to change, and how to change it. The value specifies the new data for the parameter. The following table shows supported keys. Type Header Query string Path Syntax append|overwrite|remove:hea der. headername append|overwrite|remove:que rystring. querystring-name overwrite:path The following table shows supported values that you can map to parameters. Parameter mapping 1110 Amazon API Gateway Developer Guide Type Syntax Notes Header value $request.header.name or ${request.header.name} Header names are case- insensitive. API Gateway combines multiple header values with commas, for example "header1": "value1,value2" . Some headers are reserved. To learn more, see the section called “Reserved headers”. Query string value $request.querystring.name or ${request.querystring.name} Query string names are case-sensitive. API Gateway Request body $request.body.name or ${request.body.name} combines multiple values with commas, for example "querystring1" "Value1,Value2" .
apigateway-dg-301
apigateway-dg.pdf
301
Type Header Query string Path Syntax append|overwrite|remove:hea der. headername append|overwrite|remove:que rystring. querystring-name overwrite:path The following table shows supported values that you can map to parameters. Parameter mapping 1110 Amazon API Gateway Developer Guide Type Syntax Notes Header value $request.header.name or ${request.header.name} Header names are case- insensitive. API Gateway combines multiple header values with commas, for example "header1": "value1,value2" . Some headers are reserved. To learn more, see the section called “Reserved headers”. Query string value $request.querystring.name or ${request.querystring.name} Query string names are case-sensitive. API Gateway Request body $request.body.name or ${request.body.name} combines multiple values with commas, for example "querystring1" "Value1,Value2" . A JSON path expressio n. Recursive descent ($request.body..nam e) and filter expressions (?(expression) ) aren't supported. Note When you specify a JSON path, API Gateway truncates the request body at 100 KB and then applies the selection expression. To send payloads larger Parameter mapping 1111 Amazon API Gateway Developer Guide Type Syntax Notes Request path Path parameter than 100 KB, specify $request.body . $request.path or ${request .path} The request path, without the stage name. $request.path.name or ${request.path.name} The value of a path parameter in the request. For example if the route is /pets/{petId} , you can map the petId parameter from the request with $request.path.petId . Context variable $context.variableName or ${context.variableName } The value of a context variable. Note Only the special characters . and _ are supported. Stage variable $stageVariables.variableN ame or ${stageVa riables.variableName } The value of a stage variable. Static value string A constant value. Note To use multiple variables in a selection expression, enclose the variable in brackets. For example, ${request.path.name} ${request.path.id}. Parameter mapping 1112 Amazon API Gateway Developer Guide Transforming API responses You use response parameters to transform the HTTP response from a backend integration before returning the response to clients. You can modify headers or the status code of a response before API Gateway returns the response to clients. You configure response parameters for each status code that your integration returns. Response parameters are a key-value map. The key identifies the location of the request parameter to change, and how to change it. The value specifies the new data for the parameter. The following table shows supported keys. Type Header Syntax append|overwrite|remove:hea der. headername Status code overwrite:statuscode The following table shows supported values that you can map to parameters. Type Syntax Notes Header value $response.header.name or ${response.header.name} Header names are case- insensitive. API Gateway combines multiple header values with commas, for example "header1": "value1,value2" . Some headers are reserved. To learn more, see the section called “Reserved headers”. Response body $response.body.name or ${response.body.name} A JSON path expressio n. Recursive descent ($response.body..na me ) and filter expressions Parameter mapping 1113 Amazon API Gateway Developer Guide Type Syntax Notes (?(expression) ) aren't supported. Note When you specify a JSON path, API Gateway truncates the response body at 100 KB and then applies the selection expression. To send payloads larger than 100 KB, specify $response.body . Context variable Stage variable $context.variableName or ${context.variableName } The value of a supported context variable. $stageVariables.variableN ame or ${stageVa riables.variableName } The value of a stage variable. Static value string A constant value. Note To use multiple variables in a selection expression, enclose the variable in brackets. For example, ${request.path.name} ${request.path.id}. Reserved headers The following headers are reserved. You can't configure request or response mappings for these headers. Parameter mapping 1114 Developer Guide Amazon API Gateway • access-control-* • apigw-* • Authorization • Connection • Content-Encoding • Content-Length • Content-Location • Forwarded • Keep-Alive • Origin • Proxy-Authenticate • Proxy-Authorization • TE • Trailers • Transfer-Encoding • Upgrade • x-amz-* • x-amzn-* • X-Forwarded-For • X-Forwarded-Host • X-Forwarded-Proto • Via Examples The following AWS CLI examples configure parameter mappings. For example AWS CloudFormation templates, see GitHub. Add a header to an API request The following create-integration command creates a header named header1 to an API request before it reaches your backend integration. API Gateway populates the header with the request ID. Parameter mapping 1115 Amazon API Gateway Developer Guide aws apigatewayv2 create-integration \ --api-id abcdef123 \ --integration-type HTTP_PROXY \ --payload-format-version 1.0 \ --integration-uri 'https://api.example.com' \ --integration-method ANY \ --request-parameters '{ "append:header.header1": "$context.requestId" }' Rename a request header The following create-integration command renames a request header from header1 to header2: aws apigatewayv2 create-integration \ --api-id abcdef123 \ --integration-type HTTP_PROXY \ --payload-format-version 1.0 \ --integration-uri 'https://api.example.com' \ --integration-method ANY \ --request-parameters '{ "append:header.header2": "$request.header.header1", "remove:header.header1": "''"}' Change the response from an integration The following create-integration command configures response parameters for an integration. When the integrations returns a 500 status code, API Gateway changes the status code to 403, and adds header11 to the response. When the integration returns a 404 status code, API Gateway adds an error header to the response. aws apigatewayv2 create-integration \ --api-id abcdef123 \ --integration-type HTTP_PROXY \ --payload-format-version 1.0
apigateway-dg-302
apigateway-dg.pdf
302
renames a request header from header1 to header2: aws apigatewayv2 create-integration \ --api-id abcdef123 \ --integration-type HTTP_PROXY \ --payload-format-version 1.0 \ --integration-uri 'https://api.example.com' \ --integration-method ANY \ --request-parameters '{ "append:header.header2": "$request.header.header1", "remove:header.header1": "''"}' Change the response from an integration The following create-integration command configures response parameters for an integration. When the integrations returns a 500 status code, API Gateway changes the status code to 403, and adds header11 to the response. When the integration returns a 404 status code, API Gateway adds an error header to the response. aws apigatewayv2 create-integration \ --api-id abcdef123 \ --integration-type HTTP_PROXY \ --payload-format-version 1.0 \ --integration-uri 'https://api.example.com' \ --integration-method ANY \ --response-parameters '{"500" : {"append:header.header1": "$context.requestId", "overwrite:statuscode" : "403"}, "404" : {"append:header.error" : "$stageVariables.environmentId"} }' Parameter mapping 1116 Amazon API Gateway Developer Guide Remove configured parameter mappings The following update-integration command removes previously configured request parameters for append:header.header1. It also removes previously configured response parameters for a 200 status code. aws apigatewayv2 update-integration \ --api-id abcdef123 \ --integration-id hijk456 \ --request-parameters '{"append:header.header1" : ""}' \ --response-parameters '{"200" : {}}' Use OpenAPI definitions for HTTP APIs in API Gateway You can define your HTTP API by using an OpenAPI 3.0 definition file. Then you can import the definition into API Gateway to create an API. To learn more about API Gateway extensions to OpenAPI, see OpenAPI extensions. Importing an HTTP API You can create an HTTP API by importing an OpenAPI 3.0 definition file. To migrate from a REST API to an HTTP API, you can export your REST API as an OpenAPI 3.0 definition file. Then import the API definition as an HTTP API. To learn more about exporting a REST API, see Export a REST API from API Gateway. Note HTTP APIs support the same AWS variables as REST APIs. To learn more, see AWS variables for OpenAPI import. Import validation information As you import an API, API Gateway provides three categories of validation information. Info A property is valid according to the OpenAPI specification, but that property isn’t supported for HTTP APIs. OpenAPI 1117 Amazon API Gateway Developer Guide For example, the following OpenAPI 3.0 snippet produces info on import because HTTP APIs don't support request validation. API Gateway ignores the requestBody and schema fields. "paths": { "/": { "get": { "x-amazon-apigateway-integration": { "type": "AWS_PROXY", "httpMethod": "POST", "uri": "arn:aws:lambda:us-east-2:123456789012:function:HelloWorld", "payloadFormatVersion": "1.0" }, "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Body" } } } } } } ... }, "components": { "schemas": { "Body": { "type": "object", "properties": { "key": { "type": "string" } } } ... } ... } OpenAPI 1118 Amazon API Gateway Warning Developer Guide A property or structure is invalid according to the OpenAPI specification, but it doesn’t block API creation. You can specify whether API Gateway should ignore these warnings and continue creating the API, or stop creating the API on warnings. The following OpenAPI 3.0 document produces warnings on import because HTTP APIs support only Lambda proxy and HTTP proxy integrations. "x-amazon-apigateway-integration": { "type": "AWS", "httpMethod": "POST", "uri": "arn:aws:lambda:us-east-2:123456789012:function:HelloWorld", "payloadFormatVersion": "1.0" } Error The OpenAPI specification is invalid or malformed. API Gateway can’t create any resources from the malformed document. You must fix the errors, and then try again. The following API definition produces errors on import because HTTP APIs support only the OpenAPI 3.0 specification. { "swagger": "2.0.0", "info": { "title": "My API", "description": "An Example OpenAPI definition for Errors/Warnings/ImportInfo", "version": "1.0" } ... } As another example, while OpenAPI allows users to define an API with multiple security requirements attached to a particular operation, API Gateway does not support this. Each operation can have only one of IAM authorization, a Lambda authorizer, or a JWT authorizer. Attempting to model multiple security requirements results in an error. OpenAPI 1119 Amazon API Gateway Developer Guide Import an API by using the AWS CLI The following import-api command imports the OpenAPI 3.0 definition file api- definition.json as an HTTP API: Example aws apigatewayv2 import-api --body file://api-definition.json Example You can import the following example OpenAPI 3.0 definition to create an HTTP API. { "openapi": "3.0.1", "info": { "title": "Example Pet Store", "description": "A Pet Store API.", "version": "1.0" }, "paths": { "/pets": { "get": { "operationId": "GET HTTP", "parameters": [ { "name": "type", "in": "query", "schema": { "type": "string" } }, { "name": "page", "in": "query", "schema": { "type": "string" } } ], "responses": { "200": { "description": "200 response", OpenAPI 1120 Amazon API Gateway Developer Guide "headers": { "Access-Control-Allow-Origin": { "schema": { "type": "string" } } }, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Pets" } } } } }, "x-amazon-apigateway-integration": { "type": "HTTP_PROXY", "httpMethod": "GET", "uri": "http://petstore.execute-api.us-west-1.amazonaws.com/petstore/pets", "payloadFormatVersion": 1.0 } }, "post": { "operationId": "Create Pet", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/NewPet" } } }, "required": true }, "responses": { "200":
apigateway-dg-303
apigateway-dg.pdf
303
HTTP", "parameters": [ { "name": "type", "in": "query", "schema": { "type": "string" } }, { "name": "page", "in": "query", "schema": { "type": "string" } } ], "responses": { "200": { "description": "200 response", OpenAPI 1120 Amazon API Gateway Developer Guide "headers": { "Access-Control-Allow-Origin": { "schema": { "type": "string" } } }, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Pets" } } } } }, "x-amazon-apigateway-integration": { "type": "HTTP_PROXY", "httpMethod": "GET", "uri": "http://petstore.execute-api.us-west-1.amazonaws.com/petstore/pets", "payloadFormatVersion": 1.0 } }, "post": { "operationId": "Create Pet", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/NewPet" } } }, "required": true }, "responses": { "200": { "description": "200 response", "headers": { "Access-Control-Allow-Origin": { "schema": { "type": "string" } } OpenAPI 1121 Amazon API Gateway }, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/NewPetResponse" Developer Guide } } } } }, "x-amazon-apigateway-integration": { "type": "HTTP_PROXY", "httpMethod": "POST", "uri": "http://petstore.execute-api.us-west-1.amazonaws.com/petstore/pets", "payloadFormatVersion": 1.0 } } }, "/pets/{petId}": { "get": { "operationId": "Get Pet", "parameters": [ { "name": "petId", "in": "path", "required": true, "schema": { "type": "string" } } ], "responses": { "200": { "description": "200 response", "headers": { "Access-Control-Allow-Origin": { "schema": { "type": "string" } } }, "content": { "application/json": { "schema": { OpenAPI 1122 Amazon API Gateway Developer Guide "$ref": "#/components/schemas/Pet" } } } } }, "x-amazon-apigateway-integration": { "type": "HTTP_PROXY", "httpMethod": "GET", "uri": "http://petstore.execute-api.us-west-1.amazonaws.com/petstore/pets/ {petId}", "payloadFormatVersion": 1.0 } } } }, "x-amazon-apigateway-cors": { "allowOrigins": [ "*" ], "allowMethods": [ "GET", "OPTIONS", "POST" ], "allowHeaders": [ "x-amzm-header", "x-apigateway-header", "x-api-key", "authorization", "x-amz-date", "content-type" ] }, "components": { "schemas": { "Pets": { "type": "array", "items": { "$ref": "#/components/schemas/Pet" } }, "Empty": { "type": "object" OpenAPI 1123 Amazon API Gateway }, "NewPetResponse": { "type": "object", "properties": { "pet": { "$ref": "#/components/schemas/Pet" Developer Guide }, "message": { "type": "string" } } }, "Pet": { "type": "object", "properties": { "id": { "type": "string" }, "type": { "type": "string" }, "price": { "type": "number" } } }, "NewPet": { "type": "object", "properties": { "type": { "$ref": "#/components/schemas/PetType" }, "price": { "type": "number" } } }, "PetType": { "type": "string", "enum": [ "dog", "cat", "fish", "bird", OpenAPI 1124 Amazon API Gateway "gecko" ] } } } } Developer Guide Export HTTP APIs from API Gateway After you've created an HTTP API, you can export an OpenAPI 3.0 definition of your API from API Gateway. You can either choose a stage to export, or export the latest configuration of your API. You can also import an exported API definition into API Gateway to create another, identical API. To learn more about importing API definitions, see Importing an HTTP API. Export an OpenAPI 3.0 definition of a stage by using the AWS CLI The following export-api command exports an OpenAPI definition of an API stage named prod to a YAML file named stage-definition.yaml. The exported definition file includes API Gateway extensions by default. aws apigatewayv2 export-api \ --api-id api-id \ --output-type YAML \ --specification OAS30 \ --stage-name prod \ stage-definition.yaml Export an OpenAPI 3.0 definition of your API's latest changes by using the AWS CLI The following export-api command exports an OpenAPI definition of an HTTP API to a JSON file named latest-api-definition.json. Because the command doesn't specify a stage, API Gateway exports the latest configuration of your API, whether it has been deployed to a stage or not. The exported definition file doesn't include API Gateway extensions. aws apigatewayv2 export-api \ --api-id api-id \ --output-type JSON \ --specification OAS30 \ --no-include-extensions \ latest-api-definition.json OpenAPI 1125 Amazon API Gateway Developer Guide For more information, see ExportAPI in the Amazon API Gateway Version 2 API Reference. Export an OpenAPI 3.0 definition by using the API Gateway console The following procedure shows how to export an OpenAPI definition of an HTTP API. To export an OpenAPI 3.0 definition using the API Gateway console 1. Sign in to the API Gateway console at https://console.aws.amazon.com/apigateway. 2. Choose an HTTP API. 3. On the main navigation pane, under Develop, choose Export. 4. Select from the following options to export your API: a. b. c. For Source, select a source for the OpenAPI 3.0 definition. You can choose a stage to export, or export the latest configuration of your API. Turn on Include API Gateway extensions to include API Gateway extensions. For Output format, select an output format. 5. Choose Download. OpenAPI 1126 Amazon API Gateway Developer Guide Publish HTTP APIs for customers to invoke You can use stages and custom domain names to publish your API for clients to invoke. An API stage is a logical reference to a lifecycle state of your API (for example, dev, prod, beta, or v2). Each stage is a named reference to a deployment of the API and is made available for client applications to call. You can configure different integrations and settings for each stage of an API. You can use custom domain names to
apigateway-dg-304
apigateway-dg.pdf
304
format, select an output format. 5. Choose Download. OpenAPI 1126 Amazon API Gateway Developer Guide Publish HTTP APIs for customers to invoke You can use stages and custom domain names to publish your API for clients to invoke. An API stage is a logical reference to a lifecycle state of your API (for example, dev, prod, beta, or v2). Each stage is a named reference to a deployment of the API and is made available for client applications to call. You can configure different integrations and settings for each stage of an API. You can use custom domain names to provide a simpler, more intuitive URL for clients to invoke your API than the default URL, https://api-id.execute- api.region.amazonaws.com/stage. Note To augment the security of your API Gateway APIs, the execute-api. {region}.amazonaws.com domain is registered in the Public Suffix List (PSL). For further security, we recommend that you use cookies with a __Host- prefix if you ever need to set sensitive cookies in the default domain name for your API Gateway APIs. This practice will help to defend your domain against cross-site request forgery attempts (CSRF). For more information see the Set-Cookie page in the Mozilla Developer Network. Topics • Stages for HTTP APIs in API Gateway • Security policy for HTTP APIs in API Gateway • Custom domain names for HTTP APIs in API Gateway Stages for HTTP APIs in API Gateway An API stage is a logical reference to a lifecycle state of your API (for example, dev, prod, beta, or v2). API stages are identified by their API ID and stage name, and they're included in the URL you use to invoke the API. Each stage is a named reference to a deployment of the API and is made available for client applications to call. You can create a $default stage that is served from the base of your API's URL—for example, https://{api_id}.execute-api.{region}.amazonaws.com/. You use this URL to invoke an API stage. Publish 1127 Amazon API Gateway Developer Guide A deployment is a snapshot of your API configuration. After you deploy an API to a stage, it’s available for clients to invoke. You must deploy an API for changes to take effect. If you enable automatic deployments, changes to an API are automatically released for you. Use stage variables for HTTP APIs in API Gateway Stage variables are key-value pairs that you can define for a stage of an HTTP API. They act like environment variables and can be used in your API setup. Stage variables are not intended to be used for sensitive data, such as credentials. To pass sensitive data to integrations, use an AWS Lambda authorizer. You can pass sensitive data to integrations in the output of the Lambda authorizer. To learn more, see the section called “Lambda authorizer response format”. Example – Use a stage variable to customize the HTTP integration endpoint For example, you can define a stage variable, and then set its value as an HTTP endpoint for an HTTP proxy integration. Later, you can reference the endpoint by using the associated stage variable name. By doing this, you can use the same API setup with a different endpoint at each stage. Similarly, you can use stage variables to specify a different AWS Lambda function integration for each stage of your API. To use a stage variable to customize the HTTP integration endpoint, you must first set the name and value of the stage variable (for example, url) with a value of example.com. Next, set up an HTTP proxy integration. Instead of entering the endpoint's URL, you can tell API Gateway to use the stage variable value, http://${stageVariables.url}. This value tells API Gateway to substitute your stage variable ${} at runtime, depending on the stage of your API. You can reference stage variables in a similar way to specify a Lambda function name or an AWS role ARN. When specifying a Lambda function name as a stage variable value, you must configure the permissions on the Lambda function manually. The following add-permission command configures the permission for the Lambda function: aws lambda add-permission --function-name arn:aws:lambda:XXXXXX:your-lambda-function- name --source-arn arn:aws:execute-api:us-east-1:YOUR_ACCOUNT_ID:api_id/*/HTTP_METHOD/ resource --principal apigateway.amazonaws.com --statement-id apigateway-access --action lambda:InvokeFunction Stages 1128 Amazon API Gateway Developer Guide API Gateway stage variables reference for HTTP APIs in API Gateway You can use API Gateway stage variables for HTTP APIs in the following cases. HTTP integration URIs You can use a stage variable as part of an HTTP integration URI, as shown in the following examples. • A full URI without protocol – http://${stageVariables.<variable_name>} • A full domain – http://${stageVariables.<variable_name>}/resource/operation • A subdomain – http://${stageVariables.<variable_name>}.example.com/ resource/operation • A path – http://example.com/${stageVariables.<variable_name>}/bar • A query string – http://example.com/foo?q=${stageVariables.<variable_name>} Lambda functions You can use a stage variable in place of a Lambda function integration name or alias, as shown in the
apigateway-dg-305
apigateway-dg.pdf
305
API Gateway stage variables reference for HTTP APIs in API Gateway You can use API Gateway stage variables for HTTP APIs in the following cases. HTTP integration URIs You can use a stage variable as part of an HTTP integration URI, as shown in the following examples. • A full URI without protocol – http://${stageVariables.<variable_name>} • A full domain – http://${stageVariables.<variable_name>}/resource/operation • A subdomain – http://${stageVariables.<variable_name>}.example.com/ resource/operation • A path – http://example.com/${stageVariables.<variable_name>}/bar • A query string – http://example.com/foo?q=${stageVariables.<variable_name>} Lambda functions You can use a stage variable in place of a Lambda function integration name or alias, as shown in the following examples. • arn:aws:apigateway:<region>:lambda:path/2015-03-31/ functions/arn:aws:lambda:<region>:<account_id>:function: ${stageVariables.<function_variable_name>}/invocations • arn:aws:apigateway:<region>:lambda:path/2015-03-31/functions/ arn:aws:lambda:<region>:<account_id>:function:<function_name>: ${stageVariables.<version_variable_name>}/invocations Note To use a stage variable for a Lambda function, the function must be in the same account as the API. Stage variables don't support cross-account Lambda functions. AWS integration credentials You can use a stage variable as part of an AWS user or role credential ARN, as shown in the following example. Stages 1129 Amazon API Gateway Developer Guide • arn:aws:iam::<account_id>:${stageVariables.<variable_name>} Security policy for HTTP APIs in API Gateway API Gateway enforces a security policy of TLS_1_2 for all HTTP API endpoints. A security policy is a predefined combination of minimum TLS version and cipher suites offered by Amazon API Gateway. The TLS protocol addresses network security problems such as tampering and eavesdropping between a client and server. When your clients establish a TLS handshake to your API through the custom domain, the security policy enforces the TLS version and cipher suite options your clients can choose to use. This security policy accepts TLS 1.2 and TLS 1.3 traffic and rejects TLS 1.0 traffic. Supported TLS protocols and ciphers for HTTP APIs The following table describes the supported TLS protocols for HTTP APIs. TLS protocols TLSv1.3 TLSv1.2 TLS_1_2 security policy Yes Yes The following table describes the TLS ciphers that are available for the TLS 1_2 security policy for HTTP APIs. TLS ciphers TLS-AES-128-GCM-SHA256 TLS-AES-256-GCM-SHA384 TLS_1_2 security policy Yes Yes Security policy for HTTP APIs in API Gateway 1130 Amazon API Gateway TLS ciphers TLS-CHACHA20-POLY1305-SHA256 ECDHE-ECDSA-AES128-GCM-SHA256 ECDHE-RSA-AES128-GCM-SHA256 ECDHE-ECDSA-AES128-SHA256 ECDHE-RSA-AES128-SHA256 ECDHE-ECDSA-AES256-GCM-SHA384 ECDHE-RSA-AES256-GCM-SHA384 ECDHE-ECDSA-AES256-SHA384 ECDHE-RSA-AES256-SHA384 AES128-GCM-SHA256 AES128-SHA256 AES256-GCM-SHA384 Developer Guide TLS_1_2 security policy Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Security policy for HTTP APIs in API Gateway 1131 Amazon API Gateway TLS ciphers AES256-SHA256 Developer Guide TLS_1_2 security policy Yes OpenSSL and RFC cipher names OpenSSL and IETF RFC 5246 use different names for the same ciphers. For a list of the cipher names, see the section called “OpenSSL and RFC cipher names”. Information about REST APIs and WebSocket APIs For more information about REST APIs and WebSocket APIs, see the section called “Choose a security policy” and the section called “Security policy for WebSocket APIs in API Gateway”. Custom domain names for HTTP APIs in API Gateway Custom domain names are simpler and more intuitive URLs that you can provide to your API users. After deploying your API, you (and your customers) can invoke the API using the default base URL of the following format: https://api-id.execute-api.region.amazonaws.com/stage where api-id is generated by API Gateway, region is the AWS Region, and stage is specified by you when deploying the API. The hostname portion of the URL, api-id.execute-api.region.amazonaws.com refers to an API endpoint. The default API endpoint name is randomly generated, difficult to recall, and not user-friendly. With custom domain names, you can set up your API's hostname, and choose a base path (for example, myservice) to map the alternative URL to your API. For example, a more user-friendly API base URL can become: https://api.example.com/myservice Custom domain names 1132 Amazon API Gateway Considerations Developer Guide The following considerations might impact your use of a custom domain name. • A Regional custom domain name can be associated with REST APIs and HTTP APIs. You can use the API Gateway Version 2 APIs to create and manage Regional custom domain names for REST APIs. • For the minimum TLS version, only TLS 1.2 is supported. • You must create or update your DNS provider's resource record to map to your API endpoint. Without such a mapping, API requests bound for the custom domain name cannot reach API Gateway. • You can support an almost infinite number of domain names without exceeding the default quota by using a wildcard certificate. For more information, see the section called “Wildcard custom domain names”. Prerequisites The following are prerequisites for creating a custom domain name. Register a domain name You must have a registered internet domain name in order to set up custom domain names for your APIs. You can register your internet domain name using Amazon Route 53 or using a third- party domain registrar of your choice. Your custom domain name can be the name of a subdomain or the root
apigateway-dg-306
apigateway-dg.pdf
306
You can support an almost infinite number of domain names without exceeding the default quota by using a wildcard certificate. For more information, see the section called “Wildcard custom domain names”. Prerequisites The following are prerequisites for creating a custom domain name. Register a domain name You must have a registered internet domain name in order to set up custom domain names for your APIs. You can register your internet domain name using Amazon Route 53 or using a third- party domain registrar of your choice. Your custom domain name can be the name of a subdomain or the root domain (also known as the "zone apex") of a registered internet domain. Your domain name must follow the RFC 1035 specification and can have a maximum of 63 octets per label and 255 octets in total. Certificates for custom domain names Before setting up a custom domain name for an API, you must have an SSL/TLS certificate ready in ACM. If ACM is not available in the AWS Region where you are creating your custom domain name, you must import a certificate to API Gateway in that Region. To import an SSL/TLS certificate, you must provide the PEM-formatted SSL/TLS certificate body, its private key, and the certificate chain for the custom domain name. Custom domain names 1133 Amazon API Gateway Developer Guide Each certificate stored in ACM is identified by its ARN. With certificates issued by ACM, you do not have to worry about exposing any sensitive certificate details, such as the private key. To use an AWS managed certificate for a domain name, you simply reference its ARN. If your application uses certificate pinning, sometimes known as SSL pinning, to pin an ACM certificate, the application might not be able to connect to your domain after AWS renews the certificate. For more information, see Certificate pinning problems in the AWS Certificate Manager User Guide. Wildcard custom domain names With wildcard custom domain names, you can support an almost infinite number of domain names without exceeding the default quota. For example, you could give each of your customers their own domain name, customername.api.example.com. To create a wildcard custom domain name, specify a wildcard (*) as the first subdomain of a custom domain that represents all possible subdomains of a root domain. For example, the wildcard custom domain name *.example.com results in subdomains such as a.example.com, b.example.com, and c.example.com, which all route to the same domain. Wildcard custom domain names support distinct configurations from API Gateway's standard custom domain names. For example, in a single AWS account, you can configure *.example.com and a.example.com to behave differently. To create a wildcard custom domain name, you must provide a certificate issued by ACM that has been validated using either the DNS or the email validation method. Note You can't create a wildcard custom domain name if a different AWS account has created a custom domain name that conflicts with the wildcard custom domain name. For example, if account A has created a.example.com, then account B can't create the wildcard custom domain name *.example.com. If account A and account B share an owner, you can contact the AWS Support Center to request an exception. Custom domain names 1134 Amazon API Gateway Developer Guide Next steps for custom domain names To set up a custom domain name for an HTTP API, you use documentation from the REST API section of the API Gateway Developer Guide. First, specify a certificate for your custom domain name. For more information, see the section called “Get certificates ready in AWS Certificate Manager”. Next, you create a Regional custom domain name. For more information, see the section called “Set up a Regional custom domain name”. Map API stages to a custom domain name for HTTP APIs You use API mappings to connect API stages to a custom domain name. After you create a domain name and configure DNS records, you use API mappings to send traffic to your APIs through your custom domain name. An API mapping specifies an API, a stage, and optionally a path to use for the mapping. For example, you can map the production stage of an API to https://api.example.com/orders. You can map HTTP and REST API stages to the same custom domain name. Before you create an API mapping, you must have an API, a stage, and a custom domain name. To learn more about creating a custom domain name, see the section called “Set up a Regional custom domain name”. Routing API requests You can configure API mappings with multiple levels, for example orders/v1/items and orders/v2/items. For API mappings with multiple levels, API Gateway routes requests to the API mapping that has the longest matching path. API Gateway considers only the paths configured for API mappings, and not API routes, to select the API
apigateway-dg-307
apigateway-dg.pdf
307
API stages to the same custom domain name. Before you create an API mapping, you must have an API, a stage, and a custom domain name. To learn more about creating a custom domain name, see the section called “Set up a Regional custom domain name”. Routing API requests You can configure API mappings with multiple levels, for example orders/v1/items and orders/v2/items. For API mappings with multiple levels, API Gateway routes requests to the API mapping that has the longest matching path. API Gateway considers only the paths configured for API mappings, and not API routes, to select the API to invoke. If no path matches the request, API Gateway sends the request to the API that you've mapped to the empty path (none). For custom domain names that use API mappings with multiple levels, API Gateway routes requests to the API mapping that has the longest matching prefix. For example, consider a custom domain name https://api.example.com with the following API mappings: 1. (none) mapped to API 1. Custom domain names 1135 Amazon API Gateway 2. orders mapped to API 2. 3. orders/v1/items mapped to API 3. 4. orders/v2/items mapped to API 4. 5. orders/v2/items/categories mapped to API 5. Developer Guide Request Selected API Explanation https://api.exampl API 2 e.com/orders https://api.exampl API 3 e.com/orders/v1/it ems https://api.exampl API 4 e.com/orders/v2/it ems https://api.exampl API 3 e.com/orders/v1/it ems/123 https://api.exampl API 5 e.com/orders/v2/it ems/categories/5 https://api.exampl API 1 e.com/customers https://api.exampl API 2 e.com/ordersandmore The request exactly matches this API mapping. The request exactly matches this API mapping. The request exactly matches this API mapping. API Gateway chooses the mapping that has the longest matching path. The 123 at the end of the request doesn't affect the selection. API Gateway chooses the mapping that has the longest matching path. API Gateway uses the empty mapping as a catch-all. API Gateway chooses the mapping that has the longest matching prefix. For a custom domain name configured with single-le Custom domain names 1136 Amazon API Gateway Developer Guide Request Selected API Explanation vel mappings, such as only https://api.exampl e.com/orders and https://api.exampl e.com/ , API Gateway would choose API 1, as there is no matching path with ordersandmore . Restrictions • In an API mapping, the custom domain name and mapped APIs must be in the same AWS account. • API mappings must contain only letters, numbers, and the following characters: $-_.+!*'()/. • The maximum length for the path in an API mapping is 300 characters. • You can have 200 API mappings with multiple levels for each domain name. This limit doesn't include API mapping with single levels, such as /prod. • You can only map HTTP APIs to a regional custom domain name with the TLS 1.2 security policy. • You can't map WebSocket APIs to the same custom domain name as an HTTP API or REST API. • If you create an API mappings with multiple levels, API Gateway converts all header names to lowercase. Create an API mapping To create an API mapping, you must first create a custom domain name, API, and stage. For information about creating a custom domain name, see the section called “Set up a Regional custom domain name”. For example AWS Serverless Application Model templates that create all resources, see Sessions With SAM on GitHub. Custom domain names 1137 Amazon API Gateway AWS Management Console To create an API mapping Developer Guide 1. Sign in to the API Gateway console at https://console.aws.amazon.com/apigateway. 2. Choose Custom domain names. 3. Select a custom domain name that you've already created. 4. Choose API mappings. 5. Choose Configure API mappings. 6. Choose Add new mapping. 7. Enter an API, a Stage, and optionally a Path. 8. Choose Save. AWS CLI The following create-api-mapping command creates an API mapping. In this example, API Gateway sends requests to api.example.com/v1/orders to the specified API and stage. aws apigatewayv2 create-api-mapping \ --domain-name api.example.com \ --api-mapping-key v1/orders \ --api-id a1b2c3d4 \ --stage test AWS CloudFormation The following AWS CloudFormation example creates an API mapping. MyApiMapping: Type: 'AWS::ApiGatewayV2::ApiMapping' Properties: DomainName: api.example.com ApiMappingKey: 'orders/v2/items' ApiId: !Ref MyApi Stage: !Ref MyStage Custom domain names 1138 Amazon API Gateway Developer Guide Disable the default endpoint for HTTP APIs By default, clients can invoke your API by using the execute-api endpoint that API Gateway generates for your API. To ensure that clients can access your API only by using a custom domain name, disable the default execute-api endpoint. When you disable the default endpoint, it affects all stages of an API. The following procedure shows how to disable the default endpoint for an HTTP API. AWS Management Console 1. Sign in to the API Gateway console at https://console.aws.amazon.com/apigateway. 2. Choose an HTTP API. 3. Choose your API's ID to open the API details page. 4. On API details, choose Edit. 5. For Default endpoint, select
apigateway-dg-308
apigateway-dg.pdf
308
API by using the execute-api endpoint that API Gateway generates for your API. To ensure that clients can access your API only by using a custom domain name, disable the default execute-api endpoint. When you disable the default endpoint, it affects all stages of an API. The following procedure shows how to disable the default endpoint for an HTTP API. AWS Management Console 1. Sign in to the API Gateway console at https://console.aws.amazon.com/apigateway. 2. Choose an HTTP API. 3. Choose your API's ID to open the API details page. 4. On API details, choose Edit. 5. For Default endpoint, select Disable. 6. Choose Save. If you turn on automatic deployments for your stage, you do not need to redeploy your API for the change to take effect. Otherwise, you must redeploy your API. 7. (Optional) Choose Deploy, and then redeploy your API or create a new stage for the change to take effect. AWS CLI The following update-domain-name command disables the default endpoint for an HTTP API: aws apigatewayv2 update-api \ --api-id abcdef123 \ --disable-execute-api-endpoint After you disable the default endpoint, you must deploy your API for the change to take effect, unless automatic deployments are enabled. The following create-deployment command creates a deployment: aws apigatewayv2 create-deployment \ --api-id abcdef123 \ Custom domain names 1139 Amazon API Gateway --stage-name dev Developer Guide IP address types for custom domain names for HTTP APIs When you create an API, you specify the type of IP addresses that can invoke your domain. You can choose IPv4 to allow IPv4 addresses to invoke your domain, or you can choose dualstack to allow both IPv4 and IPv6 addresses to invoke your domain. We recommend that you set the IP address type to dualstack to alleviate IP space exhaustion or for your security posture. For more information about the benefits of a dualstack IP address type, see IPv6 on AWS. Considerations for IP address types The following considerations might impact your use of IP address types. • The default IP address type for API Gateway custom domain names is IPv4. • Your custom domain name doesn't need to have the same IP address type for all APIs mapped to it. If you disable your default API endpoint, this might affect how callers can invoke your API. Change the IP address type of a custom domain name You can change the IP address type by updating the domain’s endpoint configuration. You can update the domain's endpoint configuration by using the AWS Management Console, the AWS CLI, AWS CloudFormation, or an AWS SDK. AWS Management Console To change the IP address type of a custom domain name 1. Sign in to the API Gateway console at https://console.aws.amazon.com/apigateway. 2. Choose a public custom domain name. 3. Choose Endpoint configuration. 4. For IP address type, select either IPv4 or Dualstack. 5. Choose Save. AWS CLI The following update-domain-name command updates an API to have an IP address type of dualstack: Custom domain names 1140 Amazon API Gateway Developer Guide aws apigatewayv2 update-domain-name \ --domain-name dualstack.example.com \ --domain-name-configurations CertificateArn=arn:aws:acm:us- east-1:111122223333:certificate/abcd1234-5678-abc,IpAddressType=dualstack The output will look like the following: { "ApiMappingSelectionExpression": "$request.basepath", "DomainName": "dualstack.elliesf.people.aws.dev", "DomainNameConfigurations": [ { "ApiGatewayDomainName": "d-abcd1234.execute-api.us- east-1.amazonaws.com", "CertificateArn": "arn:aws:acm:us-east-1:111122223333:certificate/ abcd1234-5678-abc", "DomainNameStatus": "AVAILABLE", "EndpointType": "REGIONAL", "HostedZoneId": "Z3LQWSYCGH4ADY", "SecurityPolicy": "TLS_1_2", "IpAddressType": "dualstack" } ], "Tags": {} } Protect your HTTP APIs in API Gateway API Gateway provides a number of ways to protect your API from certain threats, like malicious users or spikes in traffic. You can protect your API using strategies like setting throttling targets, and enabling mutual TLS. In this section you can learn how to enable these capabilities using API Gateway. Topics • Throttle requests to your HTTP APIs for better throughput in API Gateway • How to turn on mutual TLS authentication for your HTTP APIs in API Gateway Protect 1141 Amazon API Gateway Developer Guide Throttle requests to your HTTP APIs for better throughput in API Gateway You can configure throttling for your APIs to help protect them from being overwhelmed by too many requests. Throttles are applied on a best-effort basis and should be thought of as targets rather than guaranteed request ceilings. API Gateway throttles requests to your API using the token bucket algorithm, where a token counts for a request. Specifically, API Gateway examines the rate and a burst of request submissions against all APIs in your account, per Region. In the token bucket algorithm, a burst can allow pre- defined overrun of those limits, but other factors can also cause limits to be overrun in some cases. When request submissions exceed the steady-state request rate and burst limits, API Gateway begins to throttle requests. Clients may receive 429 Too Many Requests error responses at this point. Upon catching such exceptions, the client can resubmit the failed requests in a way that is rate
apigateway-dg-309
apigateway-dg.pdf
309
a token counts for a request. Specifically, API Gateway examines the rate and a burst of request submissions against all APIs in your account, per Region. In the token bucket algorithm, a burst can allow pre- defined overrun of those limits, but other factors can also cause limits to be overrun in some cases. When request submissions exceed the steady-state request rate and burst limits, API Gateway begins to throttle requests. Clients may receive 429 Too Many Requests error responses at this point. Upon catching such exceptions, the client can resubmit the failed requests in a way that is rate limiting. As an API developer, you can set the target limits for individual API stages or routes to improve overall performance across all APIs in your account. Account-level throttling per Region By default, API Gateway limits the steady-state requests per second (RPS) across all APIs within an AWS account, per Region. It also limits the burst (that is, the maximum bucket size) across all APIs within an AWS account, per Region. In API Gateway, the burst limit represents the target maximum number of concurrent request submissions that API Gateway will fulfill before returning 429 Too Many Requests error responses. For more information on throttling quotas, see Quotas and important notes. Per-account limits are applied to all APIs in an account in a specified Region. The account-level rate limit can be increased upon request - higher limits are possible with APIs that have shorter timeouts and smaller payloads. To request an increase of account-level throttling limits per Region, contact the AWS Support Center. For more information, see Quotas and important notes. Note that these limits can't be higher than the AWS throttling limits. Route-level throttling You can set route-level throttling to override the account-level request throttling limits for a specific stage or for individual routes in your API. The default route throttling limits can't exceed account-level rate limits. Throttling 1142 Amazon API Gateway Developer Guide You can configure route-level throttling by using the AWS CLI. The following update-stage command configures custom throttling for the specified stage and route of an API: aws apigatewayv2 update-stage \ --api-id a1b2c3d4 \ --stage-name dev \ --route-settings '{"GET /pets": {"ThrottlingBurstLimit":100,"ThrottlingRateLimit":2000}}' How to turn on mutual TLS authentication for your HTTP APIs in API Gateway Mutual TLS authentication requires two-way authentication between the client and the server. With mutual TLS, clients must present X.509 certificates to verify their identity to access your API. Mutual TLS is a common requirement for Internet of Things (IoT) and business-to-business applications. You can use mutual TLS along with other authorization and authentication operations that API Gateway supports. API Gateway forwards the certificates that clients provide to Lambda authorizers and to backend integrations. Important By default, clients can invoke your API by using the execute-api endpoint that API Gateway generates for your API. To ensure that clients can access your API only by using a custom domain name with mutual TLS, disable the default execute-api endpoint. To learn more, see the section called “Disable the default endpoint”. Prerequisites for mutual TLS To configure mutual TLS you need: • A custom domain name • At least one certificate configured in AWS Certificate Manager for your custom domain name • A truststore configured and uploaded to Amazon S3 Mutual TLS 1143 Amazon API Gateway Custom domain names Developer Guide To enable mutual TLS for a HTTP API, you must configure a custom domain name for your API. You can enable mutual TLS for a custom domain name, and then provide the custom domain name to clients. To access an API by using a custom domain name that has mutual TLS enabled, clients must present certificates that you trust in API requests. You can find more information at the section called “Custom domain names”. Using AWS Certificate Manager issued certificates You can request a publicly trusted certificate directly from ACM or import public or self-signed certificates. To setup a certificate in ACM, go to ACM. If you would like to import a certificate, continue reading in the following section. Using an imported or AWS Private Certificate Authority certificate To use a certificate imported into ACM or a certificate from AWS Private Certificate Authority with mutual TLS, API Gateway needs an ownershipVerificationCertificate issued by ACM. This ownership certificate is only used to verify that you have permissions to use the domain name. It is not used for the TLS handshake. If you don't already have a ownershipVerificationCertificate, go to https://console.aws.amazon.com/acm/ to set one up. You will need to keep this certificate valid for the lifetime of your domain name. If a certificate expires and auto-renew fails, all updates to the domain name will be locked. You will need to update the ownershipVerificationCertificateArn with a valid ownershipVerificationCertificate before you can make any other changes. The ownershipVerificationCertificate cannot
apigateway-dg-310
apigateway-dg.pdf
310
TLS, API Gateway needs an ownershipVerificationCertificate issued by ACM. This ownership certificate is only used to verify that you have permissions to use the domain name. It is not used for the TLS handshake. If you don't already have a ownershipVerificationCertificate, go to https://console.aws.amazon.com/acm/ to set one up. You will need to keep this certificate valid for the lifetime of your domain name. If a certificate expires and auto-renew fails, all updates to the domain name will be locked. You will need to update the ownershipVerificationCertificateArn with a valid ownershipVerificationCertificate before you can make any other changes. The ownershipVerificationCertificate cannot be used as a server certificate for another mutual TLS domain in API Gateway. If a certificate is directly re-imported into ACM, the issuer must stay the same. Configuring your truststore Truststores are text files with a .pem file extension. They are a trusted list of certificates from Certificate Authorities. To use mutual TLS, create a truststore of X.509 certificates that you trust to access your API. You must include the complete chain of trust, starting from the issuing CA certificate, up to the root CA certificate, in your truststore. API Gateway accepts client certificates issued by any CA Mutual TLS 1144 Amazon API Gateway Developer Guide present in the chain of trust. The certificates can be from public or private certificate authorities. Certificates can have a maximum chain length of four. You can also provide self-signed certificates. The following hashing algorithms are supported in the truststore: • SHA-256 or stronger • RSA-2048 or stronger • ECDSA-256 or stronger API Gateway validates a number of certificate properties. You can use Lambda authorizers to perform additional checks when a client invokes an API, including checking whether a certificate has been revoked. API Gateway validates the following properties: Validation X.509 syntax Integrity Validity Name chaining / key chaining Description The certificate must meet X.509 syntax requirements. The certificate's content must not have been altered from that signed by the certificate authority from the truststore. The certificate's validity period must be current. The names and subjects of certificates must form an unbroken chain. Certificates can have a maximum chain length of four. Upload the truststore to an Amazon S3 bucket in a single file Example certificates.pem -----BEGIN CERTIFICATE----- <Certificate contents> -----END CERTIFICATE----- -----BEGIN CERTIFICATE----- <Certificate contents> -----END CERTIFICATE----- Mutual TLS 1145 Amazon API Gateway Developer Guide -----BEGIN CERTIFICATE----- <Certificate contents> -----END CERTIFICATE----- ... The following cp AWS CLI command uploads certificates.pem to your Amazon S3 bucket: aws s3 cp certificates.pem s3://bucket-name Configuring mutual TLS for a custom domain name To configure mutual TLS for a HTTP API, you must use a Regional custom domain name for your API, with a minimum TLS version of 1.2. To learn more about creating and configuring a custom domain name, see the section called “Set up a Regional custom domain name”. Note Mutual TLS isn't supported for private APIs. After you've uploaded your truststore to Amazon S3, you can configure your custom domain name to use mutual TLS. The following create-domain-name creates a custom domain name with mutual TLS: aws apigatewayv2 create-domain-name \ --domain-name api.example.com \ --domain-name-configurations CertificateArn=arn:aws:acm:us- west-2:123456789012:certificate/123456789012-1234-1234-1234-12345678 \ --mutual-tls-authentication TruststoreUri=s3://bucket-name/key-name After you create the domain name, you must configure DNS records and basepath mappings for API operations. To learn more, see Set up a Regional custom domain name in API Gateway. Invoke an API by using a custom domain name that requires mutual TLS To invoke an API with mutual TLS enabled, clients must present a trusted certificate in the API request. When a client attempts to invoke your API, API Gateway looks for the client certificate's issuer in your truststore. For API Gateway to proceed with the request, the certificate's issuer and the complete chain of trust up to the root CA certificate must be in your truststore. Mutual TLS 1146 Amazon API Gateway Developer Guide The following example curl command sends a request to api.example.com, that includes my- cert.pem in the request. my-key.key is the private key for the certificate. curl -v --key ./my-key.key --cert ./my-cert.pem api.example.com Your API is invoked only if your truststore trusts the certificate. The following conditions will cause API Gateway to fail the TLS handshake and deny the request with a 403 status code. If your certificate: • isn't trusted • is expired • doesn't use a supported algorithm Note API Gateway doesn't verify if a certificate has been revoked. Updating your truststore To update the certificates in your truststore, upload a new certificate bundle to Amazon S3. Then, you can update your custom domain name to use the updated certificate. Use Amazon S3 versioning to maintain multiple versions of your truststore. When you update your custom domain name to use a new truststore version, API Gateway returns warnings if certificates are invalid. API Gateway produces certificate warnings
apigateway-dg-311
apigateway-dg.pdf
311
request with a 403 status code. If your certificate: • isn't trusted • is expired • doesn't use a supported algorithm Note API Gateway doesn't verify if a certificate has been revoked. Updating your truststore To update the certificates in your truststore, upload a new certificate bundle to Amazon S3. Then, you can update your custom domain name to use the updated certificate. Use Amazon S3 versioning to maintain multiple versions of your truststore. When you update your custom domain name to use a new truststore version, API Gateway returns warnings if certificates are invalid. API Gateway produces certificate warnings only when you update your domain name. API Gateway doesn’t notify you if a previously uploaded certificate expires. The following update-domain-name command updates a custom domain name to use a new truststore version: aws apigatewayv2 update-domain-name \ --domain-name api.example.com \ --domain-name-configurations CertificateArn=arn:aws:acm:us- west-2:123456789012:certificate/123456789012-1234-1234-1234-12345678 \ --mutual-tls-authentication TruststoreVersion='abcdef123' Mutual TLS 1147 Amazon API Gateway Disable mutual TLS Developer Guide To disable mutual TLS for a custom domain name, remove the truststore from your custom domain name, as shown in the following command. The following update-domain-name command updates a custom domain name to remove the truststore from your custom domain name: aws apigatewayv2 update-domain-name \ --domain-name api.example.com \ --domain-name-configurations CertificateArn=arn:aws:acm:us- west-2:123456789012:certificate/123456789012-1234-1234-1234-12345678 \ --mutual-tls-authentication TruststoreUri='' Troubleshoot mutual TLS for your HTTP API The following provides troubleshooting advice for errors and issues that you might encounter when turning on mutual TLS. Troubleshooting certificate warnings When creating a custom domain name with mutual TLS, API Gateway returns warnings if certificates in the truststore are not valid. This can also occur when updating a custom domain name to use a new truststore. The warnings indicate the issue with the certificate and the subject of the certificate that produced the warning. Mutual TLS is still enabled for your API, but some clients might not be able to access your API. You'll need to decode the certificates in your truststore in order to identify which certificate produced the warning. You can use tools such as openssl to decode the certificates and identify their subjects. The following command displays the contents of a certificate, including its subject: openssl x509 -in certificate.crt -text -noout Update or remove the certificates that produced warnings, and then upload a new truststore to Amazon S3. After uploading the new truststore, update your custom domain name to use the new truststore. Mutual TLS 1148 Amazon API Gateway Developer Guide Troubleshooting domain name conflicts The error "The certificate subject <certSubject> conflicts with an existing certificate from a different issuer." means multiple Certificate Authorities have issued a certificate for this domain. For each subject in the certificate, there can only be one issuer in API Gateway for mutual TLS domains. You will need to get all of your certificates for that subject through a single issuer. If the problem is with a certificate you don't have control of but you can prove ownership of the domain name, contact Support to open a ticket. Troubleshooting domain name status messages PENDING_CERTIFICATE_REIMPORT: This means you reimported a certificate to ACM and it failed validation because the new certificate has a SAN (subject alternative name) that is not covered by the ownershipVerificationCertificate or the subject or SANs in the certificate don't cover the domain name. Something might be configured incorrectly or an invalid certificate was imported. You need to reimport a valid certificate into ACM. For more information about validation see Validating domain ownership. PENDING_OWNERSHIP_VERIFICATION: This means your previously verified certificate has expired and ACM was unable to auto-renew it. You will need to renew the certificate or request a new certificate. More information about certificate renewal can be found at ACM's troubleshooting managed certificate renewal guide. Monitor HTTP APIs in API Gateway You can use CloudWatch metrics and CloudWatch Logs to monitor HTTP APIs. By combining logs and metrics, you can log errors and monitor your API's performance. Note API Gateway might not generate logs and metrics in the following cases: • 413 Request Entity Too Large errors • Excessive 429 Too Many Requests errors • 400 series errors from requests sent to a custom domain that has no API mapping • 500 series errors caused by internal failures Topics Monitor 1149 Amazon API Gateway Developer Guide • Monitor CloudWatch metrics for HTTP APIs in API Gateway • Configure logging for HTTP APIs in API Gateway Monitor CloudWatch metrics for HTTP APIs in API Gateway You can monitor API execution by using CloudWatch, which collects and processes raw data from API Gateway into readable, near-real-time metrics. These statistics are recorded for a period of 15 months so you can access historical information and gain a better perspective on how your web application or service is performing. By default, API Gateway metric data is automatically sent to CloudWatch in one-minute periods. To
apigateway-dg-312
apigateway-dg.pdf
312
1149 Amazon API Gateway Developer Guide • Monitor CloudWatch metrics for HTTP APIs in API Gateway • Configure logging for HTTP APIs in API Gateway Monitor CloudWatch metrics for HTTP APIs in API Gateway You can monitor API execution by using CloudWatch, which collects and processes raw data from API Gateway into readable, near-real-time metrics. These statistics are recorded for a period of 15 months so you can access historical information and gain a better perspective on how your web application or service is performing. By default, API Gateway metric data is automatically sent to CloudWatch in one-minute periods. To monitor your metrics, create a CloudWatch dashboard for your API. For more information about how to create a CloudWatch dashboard, see Creating a CloudWatch dashboard in the Amazon CloudWatch User Guide. For more information, see What Is Amazon CloudWatch? in the Amazon CloudWatch User Guide. The following metrics are supported for HTTP APIs. You can also enable detailed metrics to write route-level metrics to Amazon CloudWatch. Metric 4xx 5xx Count IntegrationLatency Latency Metrics Description The number of client-side errors captured in a given period. The number of server-side errors captured in a given period. The total number API requests in a given period. The time between when API Gateway relays a request to the backend and when it receives a response from the backend. The time between when API Gateway receives a request 1150 Amazon API Gateway Metric DataProcessed Developer Guide Description from a client and when it returns a response to the client. The latency includes the integration latency and other API Gateway overhead. The amount of data processed in bytes. You can use the dimensions in the following table to filter API Gateway metrics. Dimension ApiId ApiId, Stage ApiId, Method, Resource, Stage Description Filters API Gateway metrics for an API with the specified API ID. Filters API Gateway metrics for an API stage with the specified API ID and stage ID. Filters API Gateway metrics for an API method with the specified API ID, stage ID, resource path, and route ID. API Gateway will not send these metrics unless you have explicitly enabled detailed CloudWatch metrics. You can do this by calling the UpdateStage action of the API Gateway V2 REST API to update the detailedM etricsEnabled property Metrics 1151 Amazon API Gateway Dimension Developer Guide Description to true. Alternatively, you can call the update-stage AWS CLI command to update the DetailedMetricsEna bled property to true. Enabling such metrics will incur additional charges to your account. For pricing information, see Amazon CloudWatch Pricing. Configure logging for HTTP APIs in API Gateway You can turn on logging to write logs to CloudWatch Logs. You can use logging variables to customize the content of your logs. To improve your security posture, we recommend that you write logs to CloudWatch Logs for all stages of your HTTP API. You might need to do this to comply with various compliance frameworks. For more information, see Amazon API Gateway controls in the AWS Security Hub User Guide. To turn on logging for an HTTP API, you must do the following. 1. Ensure that your user has the required permissions to activate logging. 2. Create a CloudWatch Logs log group. 3. Provide the ARN of the CloudWatch Logs log group for a stage of your API. Permissions to activate logging To turn on logging for an API, your user must have the following permissions. Example { "Version": "2012-10-17", "Statement": [ Logging 1152 Amazon API Gateway { "Effect": "Allow", "Action": [ "logs:DescribeLogGroups", "logs:DescribeLogStreams", "logs:GetLogEvents", "logs:FilterLogEvents" ], "Resource": "arn:aws:logs:us-east-2:123456789012:log-group:*" Developer Guide }, { "Effect": "Allow", "Action": [ "logs:CreateLogDelivery", "logs:PutResourcePolicy", "logs:UpdateLogDelivery", "logs:DeleteLogDelivery", "logs:CreateLogGroup", "logs:DescribeResourcePolicies", "logs:GetLogDelivery", "logs:ListLogDeliveries" ], "Resource": "*" } ] } Create a log group and activate logging for HTTP APIs You can create a log group and activate access logging using the AWS Management Console or the AWS CLI. AWS Management Console 1. Create a log group. To learn how to create a log group using the console, see Create a Log Group in Amazon CloudWatch Logs User Guide. 2. Sign in to the API Gateway console at https://console.aws.amazon.com/apigateway. 3. Choose an HTTP API. Logging 1153 Amazon API Gateway Developer Guide 4. Under the Monitor tab in the primary navigation panel, choose Logging. 5. Select a stage to activate logging and choose Select. 6. Choose Edit to activate access logging. 7. Turn on Access logging, enter a CloudWatch Logs, and select a log format. 8. Choose Save. AWS CLI The following create-log-group command creates a log group: aws logs create-log-group --log-group-name my-log-group You need the Amazon Resource Name (ARN) for your log group to turn on logging. The ARN format is arn:aws:logs:region:account-id:log-group:log-group-name. The following update-stage command turns on logging for the $default stage of an HTTP API: aws apigatewayv2 update-stage --api-id abcdef \ --stage-name '$default'
apigateway-dg-313
apigateway-dg.pdf
313
tab in the primary navigation panel, choose Logging. 5. Select a stage to activate logging and choose Select. 6. Choose Edit to activate access logging. 7. Turn on Access logging, enter a CloudWatch Logs, and select a log format. 8. Choose Save. AWS CLI The following create-log-group command creates a log group: aws logs create-log-group --log-group-name my-log-group You need the Amazon Resource Name (ARN) for your log group to turn on logging. The ARN format is arn:aws:logs:region:account-id:log-group:log-group-name. The following update-stage command turns on logging for the $default stage of an HTTP API: aws apigatewayv2 update-stage --api-id abcdef \ --stage-name '$default' \ --access-log-settings '{"DestinationArn": "arn:aws:logs:region:account- id:log-group:log-group-name", "Format": "$context.identity.sourceIp - - [$context.requestTime] \"$context.httpMethod $context.routeKey $context.protocol\" $context.status $context.responseLength $context.requestId"}' Example log formats Examples of some common access log formats are available in the API Gateway console and are listed as follows. • CLF (Common Log Format): $context.identity.sourceIp - - [$context.requestTime] "$context.httpMethod $context.routeKey $context.protocol" $context.status $context.responseLength $context.requestId $context.extendedRequestId • JSON: Logging 1154 Amazon API Gateway Developer Guide { "requestId":"$context.requestId", "ip": "$context.identity.sourceIp", "requestTime":"$context.requestTime", "httpMethod":"$context.httpMethod","routeKey":"$context.routeKey", "status":"$context.status","protocol":"$context.protocol", "responseLength":"$context.responseLength", "extendedRequestId": "$context.extendedRequestId" } • XML: <request id="$context.requestId"> <ip>$context.identity.sourceIp</ip> <requestTime> $context.requestTime</requestTime> <httpMethod>$context.httpMethod</httpMethod> <routeKey>$context.routeKey</routeKey> <status>$context.status</status> <protocol> $context.protocol</protocol> <responseLength>$context.responseLength</responseLength> <extendedRequestId>$context.extendedRequestId</extendedRequestId> </request> • CSV (comma-separated values): $context.identity.sourceIp,$context.requestTime,$context.httpMethod, $context.routeKey,$context.protocol,$context.status,$context.responseLength, $context.requestId,$context.extendedRequestId Customize HTTP API access logs You can use the following variables to customize HTTP API access logs. To learn more about access logs for HTTP APIs, see Configure logging for HTTP APIs in API Gateway. Parameter Description $context.accountId The API owner's AWS account ID. $context.apiId The identifier API Gateway assigns to your API. $context.authorizer.claims. property A property of the claims returned from the JSON Web Token (JWT) after the method caller is successfully authenticated, such as $context.authorizer.claims. username . For more information, see Control access to HTTP APIs with JWT authorizers in API Gateway. Logging 1155 Amazon API Gateway Parameter Developer Guide Description Note Calling $context.authorize r.claims returns null. $context.authorizer.error The error message returned from an authorize r. $context.authorizer. property The value of the specified key-value pair of the context map returned from an API Gateway Lambda authorizer function. For example, if the authorizer returns the following context map: "context" : { "key": "value", "numKey": 1, "boolKey": true } calling $context.authorizer.key returns the "value" string, calling $context.authorizer.numKey the 1, and calling $context.authorize r.boolKey returns true. returns The AWS endpoint's request ID from the x- amz-request-id or x-amzn-requestId header. The AWS endpoint's request ID from the x- amz-id-2 header. $context.awsEndpointRequestId $context.awsEndpointRequestId2 Logging 1156 Amazon API Gateway Parameter $context.customDomain.baseP athMatched Developer Guide Description The path for an API mapping that an incoming request matched. Applicable when a client uses a custom domain name to access an API. For example if a client sends a request to https://api.example.com/v1/ orders/1234 , and the request matches the API mapping with the path v1/orders , the value is v1/orders . To learn more, see the section called “API mappings”. $context.dataProcessed The amount of data processed in bytes. $context.domainName $context.domainPrefix $context.error.message $context.error.messageString $context.error.responseType The full domain name used to invoke the API. This should be the same as the incoming Host header. The first label of the $context.domainNam e . A string that contains an API Gateway error message. The quoted value of $context.error.mes sage , namely "$context.error.me ssage" . A type of GatewayResponse . For more information, see the section called “Metrics” and the section called “Setting up gateway responses to customize error responses”. $context.extendedRequestId Equivalent to $context.requestId . $context.httpMethod The HTTP method used. Valid values include: DELETE, GET, HEAD, OPTIONS, PATCH, POST, and PUT. Logging 1157 Amazon API Gateway Parameter $context.identity.accountId $context.identity.caller $context.identity.cognitoAu thenticationProvider $context.identity.cognitoAu thenticationType Developer Guide Description The AWS account ID associated with the request. Supported for routes that use IAM authorization. The principal identifier of the caller that signed the request. Supported for routes that use IAM authorization. A comma-separated list of all the Amazon Cognito authentication providers used by the caller making the request. Available only if the request was signed with Amazon Cognito credentials. For example, for an identity from an Amazon Cognito user pool, cognito-idp. region.amazonaws.com/ user_pool _id ,cognito-idp. region.amazonaw s.com/ user_pool_id :CognitoS ignIn: token subject claim For information about the available Amazon Cognito authentication providers, see Using Federated Identities in the Amazon Cognito Developer Guide. The Amazon Cognito authentication type of the caller making the request. Available only if the request was signed with Amazon Cognito credentials. Possible values include authenticated for authenticated identities and unauthenticated for unauthenticated identities. Logging 1158 Amazon API Gateway Parameter $context.identity.cognitoId entityId $context.identity.cognitoId entityPoolId Developer Guide Description The Amazon Cognito identity ID of the caller making the request. Available only if the request was signed with Amazon Cognito credentials. The Amazon Cognito identity pool ID of the caller making the request. Available only if the request was signed with Amazon Cognito credentials. $context.identity.principalOrgId The AWS organization ID. Supported for routes that use IAM authorization. $context.identity.clientCer t.clientCertPem $context.identity.clientCer
apigateway-dg-314
apigateway-dg.pdf
314
caller making the request. Available only if the request was signed with Amazon Cognito credentials. Possible values include authenticated for authenticated identities and unauthenticated for unauthenticated identities. Logging 1158 Amazon API Gateway Parameter $context.identity.cognitoId entityId $context.identity.cognitoId entityPoolId Developer Guide Description The Amazon Cognito identity ID of the caller making the request. Available only if the request was signed with Amazon Cognito credentials. The Amazon Cognito identity pool ID of the caller making the request. Available only if the request was signed with Amazon Cognito credentials. $context.identity.principalOrgId The AWS organization ID. Supported for routes that use IAM authorization. $context.identity.clientCer t.clientCertPem $context.identity.clientCer t.subjectDN $context.identity.clientCer t.issuerDN $context.identity.clientCer t.serialNumber The PEM-encoded client certificate that the client presented during mutual TLS authentic ation. Present when a client accesses an API by using a custom domain name that has mutual TLS enabled. The distinguished name of the subject of the certificate that a client presents. Present when a client accesses an API by using a custom domain name that has mutual TLS enabled. The distinguished name of the issuer of the certificate that a client presents. Present when a client accesses an API by using a custom domain name that has mutual TLS enabled. The serial number of the certificate. Present when a client accesses an API by using a custom domain name that has mutual TLS enabled. Logging 1159 Amazon API Gateway Parameter $context.identity.clientCer t.validity.notBefore $context.identity.clientCer t.validity.notAfter $context.identity.sourceIp $context.identity.user Developer Guide Description The date before which the certificate is invalid. Present when a client accesses an API by using a custom domain name that has mutual TLS enabled. The date after which the certificate is invalid. Present when a client accesses an API by using a custom domain name that has mutual TLS enabled. The source IP address of the immediate TCP connection making the request to API Gateway endpoint. The principal identifier of the user that will be authorized against resource access. Supported for routes that use IAM authorization. $context.identity.userAgent The User-Agent header of the API caller. $context.identity.userArn The Amazon Resource Name (ARN) of the effective user identified after authentication. Supported for routes that use IAM authoriza tion. For more information, see https:// docs.aws.amazon.com/IAM/latest/UserGuide/ id_users.html. $context.integration.error The error message returned from an integrati $context.integration.integr ationStatus on. Equivalent to $context.integrati onErrorMessage . For Lambda proxy integration, the status code returned from AWS Lambda, not from the backend Lambda function code. Logging 1160 Amazon API Gateway Parameter Description Developer Guide $context.integration.latency The integration latency in ms. Equivalent to $context.integrationLatency . $context.integration.requestId The AWS endpoint's request ID. Equivalent to $context.integration.status $context.integrationErrorMessage $context.awsEndpointRequestId . The status code returned from an integrati on. For Lambda proxy integrations, this is the status code that your Lambda function code returns. A string that contains an integration error message. $context.integrationLatency The integration latency in ms. $context.integrationStatus For Lambda proxy integration, this parameter represents the status code returned from AWS Lambda, not from the backend Lambda function. $context.path The request path. For example, /{stage}/ root/child . $context.protocol The request protocol, for example, HTTP/1.1. Note API Gateway APIs can accept HTTP/2 requests, but API Gateway sends requests to backend integrations using HTTP/1.1. As a result, the request protocol is logged as HTTP/1.1 even if a client sends a request that uses HTTP/2. Logging 1161 Amazon API Gateway Parameter $context.requestId Developer Guide Description The ID that API Gateway assigns to the API request. $context.requestTime The CLF-formatted request time (dd/MMM/yy yy:HH:mm:ss +-hhmm ). $context.requestTimeEpoch The Epoch-formatted request time. $context.responseLatency The response latency in ms. $context.responseLength The response payload length in bytes. $context.routeKey The route key of the API request, for example /pets. $context.stage The deployment stage of the API request (for example, beta or prod). $context.status The method response status. Troubleshooting issues with HTTP APIs in API Gateway The following topics provide troubleshooting advice for errors and issues that you might encounter when using HTTP APIs. Topics • Troubleshooting issues with HTTP API Lambda integrations • Troubleshooting issues with HTTP API JWT authorizers Troubleshooting issues with HTTP API Lambda integrations The following provides troubleshooting advice for errors and issues that you might encounter when using AWS Lambda integrations with HTTP APIs. Troubleshooting 1162 Amazon API Gateway Developer Guide Issue: My API with a Lambda integration returns {"message":"Internal Server Error"} To troubleshoot the internal server error, add the $context.integrationErrorMessage logging variable to your log format, and view your HTTP API's logs. To achieve this, do the following: To create a log group by using the AWS Management Console 1. Open the CloudWatch console at https://console.aws.amazon.com/cloudwatch/. 2. Choose Log groups. 3. Choose Create log group. 4. Enter a log group name, and then choose Create. 5. Note the Amazon Resource Name (ARN) for your log group. The ARN format is arn:aws:logs:region: account-id:log-group:log-group-name. You need the log group ARN to enable access logging for your HTTP API. To add
apigateway-dg-315
apigateway-dg.pdf
315
{"message":"Internal Server Error"} To troubleshoot the internal server error, add the $context.integrationErrorMessage logging variable to your log format, and view your HTTP API's logs. To achieve this, do the following: To create a log group by using the AWS Management Console 1. Open the CloudWatch console at https://console.aws.amazon.com/cloudwatch/. 2. Choose Log groups. 3. Choose Create log group. 4. Enter a log group name, and then choose Create. 5. Note the Amazon Resource Name (ARN) for your log group. The ARN format is arn:aws:logs:region: account-id:log-group:log-group-name. You need the log group ARN to enable access logging for your HTTP API. To add the $context.integrationErrorMessage logging variable 1. Sign in to the API Gateway console at https://console.aws.amazon.com/apigateway. 2. Choose your HTTP API. 3. Under Monitor, choose Logging. 4. Select a stage of your API. 5. Choose Edit, and then enable access logging. 6. 7. For Log destination, enter the ARN of the log group that you created in the previous step. For Log format, choose CLF. API Gateway creates an example log format. 8. Add $context.integrationErrorMessage to the end of the log format. 9. Choose Save. To view your API's logs 1. Generate logs. Use a browser or curl to invoke your API. $curl https://api-id.execute-api.us-west-2.amazonaws.com/route Lambda integrations 1163 Amazon API Gateway Developer Guide 2. Sign in to the API Gateway console at https://console.aws.amazon.com/apigateway. 3. Choose your HTTP API. 4. Under Monitor, choose Logging. 5. Select the stage of your API for which you enabled logging. 6. Choose View logs in CloudWatch. 7. Choose the latest log stream to view your HTTP API's logs. 8. Your log entry should look similar to the following: Because we added $context.integrationErrorMessage to the log format, we see an error message in our logs that summarizes the problem. Your logs might include a different error message that indicates that there's a problem with your Lambda function code. In that case, check your Lambda function code, and verify that your Lambda function returns a response in the required format. If your logs don't include an error message, add $context.error.message and $context.error.responseType to your log format for more information to help troubleshoot. In this case, the logs show that API Gateway didn't have the required permissions to invoke the Lambda function. When you create a Lambda integration in the API Gateway console, API Gateway automatically configures permissions to invoke the Lambda function. When you create a Lambda integration by using the AWS CLI, AWS CloudFormation, or an SDK, you must grant permissions for API Gateway Lambda integrations 1164 Amazon API Gateway Developer Guide to invoke the function. The following add-permission commands grant permission for different HTTP API routes to invoke a Lambda function. Example Example – For the $default stage and $default route of an HTTP API aws lambda add-permission \ --function-name my-function \ --statement-id apigateway-invoke-permissions \ --action lambda:InvokeFunction \ --principal apigateway.amazonaws.com \ --source-arn "arn:aws:execute-api:us-west-2:123456789012:api-id/\$default/\ $default" Example Example – For the prod stage and test route of an HTTP API aws lambda add-permission \ --function-name my-function \ --statement-id apigateway-invoke-permissions \ --action lambda:InvokeFunction \ --principal apigateway.amazonaws.com \ --source-arn "arn:aws:execute-api:us-west-2:123456789012:api-id/prod/*/test" Confirm the function policy in the Permissions tab of the Lambda console. Try invoking your API again. You should see your Lambda function's response. Troubleshooting issues with HTTP API JWT authorizers The following provides troubleshooting advice for errors and issues that you might encounter when using JSON Web Token (JWT) authorizers with HTTP APIs. Issue: My API returns 401 {"message":"Unauthorized"} Check the www-authenticate header in the response from the API. The following command uses curl to send a request to an API with a JWT authorizer that uses $request.header.Authorization as its identity source. $curl -v -H "Authorization: token" https://api-id.execute-api.us- west-2.amazonaws.com/route JWT authorizers 1165 Amazon API Gateway Developer Guide The response from the API includes a www-authenticate header. ... < HTTP/1.1 401 Unauthorized < Date: Wed, 13 May 2020 04:07:30 GMT < Content-Length: 26 < Connection: keep-alive < www-authenticate: Bearer scope="" error="invalid_token" error_description="the token does not have a valid audience" < apigw-requestid: Mc7UVioPPHcEKPA= < * Connection #0 to host api-id.execute-api.us-west-2.amazonaws.com left intact {"message":"Unauthorized"}} In this case, the www-authenticate header shows that the token wasn't issued for a valid audience. For API Gateway to authorize a request, the JWT's aud or client_id claim must match one of the audience entries that's configured for the authorizer. API Gateway validates client_id only if aud is not present. When both aud and client_id are present, API Gateway evaluates aud. You can also decode a JWT and verify that it matches the issuer, audience, and scopes that your API requires. The website jwt.io can debug JWTs in the browser. The OpenID Foundation maintains a list of libraries for working with JWTs. To learn more about JWT authorizers, see Control access to HTTP APIs with JWT authorizers in API Gateway. JWT authorizers 1166 Amazon API Gateway Developer Guide API
apigateway-dg-316
apigateway-dg.pdf
316
match one of the audience entries that's configured for the authorizer. API Gateway validates client_id only if aud is not present. When both aud and client_id are present, API Gateway evaluates aud. You can also decode a JWT and verify that it matches the issuer, audience, and scopes that your API requires. The website jwt.io can debug JWTs in the browser. The OpenID Foundation maintains a list of libraries for working with JWTs. To learn more about JWT authorizers, see Control access to HTTP APIs with JWT authorizers in API Gateway. JWT authorizers 1166 Amazon API Gateway Developer Guide API Gateway WebSocket APIs A WebSocket API in API Gateway is a collection of WebSocket routes that are integrated with backend HTTP endpoints, Lambda functions, or other AWS services. You can use API Gateway features to help you with all aspects of the API lifecycle, from creation through monitoring your production APIs. API Gateway WebSocket APIs are bidirectional. A client can send messages to a service, and services can independently send messages to clients. This bidirectional behavior enables richer client/service interactions because services can push data to clients without requiring clients to make an explicit request. WebSocket APIs are often used in real-time applications such as chat applications, collaboration platforms, multiplayer games, and financial trading platforms. For an example app to get started with, see Tutorial: Create a WebSocket chat app with a WebSocket API, Lambda and DynamoDB. In this section, you can learn how to develop, publish, protect, and monitor your WebSocket APIs using API Gateway. Topics • Overview of WebSocket APIs in API Gateway • Develop WebSocket APIs in API Gateway • Publish WebSocket APIs for customers to invoke • Protect your WebSocket APIs in API Gateway • Monitor WebSocket APIs in API Gateway Overview of WebSocket APIs in API Gateway In API Gateway you can create a WebSocket API as a stateful frontend for an AWS service (such as Lambda or DynamoDB) or for an HTTP endpoint. The WebSocket API invokes your backend based on the content of the messages it receives from client apps. Unlike a REST API, which receives and responds to requests, a WebSocket API supports two-way communication between client apps and your backend. The backend can send callback messages to connected clients. Overview of WebSocket APIs 1167 Amazon API Gateway Developer Guide In your WebSocket API, incoming JSON messages are directed to backend integrations based on routes that you configure. (Non-JSON messages are directed to a $default route that you configure.) A route includes a route key, which is the value that is expected once a route selection expression is evaluated. The routeSelectionExpression is an attribute defined at the API level. It specifies a JSON property that is expected to be present in the message payload. For more information about route selection expressions, see the section called “”. For example, if your JSON messages contain an action property, and you want to perform different actions based on this property, your route selection expression might be ${request.body.action}. Your routing table would specify which action to perform by matching the value of the action property against the custom route key values that you have defined in the table. Use routes for a WebSocket API There are three predefined routes that can be used: $connect, $disconnect, and $default. In addition, you can create custom routes. • API Gateway calls the $connect route when a persistent connection between the client and a WebSocket API is being initiated. • API Gateway calls the $disconnect route when the client or the server disconnects from the API. • API Gateway calls a custom route after the route selection expression is evaluated against the message if a matching route is found; the match determines which integration is invoked. • API Gateway calls the $default route if the route selection expression cannot be evaluated against the message or if no matching route is found. For more information about the $connect and $disconnect routes, see the section called “Manage connected users and client apps”. For more information about the $default route and custom routes, see the section called “Invoke your backend integration”. Use routes for a WebSocket API 1168 Amazon API Gateway Developer Guide Send data to connected client apps Backend services can send data to connected client apps. You can send data by doing the following: • Use an integration to send a response, which is returned to the client by a route response that you have defined. • You can use the @connections API to send a POST request. For more information, see the section called “Use @connections commands in your backend service”. Manage connected users and client apps: $connect and $disconnect routes The following section describes how to use the $connect and $disconnect routes for your WebSocket API. Topics • The
apigateway-dg-317
apigateway-dg.pdf
317
Send data to connected client apps Backend services can send data to connected client apps. You can send data by doing the following: • Use an integration to send a response, which is returned to the client by a route response that you have defined. • You can use the @connections API to send a POST request. For more information, see the section called “Use @connections commands in your backend service”. Manage connected users and client apps: $connect and $disconnect routes The following section describes how to use the $connect and $disconnect routes for your WebSocket API. Topics • The $connect route • Passing connection information from the $connect route • The $disconnect route The $connect route Client apps connect to your WebSocket API by sending a WebSocket upgrade request. If the request succeeds, the $connect route is executed while the connection is being established. Because the WebSocket connection is a stateful connection, you can configure authorization on the $connect route only. AuthN/AuthZ will be performed only at connection time. Until execution of the integration associated with the $connect route is completed, the upgrade request is pending and the actual connection will not be established. If the $connect request fails (e.g., due to AuthN/AuthZ failure or an integration failure), the connection will not be made. Send data to connected client apps 1169 Amazon API Gateway Note Developer Guide If authorization fails on $connect, the connection will not be established, and the client will receive a 401 or 403 response. Setting up an integration for $connect is optional. You should consider setting up a $connect integration if: • You want to enable clients to specify subprotocols by using the Sec-WebSocket-Protocol field. For example code, see Set up a $connect route that requires a WebSocket subprotocol. • You want to be notified when clients connect. • You want to throttle connections or control who connects. • You want your backend to send messages back to clients using a callback URL. • You want to store each connection ID and other information into a database (for example, Amazon DynamoDB). Passing connection information from the $connect route You can use both proxy and non-proxy integrations to pass information from the $connect route to a database or other AWS service. To pass connection information using a proxy integration You can access the connection information from a Lambda proxy integration in the event. Use another AWS service or AWS Lambda function to post to the connection. The following Lambda function shows how to use the requestContext object to log the connection ID, domain name, stage name, and query strings. Node.js export const handler = async(event, context) => { const connectId = event["requestContext"]["connectionId"] const domainName = event["requestContext"]["domainName"] const stageName = event["requestContext"]["stage"] const qs = event['queryStringParameters'] console.log('Connection ID: ', connectId, 'Domain Name: ', domainName, 'Stage Name: ', stageName, 'Query Strings: ', qs ) Manage connected users and client apps 1170 Amazon API Gateway Developer Guide return {"statusCode" : 200} }; Python import json import logging logger = logging.getLogger() logger.setLevel("INFO") def lambda_handler(event, context): connectId = event["requestContext"]["connectionId"] domainName = event["requestContext"]["domainName"] stageName = event["requestContext"]["stage"] qs = event['queryStringParameters'] connectionInfo = { 'Connection ID': connectId, 'Domain Name': domainName, 'Stage Name': stageName, 'Query Strings': qs} logging.info(connectionInfo) return {"statusCode": 200} To pass connection information using a non-proxy integration • You can access the connection information with a non-proxy integration. Set up the integration request and provide a WebSocket API request template. The following Velocity Template Language (VTL) mapping template provides an integration request. This request sends the following details to a non-proxy integration: • Connection ID • Domain name • Stage name • Path • Headers • Query strings Manage connected users and client apps 1171 Amazon API Gateway Developer Guide This request sends the connection ID, domain name, stage name, paths, headers, and query strings to a non-proxy integration. { "connectionId": "$context.connectionId", "domain": "$context.domainName", "stage": "$context.stage", "params": "$input.params()" } For more information about setting up data transformations, see the section called “Data transformations”. To complete the integration request, set StatusCode: 200 for the integration response. To learn more about setting up an integration response, see Set up an integration response using the API Gateway console. The $disconnect route The $disconnect route is executed after the connection is closed. The connection can be closed by the server or by the client. As the connection is already closed when it is executed, $disconnect is a best-effort event. API Gateway will try its best to deliver the $disconnect event to your integration, but it cannot guarantee delivery. The backend can initiate disconnection by using the @connections API. For more information, see the section called “Use @connections commands in your backend service”. Invoke your backend integration with the $default Route and custom routes in API Gateway The following section describes how to invoke your backend integration using either
apigateway-dg-318
apigateway-dg.pdf
318
the connection is closed. The connection can be closed by the server or by the client. As the connection is already closed when it is executed, $disconnect is a best-effort event. API Gateway will try its best to deliver the $disconnect event to your integration, but it cannot guarantee delivery. The backend can initiate disconnection by using the @connections API. For more information, see the section called “Use @connections commands in your backend service”. Invoke your backend integration with the $default Route and custom routes in API Gateway The following section describes how to invoke your backend integration using either the $default route or a custom route for a WebSocket API. Topics • Using routes to process messages • The $default route Invoke your backend integration 1172 Amazon API Gateway • Custom routes Developer Guide • Using API Gateway WebSocket API integrations to connect to your business logic • Important differences between WebSocket APIs and REST APIs Using routes to process messages In API Gateway WebSocket APIs, messages can be sent from the client to your backend service and vice versa. Unlike HTTP's request/response model, in WebSocket the backend can send messages to the client without the client taking any action. Messages can be JSON or non-JSON. However, only JSON messages can be routed to specific integrations based on message content. Non-JSON messages are passed through to the backend by the $default route. Note API Gateway supports message payloads up to 128 KB with a maximum frame size of 32 KB. If a message exceeds 32 KB, you must split it into multiple frames, each 32 KB or smaller. If a larger message (or frame) is received, the connection is closed with code 1009. Currently binary payloads are not supported. If a binary frame is received, the connection is closed with code 1003. However, it is possible to convert binary payloads to text. See the section called “Binary media types”. With WebSocket APIs in API Gateway, JSON messages can be routed to execute a specific backend service based on message content. When a client sends a message over its WebSocket connection, this results in a route request to the WebSocket API. The request will be matched to the route with the corresponding route key in API Gateway. You can set up a route request for a WebSocket API in the API Gateway console, by using the AWS CLI, or by using an AWS SDK. Note In the AWS CLI and AWS SDKs, you can create routes before or after you create integrations. Currently the console does not support reuse of integrations, so you must create the route first and then create the integration for that route. Invoke your backend integration 1173 Amazon API Gateway Developer Guide You can configure API Gateway to perform validation on a route request before proceeding with the integration request. If the validation fails, API Gateway fails the request without calling your backend, sends a "Bad request body" gateway response similar to the following to the client, and publishes the validation results in CloudWatch Logs: {"message" : "Bad request body", "connectionId": "{connectionId}", "messageId": "{messageId}"} This reduces unnecessary calls to your backend and lets you focus on the other requirements of your API. You can also define a route response for your API's routes to enable two-way communication. A route response describes what data will be sent to your client upon completion of a particular route's integration. It is not necessary to define a response for a route if, for example, you want a client to send messages to your backend without receiving a response (one-way communication). However, if you don't provide a route response, API Gateway won't send any information about the result of your integration to your clients. The $default route Every API Gateway WebSocket API can have a $default route. This is a special routing value that can be used in the following ways: • You can use it together with defined route keys, to specify a "fallback" route (for example, a generic mock integration that returns a particular error message) for incoming messages that don't match any of the defined route keys. • You can use it without any defined route keys, to specify a proxy model that delegates routing to a backend component. • You can use it to specify a route for non-JSON payloads. Custom routes If you want to invoke a specific integration based on message content, you can do so by creating a custom route. A custom route uses a route key and integration that you specify. When an incoming message contains a JSON property, and that property evaluates to a value that matches the route key value, Invoke your backend integration 1174 Amazon API Gateway Developer Guide API Gateway invokes the integration. (For more information, see the section
apigateway-dg-319
apigateway-dg.pdf
319
specify a proxy model that delegates routing to a backend component. • You can use it to specify a route for non-JSON payloads. Custom routes If you want to invoke a specific integration based on message content, you can do so by creating a custom route. A custom route uses a route key and integration that you specify. When an incoming message contains a JSON property, and that property evaluates to a value that matches the route key value, Invoke your backend integration 1174 Amazon API Gateway Developer Guide API Gateway invokes the integration. (For more information, see the section called “Overview of WebSocket APIs”.) For example, suppose you wanted to create a chat room application. You might start by creating a WebSocket API whose route selection expression is $request.body.action. You could then define two routes: joinroom and sendmessage. A client app might invoke the joinroom route by sending a message such as the following: {"action":"joinroom","roomname":"developers"} And it might invoke the sendmessage route by sending a message such as the following: {"action":"sendmessage","message":"Hello everyone"} Using API Gateway WebSocket API integrations to connect to your business logic After setting up a route for an API Gateway WebSocket API, you must specify the integration you'd like to use. As with a route, which can have a route request and a route response, an integration can have an integration request and an integration response. An integration request contains the information expected by your backend in order to process the request that came from your client. An integration response contains the data that your backend returns to API Gateway, and that may be used to construct a message to send to the client (if a route response is defined). For more information about setting up integrations, see the section called “Integrations”. Important differences between WebSocket APIs and REST APIs Integrations for WebSocket APIs are similar to integrations for REST APIs, except for the following differences: • Currently, in the API Gateway console you must create a route first and then create an integration as that route's target. However, in the API and CLI, you can create routes and integrations independently, in any order. • You can use a single integration for multiple routes. For example, if you have a set of actions that closely relate to each other, you might want all of those routes to go to a single Lambda function. Rather than defining the details of the integration multiple times, you can specify it once and assign it to each of the related routes. Invoke your backend integration 1175 Amazon API Gateway Note Developer Guide Currently the console does not support reuse of integrations, so you must create the route first and then create the integration for that route. In the AWS CLI and AWS SDKs, you can reuse an integration by setting the route's target to a value of "integrations/{integration-id}", where {integration-id}" is the unique ID of the integration to be associated with the route. • API Gateway provides multiple selection expressions you can use in your routes and integrations. You don't need to rely on the content type to select an input template or output mapping. As with route selection expressions, you can define a selection expression to be evaluated by API Gateway to choose the right item. All of them will fall back to the $default template if a matching template is not found. • In integration requests, the template selection expression supports $request.body.<json_path_expression> and static values. • In integration responses, the template selection expression supports $request.body.<json_path_expression>, $integration.response.statuscode, $integration.response.header.<headerName>, and static values. In the HTTP protocol, in which requests and responses are sent synchronously; communication is essentially one-way. In the WebSocket protocol, communication is two-way. Responses are asynchronous and are not necessarily received by the client in the same order as the client's messages were sent. In addition, the backend can send messages to the client. Note For a route that is configured to use AWS_PROXY or LAMBDA_PROXY integration, communication is one-way, and API Gateway will not pass the backend response through to the route response automatically. For example, in the case of LAMBDA_PROXY integration, the body that the Lambda function returns will not be returned to the client. If you want the client to receive integration responses, you must define a route response to make two- way communication possible. Invoke your backend integration 1176 Amazon API Gateway Developer Guide WebSocket selection expressions API Gateway uses selection expressions as a way to evaluate request and response context and produce a key. The key is then used to select from a set of possible values, typically provided by you, the API developer. The exact set of supported variables will vary depending on the particular expression. Each expression is discussed in more detail below. For all of the expressions, the language follows
apigateway-dg-320
apigateway-dg.pdf
320
you want the client to receive integration responses, you must define a route response to make two- way communication possible. Invoke your backend integration 1176 Amazon API Gateway Developer Guide WebSocket selection expressions API Gateway uses selection expressions as a way to evaluate request and response context and produce a key. The key is then used to select from a set of possible values, typically provided by you, the API developer. The exact set of supported variables will vary depending on the particular expression. Each expression is discussed in more detail below. For all of the expressions, the language follows the same set of rules: • A variable is prefixed with "$". • Curly braces can be used to explicitly define variable boundaries, e.g., "${request.body.version}-beta". • Multiple variables are supported, but evaluation occurs only once (no recursive evaluation). • A dollar sign ($) can be escaped with "\". This is most useful when defining an expression that maps to the reserved $default key, e.g., "\$default". • In some cases, a pattern format is required. In this case, the expression should be wrapped with forward slashes ("/"), e.g. "/2\d\d/" to match 2XX status codes. Topics • Route response selection expressions • API key selection expressions • API mapping selection expressions • WebSocket selection expression summary Route response selection expressions A route response is used for modeling a response from the backend to the client. For WebSocket APIs, a route response is optional. When defined, it signals to API Gateway that it should return a response to a client upon receiving a WebSocket message. Evaluation of the route response selection expression produces a route response key. Eventually, this key will be used to choose from one of the RouteResponses associated with the API. However, currently only the $default key is supported. WebSocket selection expressions 1177 Amazon API Gateway Developer Guide API key selection expressions This expression is evaluated when the service determines the given request should proceed only if the client provides a valid API key. Currently the only two supported values are $request.header.x-api-key and $context.authorizer.usageIdentifierKey. API mapping selection expressions This expression is evaluated to determine which API stage is selected when a request is made using a custom domain. Currently, the only supported value is $request.basepath. WebSocket selection expression summary The following table summarizes the use cases for selection expressions in WebSocket APIs: Selection expression Evaluates to key for Api.Route Route.RouteKey Selection Expression Key for Route.RequestModels Route.Mod elSelecti onExpress ion Notes Example use case $default is Route WebSocket supported messages as a based catch- on the all route. context of a client request. Optional. If provided for non- proxy Perform request validatio n dynamical ly WebSocket selection expressions 1178 Amazon API Gateway Selection expression Evaluates to key for Notes Developer Guide Example use case integrati within on, model the same validatio route. n occurs. $default is supported as a catch- all. WebSocket selection expressions 1179 Amazon API Gateway Selection expression Integrati on.Templa teSelecti onExpress ion Evaluates to key for Notes Developer Guide Example use case Key for Integration.RequestTemplates Optional. May be provided for non- proxy Manipulat e the caller's request based on dynamic propertie integrati on to s of the manipulat request. e incoming payloads. ${request .body.jso nPath} and static values are supported . $default is supported as a catch- all. WebSocket selection expressions 1180 Amazon API Gateway Selection expression Evaluates to key for Notes Developer Guide Example use case Integrati IntegrationResponse.IntegrationRespo on.Integr nseKey ationResp onseSelec tionExpre ssion Optional. May Manipulat e the be response provided from the backend. for non- proxy integrati Choose on. Acts as a the action to occur pattern based match for on the dynamic error response messages of the (from backend Lambda) (e.g., or handling status certain codes (from HTTP errors distinctl y). integrati ons). $default is required for non- proxy WebSocket selection expressions 1181 Amazon API Gateway Selection expression Evaluates to key for Notes Developer Guide Example use case integrati ons to act as the catch- all for successfu l responses . WebSocket selection expressions 1182 Amazon API Gateway Selection expression Evaluates to key for Notes Developer Guide Example use case Integrati Key for IntegrationResponse.Respons onRespons eTemplates e.Templat eSelectio nExpressi on WebSocket selection expressions Optional. May In some be cases, provided a for non- dynamic property proxy of the integrati response on. may $default is dictate different transform supported ations . within the same route and associate d integrati on. ${request .body.jso nPath} , ${integra tion.resp onse.stat uscode} , ${integra tion.resp onse.head 1183 Amazon API Gateway Selection expression Evaluates to key for Notes Developer Guide Example use case er.header Name} , ${integra tion.resp onse.mult ivaluehea der.heade rName} , and static values are supported . $default is supported as a catch- all. WebSocket selection expressions 1184 Amazon API Gateway Selection expression Evaluates to key for Notes
apigateway-dg-321
apigateway-dg.pdf
321
May In some be cases, provided a for non- dynamic property proxy of the integrati response on. may $default is dictate different transform supported ations . within the same route and associate d integrati on. ${request .body.jso nPath} , ${integra tion.resp onse.stat uscode} , ${integra tion.resp onse.head 1183 Amazon API Gateway Selection expression Evaluates to key for Notes Developer Guide Example use case er.header Name} , ${integra tion.resp onse.mult ivaluehea der.heade rName} , and static values are supported . $default is supported as a catch- all. WebSocket selection expressions 1184 Amazon API Gateway Selection expression Evaluates to key for Notes Developer Guide Example use case Route.Rou RouteResponse.RouteResponseKey teRespons eSelectio nExpressi on Key for RouteResponse.RequestModels RouteResp onse.Mode lSelectio nExpressi on Should be provided to initiate two- way communica tion for a WebSocket route. Currently , this value is restricte d to $default only. Currently unsupport ed. Develop WebSocket APIs in API Gateway This section provides details about API Gateway capabilities that you need while you're developing your API Gateway APIs. Develop 1185 Amazon API Gateway Developer Guide As you're developing your API Gateway API, you decide on a number of characteristics of your API. These characteristics depend on the use case of your API. For example, you might want to only allow certain clients to call your API, or you might want it to be available to everyone. You might want an API call to execute a Lambda function, make a database query, or call an application. Topics • Create WebSocket APIs in API Gateway • IP address types for WebSocket APIs in API Gateway • Create routes for WebSocket APIs in API Gateway • Control and manage access to WebSocket APIs in API Gateway • Integrations for WebSocket APIs in API Gateway • Request validation for WebSocket APIs in API Gateway • Data transformations for WebSocket APIs in API Gateway • Binary media types for WebSocket APIs in API Gateway • Invoke WebSocket APIs Create WebSocket APIs in API Gateway You can create a WebSocket API in the API Gateway console, by using the AWS CLI create-api command, or by using the CreateApi command in an AWS SDK. The following procedures show how to create a new WebSocket API. Note WebSocket APIs only support TLS 1.2 and TLS 1.3. Earlier TLS versions are not supported. Create a WebSocket API using AWS CLI commands The following create-api command creates an API with the $request.body.action route selection expression: aws apigatewayv2 --region us-east-1 create-api --name "myWebSocketApi3" --protocol-type WEBSOCKET --route-selection-expression '$request.body.action' The output looks like the following: Create and configure 1186 Amazon API Gateway Developer Guide { "ApiKeySelectionExpression": "$request.header.x-api-key", "Name": "myWebSocketApi3", "CreatedDate": "2018-11-15T06:23:51Z", "ProtocolType": "WEBSOCKET", "RouteSelectionExpression": "'$request.body.action'", "ApiId": "aabbccddee" } Create a WebSocket API using the API Gateway console You can create a WebSocket API in the console by choosing the WebSocket protocol and giving the API a name. Important Once you have created the API, you cannot change the protocol you have chosen for it. There is no way to convert a WebSocket API into a REST API or vice versa. To create a WebSocket API using the API Gateway console 1. Sign in to the API Gateway console and choose Create API. 2. Under WebSocket API, choose Build. Only Regional endpoints are supported. 3. 4. For API name, enter the name of your API. For Route selection expression, enter a value. For example, $request.body.action. For more information about route selection expressions, see the section called “”. 5. Do one of the following: • • Choose Create blank API to create an API with no routes. Choose Next to attach routes to your API. You can attach routes after you create your API. IP address types for WebSocket APIs in API Gateway When you create an API, you specify the type of IP addresses that can invoke your API. You can choose IPv4 to allow IPv4 addresses to invoke your API, or you can choose dualstack to allow both IP address types for WebSocket APIs in API Gateway 1187 Amazon API Gateway Developer Guide IPv4 and IPv6 addresses to invoke your API. We recommend that you set the IP address type to dualstack to alleviate IP space exhaustion or for your security posture. For more information about the benefits of a dualstack IP address type, see IPv6 on AWS. Considerations for IP address types The following considerations might impact your use of IP address types: • The default IP address type for all WebSocket APIs is IPv4. • If you change the IP address type for an existing API from IPv4 to dualstack, confirm that any policies controlling access to your APIs have been updated to account for IPv6 calls. When you change the IP address type, the change takes effect immediately. • Your API can be mapped to a custom domain name
apigateway-dg-322
apigateway-dg.pdf
322
For more information about the benefits of a dualstack IP address type, see IPv6 on AWS. Considerations for IP address types The following considerations might impact your use of IP address types: • The default IP address type for all WebSocket APIs is IPv4. • If you change the IP address type for an existing API from IPv4 to dualstack, confirm that any policies controlling access to your APIs have been updated to account for IPv6 calls. When you change the IP address type, the change takes effect immediately. • Your API can be mapped to a custom domain name with a different IP address type than your API. If you disable your default API endpoint, this might affect how callers can invoke your API. Change the IP address type of an WebSocket API You can change the IP address type by updating the API’s configuration. You can update the API's configuration by using the AWS Management Console, the AWS CLI, AWS CloudFormation, or an AWS SDK. If you change the API’s IP address type, you don't redeploy your API for the changes to take effect. AWS Management Console To change the IP address type of a WebSocket API 1. Sign in to the API Gateway console at https://console.aws.amazon.com/apigateway. 2. Choose a WebSocket API. 3. Choose API settings, and then choose Edit. 4. For IP address type, select either IPv4 or Dualstack. 5. Choose Save. The change to your API's configuration will take effect immediately. AWS CLI The following update-api command updates an API to have an IP address type of dualstack: IP address types for WebSocket APIs in API Gateway 1188 Amazon API Gateway Developer Guide aws apigatewayv2 update-api \ --api-id abcd1234 \ --ip-address-type dualstack The output will look like the following: { "ApiEndpoint": "https://abcd1234.execute-api.us-east-1.amazonaws.com", "ApiId": "abcd1234", "ApiKeySelectionExpression": "$request.header.x-api-key", "CreatedDate": "2025-02-04T22:20:20+00:00", "DisableExecuteApiEndpoint": false, "Name": "My-WebSocket-API", "ProtocolType": "WEBSOCKET", "RouteSelectionExpression": "$request.method $request.path", "Tags": {}, "NotificationUris": [], "IpAddressType": "dualstack" } Create routes for WebSocket APIs in API Gateway In your WebSocket API, incoming JSON messages are directed to backend integrations based on routes that you configure. (Non-JSON messages are directed to a $default route that you configure.) A route includes a route key, which is the value that is expected once a route selection expression is evaluated. The routeSelectionExpression is an attribute defined at the API level. It specifies a JSON property that is expected to be present in the message payload. For more information about route selection expressions, see the section called “”. For example, if your JSON messages contain an action property and you want to perform different actions based on this property, your route selection expression might be ${request.body.action}. Your routing table would specify which action to perform by matching the value of the action property against the custom route key values that you have defined in the table. There are three predefined routes that can be used: $connect, $disconnect, and $default. In addition, you can create custom routes. Routes 1189 Amazon API Gateway Developer Guide • API Gateway calls the $connect route when a persistent connection between the client and a WebSocket API is being initiated. • API Gateway calls the $disconnect route when the client or the server disconnects from the API. • API Gateway calls a custom route after the route selection expression is evaluated against the message if a matching route is found; the match determines which integration is invoked. • API Gateway calls the $default route if the route selection expression cannot be evaluated against the message or if no matching route is found. Route selection expressions A route selection expression is evaluated when the service is selecting the route to follow for an incoming message. The service uses the route whose routeKey exactly matches the evaluated value. If none match and a route with the $default route key exists, that route is selected. If no routes match the evaluated value and there is no $default route, the service returns an error. For WebSocket-based APIs, the expression should be of the form $request.body.{path_to_body_element}. For example, suppose you are sending the following JSON message: { "service" : "chat", "action" : "join", "data" : { "room" : "room1234" } } You might want to select your API's behavior based on the action property. In that case, you might define the following route selection expression: $request.body.action In this example, request.body refers to your message's JSON payload, and .action is a JSONPath expression. You can use any JSON path expression after request.body, but keep in mind that the result will be stringified. For example, if your JSONPath expression returns an array of two elements, that will be presented as the string "[item1, item2]". For this reason, it's a good practice to have your expression evaluate to a value and not an array or an object. Routes 1190 Amazon
apigateway-dg-323
apigateway-dg.pdf
323
API's behavior based on the action property. In that case, you might define the following route selection expression: $request.body.action In this example, request.body refers to your message's JSON payload, and .action is a JSONPath expression. You can use any JSON path expression after request.body, but keep in mind that the result will be stringified. For example, if your JSONPath expression returns an array of two elements, that will be presented as the string "[item1, item2]". For this reason, it's a good practice to have your expression evaluate to a value and not an array or an object. Routes 1190 Amazon API Gateway Developer Guide You can simply use a static value, or you can use multiple variables. The following table shows examples and their evaluated results against the preceding payload. Expression Evaluated result $request. join body.action join chat/join join- ${request .body.act ion} ${request .body.ser vice}/${r equest.bo dy.action} ${request .body.act ion}-${re quest.bod y.invalid Path} action action \$default $default Descripti on An unwrapped variable A wrapped variable Multiple variables with static values If the JSONPath is not found, the variable is resolved as "". Static value Static value Routes 1191 Amazon API Gateway Developer Guide The evaluated result is used to find a route. If there is a route with a matching route key, the route is selected to process the message. If no matching route is found, then API Gateway tries to find the $default route if available. If the $default route is not defined, then API Gateway returns an error. Set up routes for a WebSocket API in API Gateway When you first create a new WebSocket API, there are three predefined routes: $connect, $disconnect, and $default. You can create them by using the console, API, or AWS CLI. If desired, you can create custom routes. For more information, see the section called “Overview of WebSocket APIs”. Note In the CLI, you can create routes before or after you create integrations, and you can reuse the same integration for multiple routes. Create a route using the API Gateway console To create a route using the API Gateway console 1. Sign in to the API Gateway console, choose the API, and choose Routes. 2. Choose Create route 3. For Route key, enter the route key name. You can create the predefined routes ($connect, $disconnect, and $default), or a custom route. Note When you create a custom route, do not use the $ prefix in the route key name. This prefix is reserved for predefined routes. 4. Select and configure the integration type for the route. For more information, see the section called “Set up a WebSocket API integration request using the API Gateway console”. Create a route using the AWS CLI The following create-route command creates a route: Routes 1192 Amazon API Gateway Developer Guide aws apigatewayv2 --region us-east-1 create-route --api-id aabbccddee --route-key $default The output will look like a following: { "ApiKeyRequired": false, "AuthorizationType": "NONE", "RouteKey": "$default", "RouteId": "1122334" } Specify route request settings for $connect When you set up the $connect route for your API, the following optional settings are available to enable authorization for your API. For more information, see the section called “The $connect route”. • Authorization: If no authorization is needed, you can specify NONE. Otherwise, you can specify: • AWS_IAM to use standard AWS IAM policies to control access to your API. • CUSTOM to implement authorization for an API by specifying a Lambda authorizer function that you have previously created. The authorizer can reside in your own AWS account or a different AWS account. For more information about Lambda authorizers, see Use API Gateway Lambda authorizers. Note In the API Gateway console, the CUSTOM setting is visible only after you have set up an authorizer function as described in the section called “Configure a Lambda authorizer (console)”. Important The Authorization setting is applied to the entire API, not just the $connect route. The $connect route protects the other routes, because it is called on every connection. Routes 1193 Amazon API Gateway Developer Guide • API key required: You can optionally require an API key for an API's $connect route. You can use API keys together with usage plans to control and track access to your APIs. For more information, see the section called “Usage plans”. Set up the $connect route request using the API Gateway console To set up the $connect route request for a WebSocket API using the API Gateway console: 1. Sign in to the API Gateway console, choose the API, and choose Routes. 2. Under Routes, choose $connect, or create a $connect route by following the section called “Create a route using the API Gateway console”. In the Route request settings section, choose Edit. For Authorization, select an authorization type. To require an API for the $connect route, select Require API
apigateway-dg-324
apigateway-dg.pdf
324
your APIs. For more information, see the section called “Usage plans”. Set up the $connect route request using the API Gateway console To set up the $connect route request for a WebSocket API using the API Gateway console: 1. Sign in to the API Gateway console, choose the API, and choose Routes. 2. Under Routes, choose $connect, or create a $connect route by following the section called “Create a route using the API Gateway console”. In the Route request settings section, choose Edit. For Authorization, select an authorization type. To require an API for the $connect route, select Require API key. 3. 4. 5. 6. Choose Save changes. Set up route responses for WebSocket APIs in API Gateway WebSocket routes can be configured for two-way or one-way communication. API Gateway will not pass the backend response through to the route response, unless you set up a route response. Note You can only define the $default route response for WebSocket APIs. You can use an integration response to manipulate the response from a backend service. For more information, see the section called “Overview of integration responses”. You can configure route responses and response selection expressions by using the API Gateway console or the AWS CLI or an AWS SDK. For more information about route response selection expressions, see the section called “”. Topics • Set up a route response using the API Gateway console • Set up a route response using the AWS CLI Routes 1194 Amazon API Gateway Developer Guide Set up a route response using the API Gateway console After you have created a WebSocket API and attached a proxy Lambda function to the default route, you can set up route response using the API Gateway console: 1. Sign in to the API Gateway console, choose a WebSocket API with a proxy Lambda function integration on the $default route. 2. Under Routes, choose the $default route. 3. Choose Enable two-way communication. 4. Choose Deploy API. 5. Deploy your API to a stage. Use the following wscat command to connect to your API. For more information about wscat, see the section called “Use wscat to connect to a WebSocket API and send messages to it”. wscat -c wss://api-id.execute-api.us-east-2.amazonaws.com/test Press the enter button to call the default route. The body of your Lambda function should return. Set up a route response using the AWS CLI The following create-route-response command creates a route response for the $default route. You can identify the API ID and route ID by using the get-apis and get-routes commands. aws apigatewayv2 create-route-response \ --api-id aabbccddee \ --route-id 1122334 \ --route-response-key '$default' The output will look like the following: { "RouteResponseId": "abcdef", "RouteResponseKey": "$default" } Routes 1195 Amazon API Gateway Developer Guide Set up a $connect route that requires a WebSocket subprotocol Clients can use the Sec-WebSocket-Protocol field to request a WebSocket subprotocol during the connection to your WebSocket API. You can set up an integration for the $connect route to allow connections only if a client requests a subprotocol that your API supports. The following example Lambda function returns the Sec-WebSocket-Protocol header to clients. The function establishes a connection to your API only if the client specifies the myprotocol subprotocol. For an AWS CloudFormation template that creates this example API and Lambda proxy integration, see ws-subprotocol.yaml. export const handler = async (event) => { if (event.headers != undefined) { const headers = toLowerCaseProperties(event.headers); if (headers['sec-websocket-protocol'] != undefined) { const subprotocolHeader = headers['sec-websocket-protocol']; const subprotocols = subprotocolHeader.split(','); if (subprotocols.indexOf('myprotocol') >= 0) { const response = { statusCode: 200, headers: { "Sec-WebSocket-Protocol" : "myprotocol" } }; return response; } } } const response = { statusCode: 400 }; return response; }; function toLowerCaseProperties(obj) { var wrapper = {}; for (var key in obj) { Routes 1196 Amazon API Gateway Developer Guide wrapper[key.toLowerCase()] = obj[key]; } return wrapper; } You can use wscat to test that your API allows connections only if a client requests a subprotocol that your API supports. The following commands use the -s flag to specify subprotocols during the connection. The following command attempts a connection with an unsupported subprotocol. Because the client specified the chat1 subprotocol, the Lambda integration returns a 400 error, and the connection is unsuccessful. wscat -c wss://api-id.execute-api.region.amazonaws.com/beta -s chat1 error: Unexpected server response: 400 The following command includes a supported subprotocol in the connection request. The Lambda integration allows the connection. wscat -c wss://api-id.execute-api.region.amazonaws.com/beta -s chat1,myprotocol connected (press CTRL+C to quit) To learn more about invoking WebSocket APIs, see Invoke WebSocket APIs. Control and manage access to WebSocket APIs in API Gateway API Gateway supports multiple mechanisms for controlling and managing access to your WebSocket API. You can use the following mechanisms for authentication and authorization: • Standard AWS IAM roles and policies offer flexible and robust access controls. You can
apigateway-dg-325
apigateway-dg.pdf
325
connection is unsuccessful. wscat -c wss://api-id.execute-api.region.amazonaws.com/beta -s chat1 error: Unexpected server response: 400 The following command includes a supported subprotocol in the connection request. The Lambda integration allows the connection. wscat -c wss://api-id.execute-api.region.amazonaws.com/beta -s chat1,myprotocol connected (press CTRL+C to quit) To learn more about invoking WebSocket APIs, see Invoke WebSocket APIs. Control and manage access to WebSocket APIs in API Gateway API Gateway supports multiple mechanisms for controlling and managing access to your WebSocket API. You can use the following mechanisms for authentication and authorization: • Standard AWS IAM roles and policies offer flexible and robust access controls. You can use IAM roles and policies for controlling who can create and manage your APIs, as well as who can invoke them. For more information, see Control access to WebSocket APIs with IAM authorization. • IAM tags can be used together with IAM policies to control access. For more information, see Using tags to control access to API Gateway REST API resources. Access control 1197 Amazon API Gateway Developer Guide • Lambda authorizers are Lambda functions that control access to APIs. For more information, see Control access to WebSocket APIs with AWS Lambda REQUEST authorizers. To improve your security posture, we recommend that you configure an authorizer for the $connect route on all your WebSocket APIs. You might need to do this to comply with various compliance frameworks. For more information, see Amazon API Gateway controls in the AWS Security Hub User Guide. Topics • Control access to WebSocket APIs with IAM authorization • Control access to WebSocket APIs with AWS Lambda REQUEST authorizers Control access to WebSocket APIs with IAM authorization IAM authorization in WebSocket APIs is similar to that for REST APIs, with the following exceptions: • The execute-api action supports ManageConnections in addition to existing actions (Invoke, InvalidateCache). ManageConnections controls access to the @connections API. • WebSocket routes use a different ARN format: arn:aws:execute-api:region:account-id:api-id/stage-name/route-key • The @connections API uses the same ARN format as REST APIs: arn:aws:execute-api:region:account-id:api-id/stage-name/POST/@connections Important When you use IAM authorization, you must sign requests with Signature Version 4 (SigV4). For example, you could set up the following policy to the client. This example allows everyone to send a message (Invoke) for all routes except for a secret route in the prod stage and prevents everyone from sending a message back to connected clients (ManageConnections) for all stages. { Access control 1198 Amazon API Gateway Developer Guide "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "execute-api:Invoke" ], "Resource": [ "arn:aws:execute-api:us-east-1:account-id:api-id/prod/*" ] }, { "Effect": "Deny", "Action": [ "execute-api:Invoke" ], "Resource": [ "arn:aws:execute-api:us-east-1:account-id:api-id/prod/secret" ] }, { "Effect": "Deny", "Action": [ "execute-api:ManageConnections" ], "Resource": [ "arn:aws:execute-api:us-east-1:account-id:api-id/*" ] } ] } Control access to WebSocket APIs with AWS Lambda REQUEST authorizers A Lambda authorizer function in WebSocket APIs is similar to that for REST APIs, with the following exceptions: • You can only use a Lambda authorizer function for the $connect route. • You cannot use path variables (event.pathParameters), because the path is fixed. • event.methodArn is different from its REST API equivalent, because it has no HTTP method. In the case of $connect, methodArn ends with "$connect": Access control 1199 Amazon API Gateway Developer Guide arn:aws:execute-api:region:account-id:api-id/stage-name/$connect • The context variables in event.requestContext are different from those for REST APIs. The following example shows an input to a REQUEST authorizer for a WebSocket API: { "type": "REQUEST", "methodArn": "arn:aws:execute-api:us-east-1:123456789012:abcdef123/default/ $connect", "headers": { "Connection": "upgrade", "content-length": "0", "HeaderAuth1": "headerValue1", "Host": "abcdef123.execute-api.us-east-1.amazonaws.com", "Sec-WebSocket-Extensions": "permessage-deflate; client_max_window_bits", "Sec-WebSocket-Key": "...", "Sec-WebSocket-Version": "13", "Upgrade": "websocket", "X-Amzn-Trace-Id": "...", "X-Forwarded-For": "...", "X-Forwarded-Port": "443", "X-Forwarded-Proto": "https" }, "multiValueHeaders": { "Connection": [ "upgrade" ], "content-length": [ "0" ], "HeaderAuth1": [ "headerValue1" ], "Host": [ "abcdef123.execute-api.us-east-1.amazonaws.com" ], "Sec-WebSocket-Extensions": [ "permessage-deflate; client_max_window_bits" ], "Sec-WebSocket-Key": [ "..." Access control 1200 Developer Guide Amazon API Gateway ], "Sec-WebSocket-Version": [ "13" ], "Upgrade": [ "websocket" ], "X-Amzn-Trace-Id": [ "..." ], "X-Forwarded-For": [ "..." ], "X-Forwarded-Port": [ "443" ], "X-Forwarded-Proto": [ "https" ] }, "queryStringParameters": { "QueryString1": "queryValue1" }, "multiValueQueryStringParameters": { "QueryString1": [ "queryValue1" ] }, "stageVariables": {}, "requestContext": { "routeKey": "$connect", "eventType": "CONNECT", "extendedRequestId": "...", "requestTime": "19/Jan/2023:21:13:26 +0000", "messageDirection": "IN", "stage": "default", "connectedAt": 1674162806344, "requestTimeEpoch": 1674162806345, "identity": { "sourceIp": "..." }, "requestId": "...", "domainName": "abcdef123.execute-api.us-east-1.amazonaws.com", "connectionId": "...", Access control 1201 Amazon API Gateway Developer Guide "apiId": "abcdef123" } } The following example Lambda authorizer function is a WebSocket version of the Lambda authorizer function for REST APIs in the section called “Additional examples of Lambda authorizer functions”: Node.js // A simple REQUEST authorizer example to demonstrate how to use request // parameters to allow or deny a request. In this example, a request is // authorized if the client-supplied HeaderAuth1 header and QueryString1 query parameter // in the request context match the specified values of // of 'headerValue1' and 'queryValue1' respectively. export const handler = function(event, context, callback) { console.log('Received event:', JSON.stringify(event, null,
apigateway-dg-326
apigateway-dg.pdf
326
Developer Guide "apiId": "abcdef123" } } The following example Lambda authorizer function is a WebSocket version of the Lambda authorizer function for REST APIs in the section called “Additional examples of Lambda authorizer functions”: Node.js // A simple REQUEST authorizer example to demonstrate how to use request // parameters to allow or deny a request. In this example, a request is // authorized if the client-supplied HeaderAuth1 header and QueryString1 query parameter // in the request context match the specified values of // of 'headerValue1' and 'queryValue1' respectively. export const handler = function(event, context, callback) { console.log('Received event:', JSON.stringify(event, null, 2)); // Retrieve request parameters from the Lambda function input: var headers = event.headers; var queryStringParameters = event.queryStringParameters; var stageVariables = event.stageVariables; var requestContext = event.requestContext; // Parse the input for the parameter values var tmp = event.methodArn.split(':'); var apiGatewayArnTmp = tmp[5].split('/'); var awsAccountId = tmp[4]; var region = tmp[3]; var ApiId = apiGatewayArnTmp[0]; var stage = apiGatewayArnTmp[1]; var route = apiGatewayArnTmp[2]; // Perform authorization to return the Allow policy for correct parameters and // the 'Unauthorized' error, otherwise. var authResponse = {}; var condition = {}; condition.IpAddress = {}; if (headers.HeaderAuth1 === "headerValue1" && queryStringParameters.QueryString1 === "queryValue1") { callback(null, generateAllow('me', event.methodArn)); Access control 1202 Amazon API Gateway } else { callback("Unauthorized"); } } Developer Guide // Helper function to generate an IAM policy var generatePolicy = function(principalId, effect, resource) { // Required output: var authResponse = {}; authResponse.principalId = principalId; if (effect && resource) { var policyDocument = {}; policyDocument.Version = '2012-10-17'; // default version policyDocument.Statement = []; var statementOne = {}; statementOne.Action = 'execute-api:Invoke'; // default action statementOne.Effect = effect; statementOne.Resource = resource; policyDocument.Statement[0] = statementOne; authResponse.policyDocument = policyDocument; } // Optional output with custom properties of the String, Number or Boolean type. authResponse.context = { "stringKey": "stringval", "numberKey": 123, "booleanKey": true }; return authResponse; } var generateAllow = function(principalId, resource) { return generatePolicy(principalId, 'Allow', resource); } var generateDeny = function(principalId, resource) { return generatePolicy(principalId, 'Deny', resource); } Python # A simple REQUEST authorizer example to demonstrate how to use request # parameters to allow or deny a request. In this example, a request is Access control 1203 Amazon API Gateway Developer Guide # authorized if the client-supplied HeaderAuth1 header and QueryString1 query parameter # in the request context match the specified values of # of 'headerValue1' and 'queryValue1' respectively. import json def lambda_handler(event, context): print(event) # Retrieve request parameters from the Lambda function input: headers = event['headers'] queryStringParameters = event['queryStringParameters'] stageVariables = event['stageVariables'] requestContext = event['requestContext'] # Parse the input for the parameter values tmp = event['methodArn'].split(':') apiGatewayArnTmp = tmp[5].split('/') awsAccountId = tmp[4] region = tmp[3] ApiId = apiGatewayArnTmp[0] stage = apiGatewayArnTmp[1] route = apiGatewayArnTmp[2] # Perform authorization to return the Allow policy for correct parameters # and the 'Unauthorized' error, otherwise. authResponse = {} condition = {} condition['IpAddress'] = {} if (headers['HeaderAuth1'] == "headerValue1" and queryStringParameters["QueryString1"] == "queryValue1"): response = generateAllow('me', event['methodArn']) print('authorized') return json.loads(response) else: print('unauthorized') return 'unauthorized' # Help function to generate IAM policy Access control 1204 Amazon API Gateway Developer Guide def generatePolicy(principalId, effect, resource): authResponse = {} authResponse['principalId'] = principalId if (effect and resource): policyDocument = {} policyDocument['Version'] = '2012-10-17' policyDocument['Statement'] = [] statementOne = {} statementOne['Action'] = 'execute-api:Invoke' statementOne['Effect'] = effect statementOne['Resource'] = resource policyDocument['Statement'] = [statementOne] authResponse['policyDocument'] = policyDocument authResponse['context'] = { "stringKey": "stringval", "numberKey": 123, "booleanKey": True } authResponse_JSON = json.dumps(authResponse) return authResponse_JSON def generateAllow(principalId, resource): return generatePolicy(principalId, 'Allow', resource) def generateDeny(principalId, resource): return generatePolicy(principalId, 'Deny', resource) To configure the preceding Lambda function as a REQUEST authorizer function for a WebSocket API, follow the same procedure as for REST APIs. To configure the $connect route to use this Lambda authorizer in the console, select or create the $connect route. In the Route request settings section, choose Edit. Select your authorizer in the Authorization dropdown menu, and then choose Save changes. Access control 1205 Amazon API Gateway Developer Guide To test the authorizer, you need to create a new connection. Changing authorizer in $connect doesn't affect the already connected client. When you connect to your WebSocket API, you need to provide values for any configured identity sources. For example, you can connect by sending a valid query string and header using wscat as in the following example: wscat -c 'wss://myapi.execute-api.us-east-1.amazonaws.com/beta? QueryString1=queryValue1' -H HeaderAuth1:headerValue1 If you attempt to connect without a valid identity value, you'll receive a 401 response: wscat -c wss://myapi.execute-api.us-east-1.amazonaws.com/beta error: Unexpected server response: 401 Integrations for WebSocket APIs in API Gateway After setting up an API route, you must integrate it with an endpoint in the backend. A backend endpoint is also referred to as an integration endpoint and can be a Lambda function, an HTTP endpoint, or an AWS service action. The API integration has an integration request and an integration response. In this section, you can
apigateway-dg-327
apigateway-dg.pdf
327
using wscat as in the following example: wscat -c 'wss://myapi.execute-api.us-east-1.amazonaws.com/beta? QueryString1=queryValue1' -H HeaderAuth1:headerValue1 If you attempt to connect without a valid identity value, you'll receive a 401 response: wscat -c wss://myapi.execute-api.us-east-1.amazonaws.com/beta error: Unexpected server response: 401 Integrations for WebSocket APIs in API Gateway After setting up an API route, you must integrate it with an endpoint in the backend. A backend endpoint is also referred to as an integration endpoint and can be a Lambda function, an HTTP endpoint, or an AWS service action. The API integration has an integration request and an integration response. In this section, you can learn how to set up integration requests and integration responses for your WebSocket API. Topics • Set up a WebSocket API integration request in API Gateway • Set up a WebSocket API integration response in API Gateway Set up a WebSocket API integration request in API Gateway Setting up an integration request involves the following: • Choosing a route key to integrate to the backend. • Specifying the backend endpoint to invoke. WebSocket APIs support the following integration types: • AWS_PROXY • AWS • HTTP_PROXY Integrations 1206 Amazon API Gateway • HTTP • MOCK Developer Guide For more information about integration types, see IntegrationType in the API Gateway V2 REST API. • Configuring how to transform the route request data, if necessary, into integration request data by specifying one or more request templates. Set up a WebSocket API integration request using the API Gateway console To add an integration request to a route in a WebSocket API using the API Gateway console 1. Sign in to the API Gateway console, choose the API, and choose Routes. 2. Under Routes, choose the route. 3. Choose the Integration request tab, and then in the Integration request settings section, choose Edit. 4. For Integration type, select one of the following: • Choose Lambda function only if your API will be integrated with an AWS Lambda function that you have already created in this account or in another account. To create a new Lambda function in AWS Lambda, to set a resource permission on the Lambda function, or to perform any other Lambda service actions, choose AWS Service instead. • Choose HTTP if your API will be integrated with an existing HTTP endpoint. For more information, see HTTP integrations for REST APIs in API Gateway. • Choose Mock if you want to generate API responses from API Gateway directly, without the need for an integration backend. For more information, see Mock integrations for REST APIs in API Gateway. • Choose AWS service if your API will be integrated with an AWS service. • Choose VPC link if your API will use a VpcLink as a private integration endpoint. For more information, see Private integrations for REST APIs in API Gateway. 5. If you chose Lambda function, do the following: a. For Use Lambda proxy integration, choose the check box if you intend to use Lambda proxy integration or cross-account Lambda proxy integration. Integrations 1207 Amazon API Gateway Developer Guide b. For Lambda function, specify the function in one of the following ways: • If your Lambda function is in the same account, enter the function name and then select the function from the dropdown list. Note The function name can optionally include its alias or version specification, as in HelloWorld, HelloWorld:1, or HelloWorld:alpha. • If the function is in a different account, enter the ARN for the function. c. To use the default timeout value of 29 seconds, keep Default timeout turned on. To set a custom timeout, choose Default timeout and enter a timeout value between 50 and 29000 milliseconds. If you chose HTTP, follow the instructions in step 4 of the section called “ Set up integration request using the console”. If you chose Mock, proceed to the Request Templates step. If you chose AWS service, follow the instructions in step 6 of the section called “ Set up integration request using the console”. 6. 7. 8. 9. If you chose VPC link, do the following: a. For VPC proxy integration, choose the check box if you want your requests to be proxied to your VPCLink's endpoint. b. c. d. e. For HTTP method, choose the HTTP method type that most closely matches the method in the HTTP backend. From the VPC link dropdown list, select a VPC link. You can select [Use Stage Variables] and enter ${stageVariables.vpcLinkId} in the text box below the list. You can define the vpcLinkId stage variable after deploying the API to a stage and set its value to the ID of the VpcLink. For Endpoint URL, enter the URL of the HTTP backend you want this integration to use. To use the default timeout value of 29 seconds, keep Default timeout turned on. To set a
apigateway-dg-328
apigateway-dg.pdf
328
HTTP method, choose the HTTP method type that most closely matches the method in the HTTP backend. From the VPC link dropdown list, select a VPC link. You can select [Use Stage Variables] and enter ${stageVariables.vpcLinkId} in the text box below the list. You can define the vpcLinkId stage variable after deploying the API to a stage and set its value to the ID of the VpcLink. For Endpoint URL, enter the URL of the HTTP backend you want this integration to use. To use the default timeout value of 29 seconds, keep Default timeout turned on. To set a custom timeout, choose Default timeout and enter a timeout value between 50 and 29000 milliseconds. 10. Choose Save changes. Integrations 1208 Amazon API Gateway Developer Guide 11. Under Request templates, do the following: a. b. c. To enter a Template selection expression, under Request templates, choose Edit. Enter a Template selection expression. Use an expression that API Gateway looks for in the message payload. If it is found, it is evaluated, and the result is a template key value that is used to select the data mapping template to be applied to the data in the message payload. You create the data mapping template in the next step. Choose Edit to save your changes. Choose Create template to create the data mapping template. For Template key, enter a template key value that is used to select the data mapping template to be applied to the data in the message payload. Then, enter a mapping template. Choose Create template. For information about template selection expressions, see the section called “Template selection expressions”. Set up an integration request using the AWS CLI You can set up an integration request for a route in a WebSocket API by using the AWS CLI as in the following example, which creates a mock integration: 1. Create a file named integration-params.json, with the following contents: {"PassthroughBehavior": "WHEN_NO_MATCH", "TimeoutInMillis": 29000, "ConnectionType": "INTERNET", "RequestTemplates": {"application/json": "{\"statusCode\":200}"}, "IntegrationType": "MOCK"} 2. Use the following create-integration command to create the mock integration. aws apigatewayv2 --region us-east-1 create-integration --api-id aabbccddee --cli- input-json file://integration-params.json The output will look like the following: { "PassthroughBehavior": "WHEN_NO_MATCH", "TimeoutInMillis": 29000, "ConnectionType": "INTERNET", "IntegrationResponseSelectionExpression": "${response.statuscode}", "RequestTemplates": { Integrations 1209 Amazon API Gateway Developer Guide "application/json": "{\"statusCode\":200}" }, "IntegrationId": "0abcdef", "IntegrationType": "MOCK" } Alternatively, you can set up an integration request for a proxy integration by using the AWS CLI. 1. Create a Lambda function in the Lambda console and give it a basic Lambda execution role. 2. Use the following create-integration command to create the integration. aws apigatewayv2 create-integration --api-id aabbccddee --integration-type AWS_PROXY --integration-method POST --integration-uri arn:aws:apigateway:us- east-1:lambda:path/2015-03-31/functions/arn:aws:lambda:us- east-1:123412341234:function:simpleproxy-echo-e2e/invocations The output will look like the following: { "PassthroughBehavior": "WHEN_NO_MATCH", "IntegrationMethod": "POST", "TimeoutInMillis": 29000, "ConnectionType": "INTERNET", "IntegrationUri": "arn:aws:apigateway:us-east-1:lambda:path/2015-03-31/functions/ arn:aws:lambda:us-east-1:123412341234:function:simpleproxy-echo-e2e/invocations", "IntegrationId": "abcdefg", "IntegrationType": "AWS_PROXY" } Input format of a Lambda function for proxy integration for WebSocket APIs In Lambda proxy integration, API Gateway maps the entire client request to the input event parameter of the backend Lambda function. The following example shows the structure of the input event from the $connect route and the input event from the $disconnect route that API Gateway sends to a Lambda proxy integration. Input from the $connect route { Integrations 1210 Amazon API Gateway headers: { Developer Guide Host: 'abcd123.execute-api.us-east-1.amazonaws.com', 'Sec-WebSocket-Extensions': 'permessage-deflate; client_max_window_bits', 'Sec-WebSocket-Key': '...', 'Sec-WebSocket-Version': '13', 'X-Amzn-Trace-Id': '...', 'X-Forwarded-For': '192.0.2.1', 'X-Forwarded-Port': '443', 'X-Forwarded-Proto': 'https' }, multiValueHeaders: { Host: [ 'abcd123.execute-api.us-east-1.amazonaws.com' ], 'Sec-WebSocket-Extensions': [ 'permessage-deflate; client_max_window_bits' ], 'Sec-WebSocket-Key': [ '...' ], 'Sec-WebSocket-Version': [ '13' ], 'X-Amzn-Trace-Id': [ '...' ], 'X-Forwarded-For': [ '192.0.2.1' ], 'X-Forwarded-Port': [ '443' ], 'X-Forwarded-Proto': [ 'https' ] }, requestContext: { routeKey: '$connect', eventType: 'CONNECT', extendedRequestId: 'ABCD1234=', requestTime: '09/Feb/2024:18:11:43 +0000', messageDirection: 'IN', stage: 'prod', connectedAt: 1707502303419, requestTimeEpoch: 1707502303420, identity: { sourceIp: '192.0.2.1' }, requestId: 'ABCD1234=', domainName: 'abcd1234.execute-api.us-east-1.amazonaws.com', connectionId: 'AAAA1234=', apiId: 'abcd1234' }, isBase64Encoded: false } Input from the $disconnect route { headers: { Integrations 1211 Amazon API Gateway Developer Guide Host: 'abcd1234.execute-api.us-east-1.amazonaws.com', 'x-api-key': '', 'X-Forwarded-For': '', 'x-restapi': '' }, multiValueHeaders: { Host: [ 'abcd1234.execute-api.us-east-1.amazonaws.com' ], 'x-api-key': [ '' ], 'X-Forwarded-For': [ '' ], 'x-restapi': [ '' ] }, requestContext: { routeKey: '$disconnect', disconnectStatusCode: 1005, eventType: 'DISCONNECT', extendedRequestId: 'ABCD1234=', requestTime: '09/Feb/2024:18:23:28 +0000', messageDirection: 'IN', disconnectReason: 'Client-side close frame status not set', stage: 'prod', connectedAt: 1707503007396, requestTimeEpoch: 1707503008941, identity: { sourceIp: '192.0.2.1' }, requestId: 'ABCD1234=', domainName: 'abcd1234.execute-api.us-east-1.amazonaws.com', connectionId: 'AAAA1234=', apiId: 'abcd1234' }, isBase64Encoded: false } Set up a WebSocket API integration response in API Gateway The following section provides a brief overview of integration responses for WebSocket API and how to set up an integration response for a WebSocket API. Topics • Overview of integration responses • Integration responses for two-way communication • Set up an integration response using the API Gateway console Integrations 1212 Amazon API Gateway Developer Guide • Set up an integration response using the AWS CLI Overview of integration
apigateway-dg-329
apigateway-dg.pdf
329
'prod', connectedAt: 1707503007396, requestTimeEpoch: 1707503008941, identity: { sourceIp: '192.0.2.1' }, requestId: 'ABCD1234=', domainName: 'abcd1234.execute-api.us-east-1.amazonaws.com', connectionId: 'AAAA1234=', apiId: 'abcd1234' }, isBase64Encoded: false } Set up a WebSocket API integration response in API Gateway The following section provides a brief overview of integration responses for WebSocket API and how to set up an integration response for a WebSocket API. Topics • Overview of integration responses • Integration responses for two-way communication • Set up an integration response using the API Gateway console Integrations 1212 Amazon API Gateway Developer Guide • Set up an integration response using the AWS CLI Overview of integration responses API Gateway's integration response is a way of modeling and manipulating the response from a backend service. There are some differences in setup of a REST API versus a WebSocket API integration response, but conceptually the behavior is the same. WebSocket routes can be configured for two-way or one-way communication. • When a route is configured for two-way communication, an integration response allows you to configure transformations on the returned message payload, similar to integration responses for REST APIs. • If a route is configured for one-way communication, then regardless of any integration response configuration, no response will be returned over the WebSocket channel after the message is processed. API Gateway will not pass the backend response through to the route response, unless you set up a route response. To learn about setting up a route response, see the section called “Set up WebSocket API route responses”. Integration responses for two-way communication Integrations can be divided into proxy integrations and non-proxy integrations. Important For proxy integrations, API Gateway automatically passes the backend output to the caller as the complete payload. There is no integration response. For non-proxy integrations, you must set up at least one integration response: • Ideally, one of your integration responses should act as a catch-all when no explicit choice can be made. This default case is represented by setting an integration response key of $default. • In all other cases, the integration response key functions as a regular expression. It should follow a format of "/expression/". Integrations 1213 Amazon API Gateway Developer Guide For non-proxy HTTP integrations: • API Gateway will attempt to match the HTTP status code of the backend response. The integration response key will function as a regular expression in this case. If a match cannot be found, then $default is chosen as the integration response. • The template selection expression, as described above, functions identically. For example: • /2\d\d/: Receive and transform successful responses • /4\d\d/: Receive and transform bad request errors • $default: Receive and transform all unexpected responses For more information about template selection expressions, see the section called “Template selection expressions”. Set up an integration response using the API Gateway console To set up a route integration response for a WebSocket API using the API Gateway console: 1. Sign in to the API Gateway console at https://console.aws.amazon.com/apigateway. 2. Choose your WebSocket API and choose your route. 3. Choose the Integration request tab, and then in the Integration response settings section, choose Create integration response. 4. For Response key, enter a value that will be found in the response key in the outgoing message after evaluating the response selection expression. For instance, you can enter /4\d \d/ to receive and transform bad request errors or enter $default to receive and transform all responses that match the template selection expression. 5. For Template selection expression, enter a selection expression to evaluate the outgoing message. 6. Choose Create response. 7. You can also define a mapping template to configure transformations of your returned message payload. Choose Create template. 8. Enter a key name. If you are choosing the default template selection expression, enter \ $default. 9. For Response template, enter your mapping template in the code editor. 10. Choose Create template. 11. Choose Deploy API to deploy your API. Integrations 1214 Amazon API Gateway Developer Guide Use the following wscat command to connect to your API. For more information about wscat, see the section called “Use wscat to connect to a WebSocket API and send messages to it”. wscat -c wss://api-id.execute-api.us-east-2.amazonaws.com/test When you call your route, the returned message payload should return. Set up an integration response using the AWS CLI The following create-integration-response command creates a $default integration response: aws apigatewayv2 create-integration-response \ --api-id vaz7da96z6 \ --integration-id a1b2c3 \ --integration-response-key '$default' Request validation for WebSocket APIs in API Gateway You can configure API Gateway to perform validation on a route request before proceeding with the integration request. If the validation fails, API Gateway fails the request without calling your backend, sends a "Bad request body" gateway response to the client, and publishes the validation results in CloudWatch Logs. Using validation this way reduces unnecessary calls to your API backend. Model
apigateway-dg-330
apigateway-dg.pdf
330
return. Set up an integration response using the AWS CLI The following create-integration-response command creates a $default integration response: aws apigatewayv2 create-integration-response \ --api-id vaz7da96z6 \ --integration-id a1b2c3 \ --integration-response-key '$default' Request validation for WebSocket APIs in API Gateway You can configure API Gateway to perform validation on a route request before proceeding with the integration request. If the validation fails, API Gateway fails the request without calling your backend, sends a "Bad request body" gateway response to the client, and publishes the validation results in CloudWatch Logs. Using validation this way reduces unnecessary calls to your API backend. Model selection expressions You can use a model selection expression to dynamically validate requests within the same route. Model validation occurs if you provide a model selection expression for either proxy or non-proxy integrations. You might need to define the $default model as a fallback when no matching model is found. If there is no matching model and $default isn't defined, the validation fails. The selection expression looks like Route.ModelSelectionExpression and evaluates to the key for Route.RequestModels. When you define a route for a WebSocket API, you can optionally specify a model selection expression. This expression is evaluated to select the model to be used for body validation when a request is received. The expression evaluates to one of the entries in a route's requestmodels. A model is expressed as a JSON schema and describes the data structure of the request body. The nature of this selection expression enables you to dynamically choose the model to validate Request validation 1215 Amazon API Gateway Developer Guide against at runtime for a particular route. For information about how to create a model, see the section called “Data models for REST APIs”. Set up request validation using the API Gateway console The following example shows you how to set up request validation on a route. First, you create a model, and then you create a route. Next, you configure request validation on the route you just created. Lastly, you deploy and test your API. To complete this tutorial, you need a WebSocket API with $request.body.action as the route selection expression and an integration endpoint for your new route. You also need wscat to connect to your API. For more information, see the section called “Use wscat to connect to a WebSocket API and send messages to it”. To create a model 1. Sign in to the API Gateway console at https://console.aws.amazon.com/apigateway. 2. Choose a WebSocket API. 3. In the main navigation pane, choose Models. 4. Choose Create model. 5. 6. 7. For Name, enter emailModel. For Content type, enter application/json. For Model schema, enter the following model: { "$schema": "http://json-schema.org/draft-04/schema#", "type" : "object", "required" : [ "address"], "properties" : { "address": { "type": "string" } } } This model requires that the request contains an email address. 8. Choose Save. Request validation 1216 Amazon API Gateway Developer Guide In this step, you create a route for your WebSocket API. To create a route 1. In the main navigation pane, choose Routes. 2. Choose Create route. 3. For Route key, enter sendMessage. 4. Choose an integration type and specify an integration endpoint. For more information see the section called “Integrations”. 5. Choose Create route. In this step, you set up request validation for the sendMessage route. To set up request validation 1. On the Route request tab, under Route request settings, choose Edit. 2. For Model selection expression, enter ${request.body.messageType}. API Gateway uses the messageType property to validate the incoming request. 3. Choose Add request model. 4. 5. For Model key, enter email. For Model, choose emailModel. API Gateway validates incoming messages with the messageType property set to email against this model. Note If API Gateway can't match the model selection expression to a model key, then it selects the $default model. If there is no $default model, then the validation fails. For production APIs, we recommend that you create a $default model. 6. Choose Save changes. In this step, you deploy and test your API. Request validation 1217 Amazon API Gateway To deploy and test your API 1. Choose Deploy API. Developer Guide 2. Choose the desired stage from the dropdown list or enter the name of a new stage. 3. Choose Deploy. 4. In the main navigation pane, choose Stages. 5. Copy your API's WebSocket URL. The URL should look like wss://abcdef123.execute- api.us-east-2.amazonaws.com/production. 6. Open a new terminal and run the wscat command with the following parameters. wscat -c wss://abcdef123.execute-api.us-west-2.amazonaws.com/production Connected (press CTRL+C to quit) 7. Use the following command to test your API. {"action": "sendMessage", "messageType": "email"} {"message": "Invalid request body", "connectionId":"ABCD1=234", "requestId":"EFGH="} API Gateway will fail the request. Use the next command to send a valid request to your API. {"action": "sendMessage", "messageType": "email", "address": "mary_major@example.com"} Data transformations for WebSocket APIs
apigateway-dg-331
apigateway-dg.pdf
331
the name of a new stage. 3. Choose Deploy. 4. In the main navigation pane, choose Stages. 5. Copy your API's WebSocket URL. The URL should look like wss://abcdef123.execute- api.us-east-2.amazonaws.com/production. 6. Open a new terminal and run the wscat command with the following parameters. wscat -c wss://abcdef123.execute-api.us-west-2.amazonaws.com/production Connected (press CTRL+C to quit) 7. Use the following command to test your API. {"action": "sendMessage", "messageType": "email"} {"message": "Invalid request body", "connectionId":"ABCD1=234", "requestId":"EFGH="} API Gateway will fail the request. Use the next command to send a valid request to your API. {"action": "sendMessage", "messageType": "email", "address": "mary_major@example.com"} Data transformations for WebSocket APIs in API Gateway In API Gateway, a WebSocket API's method request can take a payload in a different format from the corresponding integration request payload, as required in the backend. Similarly, the backend may return an integration response payload different from the method response payload, as expected by the frontend. Data transformations 1218 Amazon API Gateway Developer Guide API Gateway lets you use mapping template transformations to map the payload from a method request to the corresponding integration request and from an integration response to the corresponding method response. You create a mapping template and You specify a template selection expression to determine which template to use to perform the necessary data transformations. You can use data mappings to map data from a route request to a backend integration. To learn more, see the section called “Data mapping”. Mapping templates and models A mapping template is a script expressed in Velocity Template Language (VTL) and applied to the payload using JSONPath expressions. For more information about API Gateway mapping templates, see Mapping template transformations for REST APIs in API Gateway. The payload can have a data model according to the JSON schema draft 4. You do not have to define a model to create a mapping template. However, a model can help you create a template because API Gateway generates a template blueprint based on a provided model. For more information about API Gateway models, see Data models for REST APIs. Template selection expressions To transform a payload with a mapping template, you specify a WebSocket API template selection expression in an integration request or integration response. This expression is evaluated to determine the input or output template (if any) to use to transform either the request body into the integration request body (via an input template) or the integration response body to the route response body (via an output template). Integration.TemplateSelectionExpression supports ${request.body.jsonPath} and static values. IntegrationResponse.TemplateSelectionExpression supports ${request.body.jsonPath}, ${integration.response.statuscode}, ${integration.response.header.headerName}, ${integration.response.multivalueheader.headerName}, and static values. Integration response selection expressions When you set up an integration response for a WebSocket API, you can optionally specify an integration response selection expression. This expression determines what Data transformations 1219 Amazon API Gateway Developer Guide IntegrationResponse should be selected when an integration returns. The value of this expression is currently restricted by API Gateway, as defined below. Realize that this expression is only relevant for non-proxy integrations; a proxy integration simply passes the response payload back to the caller without modeling or modification. Unlike the other preceding selection expressions, this expression currently supports a pattern- matching format. The expression should be wrapped with forward slashes. Currently the value is fixed depending on the integrationType: • For Lambda-based integrations, it is $integration.response.body.errorMessage. • For HTTP and MOCK integrations, it is $integration.response.statuscode. • For HTTP_PROXY and AWS_PROXY, the expression isn't utilized because you're requesting that the payload pass through to the caller. Set up data mapping for WebSocket APIs in API Gateway Data mapping enables you to map data from a route request to a backend integration. Note Data mapping for WebSocket APIs isn't supported in the AWS Management Console. You must use the AWS CLI, AWS CloudFormation, or an SDK to configure data mapping. Topics • Map route request data to integration request parameters • Examples Map route request data to integration request parameters Integration request parameters can be mapped from any defined route request parameters, the request body, context or stage variables, and static values. The following table shows integration request data mapping expressions. In the table, PARAM_NAME is the name of a route request parameter of the given parameter type. It must match the regular expression '^[a-zA-Z0-9._$-]+$]'. JSONPath_EXPRESSION is a JSONPath expression for a JSON field of the request body. Data transformations 1220 Amazon API Gateway Developer Guide Mapped data source Mapping expression Request query string (supported only for the route.request.quer $connect route) ystring. PARAM_NAME Request header (supported only for the route.request.header. PARAM_NAME $connect route) Multi-value request query string (supported route.request.multivalueque only for the $connect route) rystring. PARAM_NAME Multi-value request header (supported only route.request.multivaluehea for the $connect route) der. PARAM_NAME Request body route.request.body. JSONPath_ Stage variables Context variables Static value EXPRESSION stageVariables. VARIABLE_NAME context.VARIABLE_NAME that must be one of the supported context
apigateway-dg-332
apigateway-dg.pdf
332
match the regular expression '^[a-zA-Z0-9._$-]+$]'. JSONPath_EXPRESSION is a JSONPath expression for a JSON field of the request body. Data transformations 1220 Amazon API Gateway Developer Guide Mapped data source Mapping expression Request query string (supported only for the route.request.quer $connect route) ystring. PARAM_NAME Request header (supported only for the route.request.header. PARAM_NAME $connect route) Multi-value request query string (supported route.request.multivalueque only for the $connect route) rystring. PARAM_NAME Multi-value request header (supported only route.request.multivaluehea for the $connect route) der. PARAM_NAME Request body route.request.body. JSONPath_ Stage variables Context variables Static value EXPRESSION stageVariables. VARIABLE_NAME context.VARIABLE_NAME that must be one of the supported context variables. 'STATIC_VALUE' . The STATIC_VALUE is a string literal and must be enclosed in single quotes. When you create a data mapping, using the AWS CLI make sure to follow the correct format for using literals with strings in the AWS CLI. For more information, see Using quotation marks and literals with strings in the AWS CLI in the AWS Command Line Interface User Guide. Examples The following AWS CLI examples configure data mappings. For an example AWS CloudFormation template, see websocket-data-mapping.yaml. Map a client's connectionId to a header in an integration request The following update-integration command maps a client's connectionId to a connectionId header in the request to a backend integration: Data transformations 1221 Amazon API Gateway Developer Guide aws apigatewayv2 update-integration \ --integration-id abc123 \ --api-id a1b2c3d4 \ --request-parameters 'integration.request.header.connectionId'='context.connectionId' Map a query string parameter to a header in an integration request The following example maps an authToken query string parameter to an authToken header in the integration request. 1. Use the following update-route command to add the authToken query string parameter to the route's request parameters. aws apigatewayv2 update-route --route-id 0abcdef \ --api-id a1b2c3d4 \ --request-parameters '{"route.request.querystring.authToken": {"Required": false}}' 2. Use the following update-integration command to map the query string parameter to the authToken header in the request to the backend integration. aws apigatewayv2 update-integration \ --integration-id abc123 \ --api-id a1b2c3d4 \ --request-parameters 'integration.request.header.authToken'='route.request.querystring.authToken' 3. (Optional) If necessary, use the following delete-route-request-parameter to delete the authToken query string parameter from the route's request parameters. aws apigatewayv2 delete-route-request-parameter \ --route-id 0abcdef \ --api-id a1b2c3d4 \ --request-parameter-key 'route.request.querystring.authToken' WebSocket API mapping template reference for API Gateway This section summarizes the set of variables that are currently supported for WebSocket APIs in API Gateway. Data transformations 1222 Amazon API Gateway Parameter Developer Guide Description $context.connectionId A unique ID for the connection that can be used to make a callback to the client. $context.connectedAt The Epoch-formatted connection time. $context.domainName $context.eventType $context.messageId A domain name for the WebSocket API. This can be used to make a callback to the client (instead of a hard-coded value). The event type: CONNECT, MESSAGE, or DISCONNECT . A unique server-side ID for a message. Available only when the $context. eventType is MESSAGE. $context.routeKey The selected route key. $context.requestId Same as $context.extendedRequestId . $context.extendedRequestId An automatically generated ID for the API call, which contains more useful information for debugging/troubleshooting. $context.apiId The identifier API Gateway assigns to your API. $context.authorizer.principalId The principal user identification associated with the token sent by the client and returned from an API Gateway Lambda authorizer (formerly known as a custom authorizer) Lambda function. $context.authorizer. property The stringified value of the specified key-value pair of the context map returned from an API Gateway Lambda authorizer function. For example, if the authorizer returns the following context map: Data transformations 1223 Amazon API Gateway Parameter Developer Guide Description "context" : { "key": "value", "numKey": 1, "boolKey": true } calling $context.authorizer.key returns the "value" string, calling $context.authorizer.numKey the "1" string, and calling $context. returns the authorizer.boolKey "true" string. returns $context.error.messageString The quoted value of $context.error.mes sage , namely "$context.error.me ssage" . $context.error.validationEr rorString A string containing a detailed validation error message. $context.identity.accountId $context.identity.apiKey $context.identity.apiKeyId $context.identity.caller The AWS account ID associated with the request. The API owner key associated with key-enabl ed API request. The API key ID associated with the key-enabl ed API request The principal identifier of the caller making the request. Data transformations 1224 Amazon API Gateway Parameter $context.identity.cognitoAu thenticationProvider $context.identity.cognitoAu thenticationType $context.identity.cognitoId entityId $context.identity.cognitoId entityPoolId Developer Guide Description A comma-separated list of all the Amazon Cognito authentication providers used by the caller making the request. Available only if the request was signed with Amazon Cognito credentials. For example, for an identity from an Amazon Cognito user pool, cognito-idp. region.amazonaws.com/ user_pool _id ,cognito-idp. region.amazonaw s.com/ user_pool_id :CognitoS ignIn: token subject claim For information about the available Amazon Cognito authentication providers, see Using Federated Identities in the Amazon Cognito Developer Guide. The Amazon Cognito authentication type of the caller making the request. Available only if the request was signed with Amazon Cognito credentials. Possible values include authenticated for authenticated identities and unauthenticated for unauthenticated identities. The Amazon Cognito identity ID of the caller making the request.
apigateway-dg-333
apigateway-dg.pdf
333
request. Available only if the request was signed with Amazon Cognito credentials. For example, for an identity from an Amazon Cognito user pool, cognito-idp. region.amazonaws.com/ user_pool _id ,cognito-idp. region.amazonaw s.com/ user_pool_id :CognitoS ignIn: token subject claim For information about the available Amazon Cognito authentication providers, see Using Federated Identities in the Amazon Cognito Developer Guide. The Amazon Cognito authentication type of the caller making the request. Available only if the request was signed with Amazon Cognito credentials. Possible values include authenticated for authenticated identities and unauthenticated for unauthenticated identities. The Amazon Cognito identity ID of the caller making the request. Available only if the request was signed with Amazon Cognito credentials. The Amazon Cognito identity pool ID of the caller making the request. Available only if the request was signed with Amazon Cognito credentials. Data transformations 1225 Amazon API Gateway Parameter $context.identity.sourceIp $context.identity.user Developer Guide Description The source IP address of the immediate TCP connection making the request to API Gateway endpoint. The principal identifier of the user making the request. $context.identity.userAgent The User Agent of the API caller. $context.identity.userArn The Amazon Resource Name (ARN) of the effective user identified after authentication. $context.requestTime The CLF-formatted request time (dd/MMM/yy $context.requestTimeEpoch $context.stage yy:HH:mm:ss +-hhmm ). The Epoch-formatted request time, in milliseconds. The deployment stage of the API call (for example, Beta or Prod). $context.status The response status. $input.body $input.json(x) Returns the raw payload as a string. This function evaluates a JSONPath expression and returns the results as a JSON string. For example, $input.json('$.pets') will return a JSON string representing the pets structure. For more information about JSONPath, see JSONPath or JSONPath for Java. Data transformations 1226 Amazon API Gateway Parameter $input.path(x) Developer Guide Description Takes a JSONPath expression string (x) and returns a JSON object representation of the result. This allows you to access and manipulat e elements of the payload natively in Apache Velocity Template Language (VTL). For example, if the expression $input.pa th('$.pets') returns an object like this: [ { "id": 1, "type": "dog", "price": 249.99 }, { "id": 2, "type": "cat", "price": 124.99 }, { "id": 3, "type": "fish", "price": 0.99 } ] $stageVariables. <variable_name> $input.path('$.pets').count() would return "3". For more information about JSONPath, see JSONPath or JSONPath for Java. <variable_name> represents a stage variable name. $stageVariables[' <variable _name> '] <variable_name> represents any stage variable name. Data transformations 1227 Amazon API Gateway Parameter Description Developer Guide ${stageVariables[' <variable _name> ']} <variable_name> represents any stage variable name. $util.escapeJavaScript() Escapes the characters in a string using JavaScript string rules. Note This function will turn any regular single quotes (') into escaped ones (\'). However, the escaped single quotes are not valid in JSON. Thus, when the output from this function is used in a JSON property, you must turn any escaped single quotes (\') back to regular single quotes ('). This is shown in the following example: $util.escapeJavaSc ript( data).replaceAll("\\'" ,"'") Data transformations 1228 Amazon API Gateway Parameter $util.parseJson() $util.urlEncode() $util.urlDecode() $util.base64Encode() Developer Guide Description Takes "stringified" JSON and returns an object representation of the result. You can use the result from this function to access and manipulate elements of the payload natively in Apache Velocity Template Language (VTL). For example, if you have the following payload: {"errorMessage":"{\"key1\":\"var1\", \"key2\":{\"arr\":[1,2,3]}}"} and use the following mapping template #set ($errorMessageObj = $util.par seJson($input.path('$.error Message'))) { "errorMessageObjKey2ArrVal" : $errorMessageObj.key2.arr[0] } You will get the following output: { "errorMessageObjKey2ArrVal" : 1 } Converts a string into "application/x-www- form-urlencoded" format. Decodes an "application/x-www-form-url encoded" string. Encodes the data into a base64-encoded string. Data transformations 1229 Amazon API Gateway Parameter $util.base64Decode() Developer Guide Description Decodes the data from a base64-encoded string. Binary media types for WebSocket APIs in API Gateway API Gateway WebSocket APIs don't currently support binary frames in incoming message payloads. If a client app sends a binary frame, API Gateway rejects it and disconnects the client with code 1003. There is a workaround for this behavior. If the client sends a text-encoded binary data (e.g., base64) as a text frame, you can set the integration's contentHandlingStrategy property to CONVERT_TO_BINARY to convert the payload from base64-encoded string to binary. To return a route response for a binary payload in non-proxy integrations, you can set the integration response's contentHandlingStrategy property to CONVERT_TO_TEXT to convert the payload from binary to base64-encoded string. Invoke WebSocket APIs After you've deployed your WebSocket API, client applications can connect to it and send messages to it—and your backend service can send messages to connected client applications: • You can use wscat to connect to your WebSocket API and send messages to it to simulate client behavior. See the section called “Use wscat to connect to a WebSocket API and send messages to it”. • You can use the @connections API from your backend service to send a callback message to a connected
apigateway-dg-334
apigateway-dg.pdf
334
response's contentHandlingStrategy property to CONVERT_TO_TEXT to convert the payload from binary to base64-encoded string. Invoke WebSocket APIs After you've deployed your WebSocket API, client applications can connect to it and send messages to it—and your backend service can send messages to connected client applications: • You can use wscat to connect to your WebSocket API and send messages to it to simulate client behavior. See the section called “Use wscat to connect to a WebSocket API and send messages to it”. • You can use the @connections API from your backend service to send a callback message to a connected client, get connection information, or disconnect the client. See the section called “Use @connections commands in your backend service”. • A client application can use its own WebSocket library to invoke your WebSocket API. Use wscat to connect to a WebSocket API and send messages to it The wscat utility is a convenient tool for testing a WebSocket API that you have created and deployed in API Gateway. You can install and use wscat as follows: 1. Download wscat from https://www.npmjs.com/package/wscat. Binary media types 1230 Amazon API Gateway Developer Guide 2. Install wscat by running the following command: npm install -g wscat 3. To connect to your API, run the wscat command as shown in the following example. Note that this example assumes that the Authorization setting is NONE. wscat -c wss://aabbccddee.execute-api.us-east-1.amazonaws.com/test/ You need to replace aabbccddee with the actual API ID, which is displayed in the API Gateway console or returned by the AWS CLI create-api command. In addition, if your API is in a Region other than us-east-1, you need to substitute the correct Region. 4. To test your API, enter a message such as the following while connected: {"{jsonpath-expression}":"{route-key}"} where {jsonpath-expression} is a JSONPath expression and {route-key} is a route key for the API. For example: {"action":"action1"} {"message":"test response body"} For more information about JSONPath, see JSONPath or JSONPath for Java. 5. To disconnect from your API, enter ctrl-C. Use @connections commands in your backend service Your backend service can use the following WebSocket connection HTTP requests to send a callback message to a connected client, get connection information, or disconnect the client. Important These requests use IAM authorization, so you must sign them with Signature Version 4 (SigV4). To do this, you can use the API Gateway Management API. For more information, see ApiGatewayManagementApi. Invoke 1231 Amazon API Gateway Developer Guide In the following command, you need to replace {api-id} with the actual API ID, which is displayed in the API Gateway console or returned by the AWS CLI create-api command. You must establish the connection before using this command. To send a callback message to the client, use: POST https://{api-id}.execute-api.us-east-1.amazonaws.com/{stage}/ @connections/{connection_id} You can test this request by using Postman or by calling awscurl as in the following example: awscurl --service execute-api -X POST -d "hello world" https://{prefix}.execute-api.us- east-1.amazonaws.com/{stage}/@connections/{connection_id} You need to URL-encode the command as in the following example: awscurl --service execute-api -X POST -d "hello world" https://aabbccddee.execute- api.us-east-1.amazonaws.com/prod/%40connections/R0oXAdfD0kwCH6w%3D To get the latest connection status of the client, use: GET https://{api-id}.execute-api.us-east-1.amazonaws.com/{stage}/ @connections/{connection_id} To disconnect the client, use: DELETE https://{api-id}.execute-api.us-east-1.amazonaws.com/{stage}/ @connections/{connection_id} You can dynamically build a callback URL by using the $context variables in your integration. For example, if you use Lambda proxy integration with a Node.js Lambda function, you can build the URL and send a message to a connected client as follows: import { ApiGatewayManagementApiClient, PostToConnectionCommand, } from "@aws-sdk/client-apigatewaymanagementapi"; Invoke 1232 Amazon API Gateway Developer Guide export const handler = async (event) => { const domain = event.requestContext.domainName; const stage = event.requestContext.stage; const connectionId = event.requestContext.connectionId; const callbackUrl = `https://${domain}/${stage}`; const client = new ApiGatewayManagementApiClient({ endpoint: callbackUrl }); const requestParams = { ConnectionId: connectionId, Data: "Hello!", }; const command = new PostToConnectionCommand(requestParams); try { await client.send(command); } catch (error) { console.log(error); } return { statusCode: 200, }; }; If you use a custom domain name for your WebSocket API, remove the stage variable from your function code. When sending a callback message, your Lambda function must have permission to call the API Gateway Management API. You might receive an error that contains GoneException if you post a message before the connection is established, or after the client has disconnected. Publish WebSocket APIs for customers to invoke Simply creating and developing an API Gateway API doesn't automatically make it callable by your users. To make it callable, you must deploy your API to a stage. In addition, you might want to customize the URL that your users will use to access your API. You can give it a domain that is consistent with your brand or is more memorable than the default URL for your API. In this section, you can learn how to deploy your API and customize the URL that you provide to
apigateway-dg-335
apigateway-dg.pdf
335
after the client has disconnected. Publish WebSocket APIs for customers to invoke Simply creating and developing an API Gateway API doesn't automatically make it callable by your users. To make it callable, you must deploy your API to a stage. In addition, you might want to customize the URL that your users will use to access your API. You can give it a domain that is consistent with your brand or is more memorable than the default URL for your API. In this section, you can learn how to deploy your API and customize the URL that you provide to users to access it. Publish 1233 Amazon API Gateway Note Developer Guide To augment the security of your API Gateway APIs, the execute-api. {region}.amazonaws.com domain is registered in the Public Suffix List (PSL). For further security, we recommend that you use cookies with a __Host- prefix if you ever need to set sensitive cookies in the default domain name for your API Gateway APIs. This practice will help to defend your domain against cross-site request forgery attempts (CSRF). For more information see the Set-Cookie page in the Mozilla Developer Network. Topics • Create stages for WebSocket APIs in API Gateway • Deploy WebSocket APIs in API Gateway • Security policy for WebSocket APIs in API Gateway • Custom domain names for WebSocket APIs in API Gateway Create stages for WebSocket APIs in API Gateway An API stage is a logical reference to a lifecycle state of your API (for example, dev, prod, beta, or v2). API stages are identified by their API ID and stage name, and they're included in the URL you use to invoke the API. Each stage is a named reference to a deployment of the API and is made available for client applications to call. A deployment is a snapshot of your API configuration. After you deploy an API to a stage, it’s available for clients to invoke. You must deploy an API for changes to take effect. Stage variables Stage variables are key-value pairs that you can define for a stage of a WebSocket API. They act like environment variables and can be used in your API setup. For example, you can define a stage variable, and then set its value as an HTTP endpoint for an HTTP proxy integration. Later, you can reference the endpoint by using the associated stage variable name. By doing this, you can use the same API setup with a different endpoint at each stage. Similarly, you can use stage variables to specify a different AWS Lambda function integration for each stage of your API. Stages 1234 Amazon API Gateway Note Developer Guide Stage variables are not intended to be used for sensitive data, such as credentials. To pass sensitive data to integrations, use an AWS Lambda authorizer. You can pass sensitive data to integrations in the output of the Lambda authorizer. To learn more, see the section called “Lambda authorizer response format”. Examples To use a stage variable to customize the HTTP integration endpoint, you must first set the name and value of the stage variable (for example, url) with a value of example.com. Next, set up an HTTP proxy integration. Instead of entering the endpoint's URL, you can tell API Gateway to use the stage variable value, http://${stageVariables.url}. This value tells API Gateway to substitute your stage variable ${} at runtime, depending on the stage of your API. You can reference stage variables in a similar way to specify a Lambda function name or an AWS role ARN. When specifying a Lambda function name as a stage variable value, you must configure the permissions on the Lambda function manually. The following add-permission command adds the required permissions: aws lambda add-permission --function-name arn:aws:lambda:XXXXXX:your-lambda-function- name --source-arn arn:aws:execute-api:us-east-1:YOUR_ACCOUNT_ID:api_id/*/HTTP_METHOD/ resource --principal apigateway.amazonaws.com --statement-id apigateway-access --action lambda:InvokeFunction API Gateway stage variables reference HTTP integration URIs You can use a stage variable as part of an HTTP integration URI, as shown in the following examples. • A full URI without protocol – http://${stageVariables.<variable_name>} • A full domain – http://${stageVariables.<variable_name>}/resource/operation • A subdomain – http://${stageVariables.<variable_name>}.example.com/ resource/operation Stages 1235 Amazon API Gateway Developer Guide • A path – http://example.com/${stageVariables.<variable_name>}/bar • A query string – http://example.com/foo?q=${stageVariables.<variable_name>} Lambda functions You can use a stage variable in place of a Lambda function name or alias, as shown in the following examples. • arn:aws:apigateway:<region>:lambda:path/2015-03-31/ functions/arn:aws:lambda:<region>:<account_id>:function: ${stageVariables.<function_variable_name>}/invocations • arn:aws:apigateway:<region>:lambda:path/2015-03-31/functions/ arn:aws:lambda:<region>:<account_id>:function:<function_name>: ${stageVariables.<version_variable_name>}/invocations Note To use a stage variable for a Lambda function, the function must be in the same account as the API. Stage variables don't support cross-account Lambda functions. AWS integration credentials You can use a stage variable as part of an AWS user or role credential ARN, as shown in the following example. • arn:aws:iam::<account_id>:${stageVariables.<variable_name>} Deploy WebSocket APIs in API Gateway After creating your WebSocket API, you must deploy it
apigateway-dg-336
apigateway-dg.pdf
336
functions You can use a stage variable in place of a Lambda function name or alias, as shown in the following examples. • arn:aws:apigateway:<region>:lambda:path/2015-03-31/ functions/arn:aws:lambda:<region>:<account_id>:function: ${stageVariables.<function_variable_name>}/invocations • arn:aws:apigateway:<region>:lambda:path/2015-03-31/functions/ arn:aws:lambda:<region>:<account_id>:function:<function_name>: ${stageVariables.<version_variable_name>}/invocations Note To use a stage variable for a Lambda function, the function must be in the same account as the API. Stage variables don't support cross-account Lambda functions. AWS integration credentials You can use a stage variable as part of an AWS user or role credential ARN, as shown in the following example. • arn:aws:iam::<account_id>:${stageVariables.<variable_name>} Deploy WebSocket APIs in API Gateway After creating your WebSocket API, you must deploy it to make it available for your users to invoke. To deploy an API, you create an API deployment and associate it with a stage. Each stage is a snapshot of the API and is made available for client apps to call. Deploy a WebSocket API 1236 Amazon API Gateway Important Developer Guide Every time you update an API, you must redeploy it. Changes to anything other than stage settings require a redeployment, including modifications to the following resources: • Routes • Integrations • Authorizers By default you are limited to 10 stages for each API. We recommend that you re-use stages for your deployments. To call a deployed WebSocket API, the client sends a message to the API's URL. The URL is determined by the API's hostname and stage name. Note API Gateway will support payloads up to 128 KB with a maximum frame size of 32 KB. If a message exceeds 32 KB, it must be split into multiple frames, each 32 KB or smaller. Using the API's default domain name, the URL of (for example) a WebSocket API in a given stage ({stageName}) is in the following format: wss://{api-id}.execute-api.{region}.amazonaws.com/{stageName} To make the WebSocket API's URL more user-friendly, you can create a custom domain name (e.g., api.example.com) to replace the default host name of the API. The configuration process is the same as for REST APIs. For more information, see the section called “Custom domain names”. Stages enable robust version control of your API. For example, you can deploy an API to a test stage and a prod stage, and use the test stage as a test build and use the prod stage as a stable build. After the updates pass the test, you can promote the test stage to the prod stage. The promotion can be done by redeploying the API to the prod stage. For more details about stages, see the section called “Set up a stage”. Topics Deploy a WebSocket API 1237 Amazon API Gateway Developer Guide • Create a WebSocket API deployment using the AWS CLI • Create a WebSocket API deployment using the API Gateway console Create a WebSocket API deployment using the AWS CLI The following create-deployment command creates a deployment: aws apigatewayv2 --region us-east-1 create-deployment --api-id aabbccddee The output will look like the following: { "DeploymentId": "fedcba", "DeploymentStatus": "DEPLOYED", "CreatedDate": "2018-11-15T06:49:09Z" } The deployed API is not callable until you associate the deployment with a stage. You can create a new stage or reuse a stage that you have previously created. The following create-stage command creates a new stage and associates it with the deployment: aws apigatewayv2 --region us-east-1 create-stage --api-id aabbccddee --deployment-id fedcba --stage-name test The output looks like the following: { "StageName": "test", "CreatedDate": "2018-11-15T06:50:28Z", "DeploymentId": "fedcba", "DefaultRouteSettings": { "MetricsEnabled": false, "ThrottlingBurstLimit": 5000, "DataTraceEnabled": false, "ThrottlingRateLimit": 10000.0 }, "LastUpdatedDate": "2018-11-15T06:50:28Z", "StageVariables": {}, "RouteSettings": {} Deploy a WebSocket API 1238 Amazon API Gateway } Developer Guide You can also reuse an existing stage by updating the stage's deploymentId property with the newly created deployment ID (deployment-id). The following update-stage command updates the stage's deployment ID: aws apigatewayv2 update-stage --region region \ --api-id api-id \ --stage-name stage-name \ --deployment-id deployment-id Create a WebSocket API deployment using the API Gateway console To use the API Gateway console to create a deployment for a WebSocket API: 1. Sign in to the API Gateway console and choose the API. 2. Choose Deploy API. 3. Choose the desired stage from the dropdown list or enter the name of a new stage. Security policy for WebSocket APIs in API Gateway API Gateway enforces a security policy of TLS_1_2 for all WebSocket API endpoints. A security policy is a predefined combination of minimum TLS version and cipher suites offered by Amazon API Gateway. The TLS protocol addresses network security problems such as tampering and eavesdropping between a client and server. When your clients establish a TLS handshake to your API through the custom domain, the security policy enforces the TLS version and cipher suite options your clients can choose to use. This security policy accepts TLS 1.2 and TLS 1.3 traffic and rejects TLS 1.0 traffic. Supported TLS protocols and ciphers for WebSocket APIs The following table describes
apigateway-dg-337
apigateway-dg.pdf
337
TLS_1_2 for all WebSocket API endpoints. A security policy is a predefined combination of minimum TLS version and cipher suites offered by Amazon API Gateway. The TLS protocol addresses network security problems such as tampering and eavesdropping between a client and server. When your clients establish a TLS handshake to your API through the custom domain, the security policy enforces the TLS version and cipher suite options your clients can choose to use. This security policy accepts TLS 1.2 and TLS 1.3 traffic and rejects TLS 1.0 traffic. Supported TLS protocols and ciphers for WebSocket APIs The following table describes the supported TLS protocols for WebSocket APIs. Security policy for WebSocket APIs in API Gateway 1239 Amazon API Gateway TLS protocols TLSv1.3 TLSv1.2 Developer Guide TLS_1_2 security policy Yes Yes The following table describes the TLS ciphers that are available for the TLS 1_2 security policy for WebSocket APIs. TLS ciphers TLS_AES_128_GCM_SHA256 TLS_AES_256_GCM_SHA384 TLS_CHACHA20_POLY1305_SHA256 ECDHE-ECDSA-AES128-GCM-SHA256 ECDHE-RSA-AES128-GCM-SHA256 ECDHE-ECDSA-AES128-SHA256 ECDHE-RSA-AES128-SHA256 ECDHE-ECDSA-AES256-GCM-SHA384 TLS_1_2 security policy Yes Yes Yes Yes Yes Yes Yes Yes Security policy for WebSocket APIs in API Gateway 1240 Amazon API Gateway TLS ciphers ECDHE-RSA-AES256-GCM-SHA384 ECDHE-ECDSA-AES256-SHA384 ECDHE-RSA-AES256-SHA384 AES128-GCM-SHA256 AES128-SHA256 AES256-GCM-SHA384 AES256-SHA256 Developer Guide TLS_1_2 security policy Yes Yes Yes Yes Yes Yes Yes OpenSSL and RFC cipher names OpenSSL and IETF RFC 5246, use different names for the same ciphers. For a list of the cipher names, see the section called “OpenSSL and RFC cipher names”. Information about REST APIs and HTTP APIs For more information about REST APIs and HTTP APIs, see the section called “Choose a security policy” and the section called “Security policy for HTTP APIs in API Gateway”. Custom domain names for WebSocket APIs in API Gateway Custom domain names are simpler and more intuitive URLs that you can provide to your API users. After deploying your API, you (and your customers) can invoke the API using the default base URL of the following format: Custom domain names 1241 Amazon API Gateway Developer Guide https://api-id.execute-api.region.amazonaws.com/stage where api-id is generated by API Gateway, region is the AWS Region, and stage is specified by you when deploying the API. The hostname portion of the URL, api-id.execute-api.region.amazonaws.com refers to an API endpoint. The default API endpoint name is randomly generated, difficult to recall, and not user-friendly. With custom domain names, you can set up your API's hostname, and choose a base path (for example, myservice) to map the alternative URL to your API. For example, a more user-friendly API base URL can become: https://api.example.com/myservice Considerations The following considerations might impact your use of a custom domain name. • If you map a custom domain name to a WebSocket API, you can't map it to a REST API or an HTTP API. • Only Regional custom domain names are supported. • For the minimum TLS version, only TLS 1.2 is supported. • You must create or update your DNS provider's resource record to map to your API endpoint. Without such a mapping, API requests bound for the custom domain name cannot reach API Gateway. • You can support an almost infinite number of domain names without exceeding the default quota by using a wildcard certificate. For more information, see the section called “Wildcard custom domain names”. Prerequisites The following are prerequisites for a custom domain name. Register a domain name You must have a registered internet domain name in order to set up custom domain names for your APIs. You can register your internet domain name using Amazon Route 53 or using a third- Custom domain names 1242 Amazon API Gateway Developer Guide party domain registrar of your choice. Your custom domain name can be the name of a subdomain or the root domain (also known as the "zone apex") of a registered internet domain. Your domain name must follow the RFC 1035 specification and can have a maximum of 63 octets per label and 255 octets in total. Certificates for custom domain names Before setting up a custom domain name for an API, you must have an SSL/TLS certificate ready in ACM. If ACM is not available in the AWS Region where you are creating your custom domain name, you must import a certificate to API Gateway in that Region. To import an SSL/TLS certificate, you must provide the PEM-formatted SSL/TLS certificate body, its private key, and the certificate chain for the custom domain name. Each certificate stored in ACM is identified by its ARN. With certificates issued by ACM, you do not have to worry about exposing any sensitive certificate details, such as the private key. To use an AWS managed certificate for a domain name, you simply reference its ARN. If your application uses certificate pinning, sometimes known as SSL pinning, to pin an ACM certificate, the application might not be able to connect to your domain
apigateway-dg-338
apigateway-dg.pdf
338
Region. To import an SSL/TLS certificate, you must provide the PEM-formatted SSL/TLS certificate body, its private key, and the certificate chain for the custom domain name. Each certificate stored in ACM is identified by its ARN. With certificates issued by ACM, you do not have to worry about exposing any sensitive certificate details, such as the private key. To use an AWS managed certificate for a domain name, you simply reference its ARN. If your application uses certificate pinning, sometimes known as SSL pinning, to pin an ACM certificate, the application might not be able to connect to your domain after AWS renews the certificate. For more information, see Certificate pinning problems in the AWS Certificate Manager User Guide. Wildcard custom domain names With wildcard custom domain names, you can support an almost infinite number of domain names without exceeding the default quota. For example, you could give each of your customers their own domain name, customername.api.example.com. To create a wildcard custom domain name, specify a wildcard (*) as the first subdomain of a custom domain that represents all possible subdomains of a root domain. For example, the wildcard custom domain name *.example.com results in subdomains such as a.example.com, b.example.com, and c.example.com, which all route to the same domain. Wildcard custom domain names support distinct configurations from API Gateway's standard custom domain names. For example, in a single AWS account, you can configure *.example.com and a.example.com to behave differently. Custom domain names 1243 Amazon API Gateway Developer Guide You can use the $context.domainName and $context.domainPrefix context variables to determine the domain name that a client used to call your API. To learn more about context variables, see Variables for data transformations for API Gateway. To create a wildcard custom domain name, you must provide a certificate issued by ACM that has been validated using either the DNS or the email validation method. Note You can't create a wildcard custom domain name if a different AWS account has created a custom domain name that conflicts with the wildcard custom domain name. For example, if account A has created a.example.com, then account B can't create the wildcard custom domain name *.example.com. If account A and account B share an owner, you can contact the AWS Support Center to request an exception. Next steps for custom domain names To set up a custom domain name for an HTTP API, you use documentation from the REST API section of the API Gateway Developer Guide. First, specify a certificate for your custom domain name. For more information, see the section called “Get certificates ready in AWS Certificate Manager”. Next, you create a Regional custom domain name. For more information, see the section called “Set up a Regional custom domain name”. Map API stages to a custom domain name for WebSocket APIs You use API mappings to connect API stages to a custom domain name. After you create a domain name and configure DNS records, you use API mappings to send traffic to your APIs through your custom domain name. An API mapping specifies an API, a stage, and optionally a path to use for the mapping. For example, you can map the production stage of an API to wss://api.example.com/orders. Before you create an API mapping, you must have an API, a stage, and a custom domain name. To learn more about creating a custom domain name, see the section called “Set up a Regional custom domain name”. Custom domain names 1244 Amazon API Gateway Restrictions Developer Guide • In an API mapping, the custom domain name and mapped APIs must be in the same AWS account. • API mappings must contain only letters, numbers, and the following characters: $-_.+!*'(). • The maximum length for the path in an API mapping is 300 characters. • You can't map WebSocket APIs to the same custom domain name as an HTTP API or REST API. • If you create an API mappings with multiple levels, API Gateway converts all header names to lowercase. Create an API mapping To create an API mapping, you must first create a custom domain name, API, and stage. For information about creating a custom domain name, see the section called “Set up a Regional custom domain name”. AWS Management Console To create an API mapping 1. Sign in to the API Gateway console at https://console.aws.amazon.com/apigateway. 2. Choose Custom domain names. 3. Select a custom domain name that you've already created. 4. Choose API mappings. 5. Choose Configure API mappings. 6. Choose Add new mapping. 7. Enter an API, a Stage, and optionally a Path. 8. Choose Save. AWS CLI The following create-api-mapping command creates an API mapping. In this example, API Gateway sends requests to api.example.com/v1 to the specified API and stage. aws apigatewayv2 create-api-mapping \ Custom domain names 1245 Amazon API Gateway
apigateway-dg-339
apigateway-dg.pdf
339
Regional custom domain name”. AWS Management Console To create an API mapping 1. Sign in to the API Gateway console at https://console.aws.amazon.com/apigateway. 2. Choose Custom domain names. 3. Select a custom domain name that you've already created. 4. Choose API mappings. 5. Choose Configure API mappings. 6. Choose Add new mapping. 7. Enter an API, a Stage, and optionally a Path. 8. Choose Save. AWS CLI The following create-api-mapping command creates an API mapping. In this example, API Gateway sends requests to api.example.com/v1 to the specified API and stage. aws apigatewayv2 create-api-mapping \ Custom domain names 1245 Amazon API Gateway Developer Guide --domain-name api.example.com \ --api-mapping-key v1 \ --api-id a1b2c3d4 \ --stage test AWS CloudFormation The following AWS CloudFormation example creates an API mapping. MyApiMapping: Type: 'AWS::ApiGatewayV2::ApiMapping' Properties: DomainName: api.example.com ApiMappingKey: 'v1' ApiId: !Ref MyApi Stage: !Ref MyStage IP address types for custom domain names for WebSocket APIs When you create an custom domain name, you specify the type of IP addresses that can invoke your domain. You can choose IPv4 to allow IPv4 addresses to invoke your domain, or you can choose dualstack to allow both IPv4 and IPv6 addresses to invoke your domain. We recommend that you set the IP address type to dualstack to alleviate IP space exhaustion or for your security posture. For more information about the benefits of a dualstack IP address type, see IPv6 on AWS. Considerations for IP address types The following considerations might impact your use of IP address types. • The default IP address type for API Gateway custom domain names is IPv4. • Your custom domain name doesn't need to have the same IP address type for all APIs mapped to it. If you disable your default API endpoint, this might affect how callers can invoke your API. Change the IP address type of custom domain name You can change the IP address type by updating the domain name's endpoint configuration. You can update the endpoint configuration by using the AWS Management Console, the AWS CLI, AWS CloudFormation, or an AWS SDK. Custom domain names 1246 Amazon API Gateway AWS Management Console Developer Guide To change the IP address type of a custom domain name 1. Sign in to the API Gateway console at https://console.aws.amazon.com/apigateway. 2. Choose a public custom domain name. 3. Choose Endpoint configuration. 4. For IP address type, select either IPv4 or Dualstack. 5. Choose Save. AWS CLI The following update-domain-name command updates an API to have an IP address type of dualstack: aws apigatewayv2 update-domain-name \ --domain-name dualstack.example.com \ --domain-name-configurations CertificateArn=arn:aws:acm:us- east-1:111122223333:certificate/abcd1234-5678-abc,IpAddressType=dualstack The output will look like the following: { "ApiMappingSelectionExpression": "$request.basepath", "DomainName": "dualstack.elliesf.people.aws.dev", "DomainNameConfigurations": [ { "ApiGatewayDomainName": "d-abcd1234.execute-api.us- east-1.amazonaws.com", "CertificateArn": "arn:aws:acm:us-east-1:111122223333:certificate/ abcd1234-5678-abc", "DomainNameStatus": "AVAILABLE", "EndpointType": "REGIONAL", "HostedZoneId": "Z3LQWSYCGH4ADY", "SecurityPolicy": "TLS_1_2", "IpAddressType": "dualstack" } ], "Tags": {} } Custom domain names 1247 Amazon API Gateway Developer Guide Disable the default endpoint for WebSocket APIs By default, clients can invoke your API by using the execute-api endpoint that API Gateway generates for your API. To ensure that clients can access your API only by using a custom domain name, disable the default execute-api endpoint. When you disable the default endpoint, it affects all stages of an API. The following procedure shows how to disable the default endpoint for a WebSocket API. AWS Management Console 1. Sign in to the API Gateway console at https://console.aws.amazon.com/apigateway. 2. Choose an WebSocket API. 3. Choose API settings. 4. On API details, choose Edit. 5. For Default endpoint, select Inactive. 6. Choose Save changes. 7. On the main navigation pane, choose Routes. 8. Choose Deploy, and then redeploy your API or create a new stage for the change to take effect. AWS CLI The following update-api command disables the default endpoint for an WebSocket API: aws apigatewayv2 update-api \ --api-id abcdef123 \ --disable-execute-api-endpoint After you disable the default endpoint, you must deploy your API for the change to take effect. The following AWS CLI command creates a deployment. aws apigatewayv2 create-deployment \ --api-id abcdef123 \ --stage-name dev Custom domain names 1248 Amazon API Gateway Developer Guide Protect your WebSocket APIs in API Gateway API Gateway provides a number of ways to protect your API from certain threats, like malicious users or spikes in traffic. You can protect your API using strategies like generating SSL certificates or setting throttling targets. For more information about generating SSL certificates, see the section called “Client certificates”. The rest of this section covers setting throttling targets. You can configure throttling for your APIs to help protect them from being overwhelmed by too many requests. Throttles are applied on a best-effort basis and should be thought of as targets rather than guaranteed request ceilings. API Gateway throttles requests to your API using the token bucket algorithm, where a token counts for a request. Specifically, API Gateway examines the
apigateway-dg-340
apigateway-dg.pdf
340
in traffic. You can protect your API using strategies like generating SSL certificates or setting throttling targets. For more information about generating SSL certificates, see the section called “Client certificates”. The rest of this section covers setting throttling targets. You can configure throttling for your APIs to help protect them from being overwhelmed by too many requests. Throttles are applied on a best-effort basis and should be thought of as targets rather than guaranteed request ceilings. API Gateway throttles requests to your API using the token bucket algorithm, where a token counts for a request. Specifically, API Gateway examines the rate and a burst of request submissions against all APIs in your account, per Region. In the token bucket algorithm, a burst can allow pre- defined overrun of those limits, but other factors can also cause limits to be overrun in some cases. When request submissions exceed the steady-state request rate and burst limits, API Gateway begins to throttle requests. Clients may receive 429 Too Many Requests error responses at this point. Upon catching such exceptions, the client can resubmit the failed requests in a way that is rate limiting. As an API developer, you can set the target limits for individual API stages or routes to improve overall performance across all APIs in your account. Account-level throttling per Region By default, API Gateway limits the steady-state requests per second (RPS) across all APIs within an AWS account, per Region. It also limits the burst (that is, the maximum bucket size) across all APIs within an AWS account, per Region. In API Gateway, the burst limit represents the target maximum number of concurrent request submissions that API Gateway will fulfill before returning 429 Too Many Requests error responses. For more information on throttling quotas, see Quotas and important notes. Per-account limits are applied to all APIs in an account in a specified Region. The account-level rate limit can be increased upon request - higher limits are possible with APIs that have shorter timeouts and smaller payloads. To request an increase of account-level throttling limits per Region, contact the AWS Support Center. For more information, see Quotas and important notes. Note that these limits can't be higher than the AWS throttling limits. Protect 1249 Amazon API Gateway Route-level throttling Developer Guide You can set route-level throttling to override the account-level request throttling limits for a specific stage or for individual routes in your API. The default route throttling limits can't exceed account-level rate limits. You can configure route-level throttling by using the AWS CLI. The following update-stage command configures custom throttling for the specified stage and route of an API: aws apigatewayv2 update-stage \ --api-id a1b2c3d4 \ --stage-name dev \ --route-settings '{"messages": {"ThrottlingBurstLimit":100,"ThrottlingRateLimit":2000}}' Monitor WebSocket APIs in API Gateway You can use CloudWatch metrics and CloudWatch Logs to monitor WebSocket APIs. By combining logs and metrics, you can log errors and monitor your API's performance. Note API Gateway might not generate logs and metrics in the following cases: • 413 Request Entity Too Large errors • Excessive 429 Too Many Requests errors • 400 series errors from requests sent to a custom domain that has no API mapping • 500 series errors caused by internal failures Topics • Monitor WebSocket API execution with CloudWatch metrics • Configure logging for WebSocket APIs in API Gateway Route-level throttling 1250 Amazon API Gateway Developer Guide Monitor WebSocket API execution with CloudWatch metrics You can use Amazon CloudWatch metrics to monitor WebSocket APIs. The configuration is similar to that used for REST APIs. For more information, see Monitor REST API execution with Amazon CloudWatch metrics. The following metrics are supported for WebSocket APIs: Metric ConnectCount MessageCount IntegrationError ClientError ExecutionError IntegrationLatency Description The number of messages sent to the $connect route integration. The number of messages sent to the WebSocket API, either from or to the client. The number of requests that return a 4XX/5XX response from the integration. The number of requests that have a 4XX response returned by API Gateway before the integration is invoked. Errors that occurred when calling the integration. The time difference between API Gateway sending the request to the integration and API Gateway receiving the response from the integrati on. Suppressed for callbacks and mock integrations. Metrics 1251 Amazon API Gateway Developer Guide You can use the dimensions in the following table to filter API Gateway metrics. Dimension ApiId ApiId, Stage ApiId, Method, Resource, Stage Description Filters API Gateway metrics for an API with the specified API ID. Filters API Gateway metrics for an API stage with the specified API ID and stage ID. Filters API Gateway metrics for an API method with the specified API ID, stage ID, resource path, and route ID. API Gateway will not send these metrics unless you have explicitly enabled detailed CloudWatch metrics. You
apigateway-dg-341
apigateway-dg.pdf
341
Suppressed for callbacks and mock integrations. Metrics 1251 Amazon API Gateway Developer Guide You can use the dimensions in the following table to filter API Gateway metrics. Dimension ApiId ApiId, Stage ApiId, Method, Resource, Stage Description Filters API Gateway metrics for an API with the specified API ID. Filters API Gateway metrics for an API stage with the specified API ID and stage ID. Filters API Gateway metrics for an API method with the specified API ID, stage ID, resource path, and route ID. API Gateway will not send these metrics unless you have explicitly enabled detailed CloudWatch metrics. You can do this by calling the UpdateStage action of the API Gateway V2 REST API to update the detailedM property etricsEnabled to true. Alternatively, you can call the update-stage AWS CLI command to update the DetailedMetricsEna bled property to true. Enabling such metrics will incur additional charges to your account. For pricing information, see Amazon CloudWatch Pricing. Metrics 1252 Amazon API Gateway Developer Guide Configure logging for WebSocket APIs in API Gateway You can enable logging to write logs to CloudWatch Logs. There are two types of API logging in CloudWatch: execution logging and access logging. In execution logging, API Gateway manages the CloudWatch Logs. The process includes creating log groups and log streams, and reporting to the log streams any caller's requests and responses. To improve your security posture, we recommend that you use execution logging at the ERROR or INFO level. You might need to do this to comply with various compliance frameworks. For more information, see Amazon API Gateway controls in the AWS Security Hub User Guide. In access logging, you, as an API developer, want to log who has accessed your API and how the caller accessed the API. You can create your own log group or choose an existing log group that could be managed by API Gateway. To specify the access details, you select $context variables (expressed in a format of your choosing) and choose a log group as the destination. For instructions on how to set up CloudWatch logging, see the section called “Set up CloudWatch API logging using the API Gateway console”. When you specify the Log Format, you can choose which context variables to log. The following variables are supported. Parameter Description $context.apiId The identifier API Gateway assigns to your API. $context.authorize.error The authorization error message. $context.authorize.latency The authorization latency in ms. $context.authorize.status $context.authorizer.error The status code returned from an authoriza tion attempt. The error message returned from an authorize r. $context.authorizer.integra The Lambda authorizer latency in ms. tionLatency Logging 1253 Amazon API Gateway Parameter Description Developer Guide $context.authorizer.integra tionStatus The status code returned from a Lambda authorizer. $context.authorizer.latency The authorizer latency in ms. $context.authorizer.requestId The AWS endpoint's request ID. $context.authorizer.status The status code returned from an authorizer. $context.authorizer.principalId The principal user identification that is associated with the token sent by the client and returned from an API Gateway Lambda authorizer Lambda function. (A Lambda authorizer was formerly known as a custom authorizer.) $context.authorizer. property The stringified value of the specified key-value pair of the context map returned from an API Gateway Lambda authorizer function. For example, if the authorizer returns the following context map: "context" : { "key": "value", "numKey": 1, "boolKey": true } calling $context.authorizer.key returns the "value" string, calling $context.authorizer.numKey the "1" string, and calling $context. returns the authorizer.boolKey "true" string. returns Logging 1254 Amazon API Gateway Parameter Description Developer Guide $context.authenticate.error The error message returned from an authentic ation attempt. $context.authenticate.latency The authentication latency in ms. $context.authenticate.status The status code returned from an authentic ation attempt. $context.connectedAt The Epoch-formatted connection time. $context.connectionId $context.domainName $context.error.message $context.error.messageString A unique ID for the connection that can be used to make a callback to the client. A domain name for the WebSocket API. This can be used to make a callback to the client (instead of a hardcoded value). A string that contains an API Gateway error message. The quoted value of $context.error.mes sage , namely "$context.error.me ssage" . $context.error.responseType The error response type. $context.error.validationEr rorString A string that contains a detailed validation error message. $context.eventType The event type: CONNECT, MESSAGE, or DISCONNECT . $context.extendedRequestId Equivalent to $context.requestId . $context.identity.accountId The AWS account ID associated with the request. Logging 1255 Amazon API Gateway Parameter $context.identity.apiKey $context.identity.apiKeyId $context.identity.caller $context.identity.cognitoAu thenticationProvider $context.identity.cognitoAu thenticationType Developer Guide Description The API owner key associated with key-enabl ed API request. The API key ID associated with the key-enabl ed API request The principal identifier of the caller that signed the request. Supported for routes that use IAM authorization. A comma-separated list of all the Amazon Cognito authentication providers used by the caller making the request. Available only if the request was signed with Amazon Cognito credentials. For example, for an identity from an Amazon Cognito user pool,
apigateway-dg-342
apigateway-dg.pdf
342
AWS account ID associated with the request. Logging 1255 Amazon API Gateway Parameter $context.identity.apiKey $context.identity.apiKeyId $context.identity.caller $context.identity.cognitoAu thenticationProvider $context.identity.cognitoAu thenticationType Developer Guide Description The API owner key associated with key-enabl ed API request. The API key ID associated with the key-enabl ed API request The principal identifier of the caller that signed the request. Supported for routes that use IAM authorization. A comma-separated list of all the Amazon Cognito authentication providers used by the caller making the request. Available only if the request was signed with Amazon Cognito credentials. For example, for an identity from an Amazon Cognito user pool, cognito-idp. region.amazonaws.com/ user_pool _id ,cognito-idp. region.amazonaw s.com/ user_pool_id :CognitoS ignIn: token subject claim For information about the available Amazon Cognito authentication providers, see Using Federated Identities in the Amazon Cognito Developer Guide. The Amazon Cognito authentication type of the caller making the request. Available only if the request was signed with Amazon Cognito credentials. Possible values include authenticated for authenticated identities and unauthenticated for unauthenticated identities. Logging 1256 Amazon API Gateway Parameter $context.identity.cognitoId entityId $context.identity.cognitoId entityPoolId Developer Guide Description The Amazon Cognito identity ID of the caller making the request. Available only if the request was signed with Amazon Cognito credentials. The Amazon Cognito identity pool ID of the caller making the request. Available only if the request was signed with Amazon Cognito credentials. $context.identity.principalOrgId The AWS organization ID. Supported for routes that use IAM authorization. $context.identity.sourceIp $context.identity.user The source IP address of the TCP connection making the request to API Gateway. The principal identifier of the user that will be authorized against resource access. Supported for routes that use IAM authorization. $context.identity.userAgent The user agent of the API caller. $context.identity.userArn $context.integration.error $context.integration.integr ationStatus The Amazon Resource Name (ARN) of the effective user identified after authentication. The error message returned from an integrati on. For Lambda proxy integration, the status code returned from AWS Lambda, not from the backend Lambda function code. $context.integration.latency The integration latency in ms. Equivalent to $context.integrationLatency . $context.integration.requestId The AWS endpoint's request ID. Equivalent to $context.awsEndpointRequestId . Logging 1257 Amazon API Gateway Parameter $context.integration.status $context.integrationLatency $context.messageId Developer Guide Description The status code returned from an integrati on. For Lambda proxy integrations, this is the status code that your Lambda function code returns. Equivalent to $context. integrationStatus . The integration latency in ms, available for access logging only. A unique server-side ID for a message. Available only when the $context. eventType is MESSAGE. $context.requestId Same as $context.extendedRequestId . $context.requestTime The CLF-formatted request time (dd/MMM/yy $context.requestTimeEpoch yy:HH:mm:ss +-hhmm ). The Epoch-formatted request time, in milliseconds. $context.routeKey The selected route key. $context.stage The deployment stage of the API call (for example, beta or prod). $context.status The response status. $context.waf.error The error message returned from AWS WAF. $context.waf.latency The AWS WAF latency in ms. $context.waf.status The status code returned from AWS WAF. Examples of some commonly used access log formats are shown in the API Gateway console and are listed as follows. Logging 1258 Amazon API Gateway • CLF (Common Log Format): Developer Guide $context.identity.sourceIp $context.identity.caller \ $context.identity.user [$context.requestTime] "$context.eventType $context.routeKey $context.connectionId" \ $context.status $context.requestId The continuation characters (\) are meant as a visual aid. The log format must be a single line. You can add a newline character (\n) at the end of the log format to include a newline at the end of each log entry. • JSON: { "requestId":"$context.requestId", \ "ip": "$context.identity.sourceIp", \ "caller":"$context.identity.caller", \ "user":"$context.identity.user", \ "requestTime":"$context.requestTime", \ "eventType":"$context.eventType", \ "routeKey":"$context.routeKey", \ "status":"$context.status", \ "connectionId":"$context.connectionId" } The continuation characters (\) are meant as a visual aid. The log format must be a single line. You can add a newline character (\n) at the end of the log format to include a newline at the end of each log entry. • XML: <request id="$context.requestId"> \ <ip>$context.identity.sourceIp</ip> \ <caller>$context.identity.caller</caller> \ <user>$context.identity.user</user> \ <requestTime>$context.requestTime</requestTime> \ <eventType>$context.eventType</eventType> \ <routeKey>$context.routeKey</routeKey> \ <status>$context.status</status> \ <connectionId>$context.connectionId</connectionId> \ </request> Logging 1259 Amazon API Gateway Developer Guide The continuation characters (\) are meant as a visual aid. The log format must be a single line. You can add a newline character (\n) at the end of the log format to include a newline at the end of each log entry. • CSV (comma-separated values): $context.identity.sourceIp,$context.identity.caller, \ $context.identity.user,$context.requestTime,$context.eventType, \ $context.routeKey,$context.connectionId,$context.status, \ $context.requestId The continuation characters (\) are meant as a visual aid. The log format must be a single line. You can add a newline character (\n) at the end of the log format to include a newline at the end of each log entry. Logging 1260 Amazon API Gateway Developer Guide API Gateway Amazon Resource Name (ARN) reference The following tables list the Amazon Resource Names (ARNs) for API Gateway resources. To learn more about using ARNs in AWS Identity and Access Management policies, see How Amazon API Gateway works with IAM and Control
apigateway-dg-343
apigateway-dg.pdf
343
$context.identity.sourceIp,$context.identity.caller, \ $context.identity.user,$context.requestTime,$context.eventType, \ $context.routeKey,$context.connectionId,$context.status, \ $context.requestId The continuation characters (\) are meant as a visual aid. The log format must be a single line. You can add a newline character (\n) at the end of the log format to include a newline at the end of each log entry. Logging 1260 Amazon API Gateway Developer Guide API Gateway Amazon Resource Name (ARN) reference The following tables list the Amazon Resource Names (ARNs) for API Gateway resources. To learn more about using ARNs in AWS Identity and Access Management policies, see How Amazon API Gateway works with IAM and Control access to a REST API with IAM permissions. HTTP API and WebSocket API resources Resource AccessLogSettings Api Apis ApiMapping ARN arn:partition :apigatew ay: region::/apis/api-id/ stages/stage-name /accesslo gsettings arn:partition :apigatew ay: region::/apis/api-id arn:partition :apigatew ay: region::/apis arn:partition :apigatew ay: region::/domainnames/ domain-na me /apimappings/ id ApiMappings arn:partition :apigatew Authorizer Authorizers ay: region::/domainnames/ domain-na me /apimappings arn:partition :apigatew ay: region::/apis/api-id/authoriz ers/ id arn:partition :apigatew ay: region::/apis/api-id/authoriz ers HTTP API and WebSocket API resources 1261 Amazon API Gateway Resource Cors Deployment Deployments Developer Guide ARN arn:partition :apigatew ay: region::/apis/api-id/cors arn:partition :apigatew ay: region::/apis/api-id/deployme nts/ id arn:partition :apigatew ay: region::/apis/api-id/deployme nts DomainName arn:partition :apigatew DomainNames ExportedAPI Integration Integrations ay: region::/domainnames/ domain-na me arn:partition :apigatew ay: region::/domainnames arn:partition :apigatew ay: region::/apis/api-id/exports/ specification arn:partition :apigatew ay: region::/apis/api-id/integrat ions/ integration-id arn:partition :apigatew ay: region::/apis/api-id/integrat ions IntegrationResponse arn:partition :apigatew ay: region::/apis/api-id/integrat ionresponses/ integration-respon se HTTP API and WebSocket API resources 1262 Amazon API Gateway Resource ARN Developer Guide IntegrationResponses arn:partition :apigatew Model Models ay: region::/apis/api-id/integrat ionresponses arn:partition :apigatew ay: region::/apis/api-id/models/id arn:partition :apigatew ay: region::/apis/api-id/models ModelTemplate arn:partition :apigatew Route Routes ay: region::/apis/api-id/models/id/ template arn:partition :apigatew ay: region::/apis/api-id/routes/id arn:partition :apigatew ay: region::/apis/api-id/routes RouteRequestParameter arn:partition :apigatew ay: region::/apis/api-id/routes/id/ requestparameters/ key RouteResponse arn:partition :apigatew ay: region::/apis/api-id/routes/id/ routeresponses/ id RouteResponses arn:partition :apigatew RouteSettings ay: region::/apis/api-id/routes/id/ routeresponses arn:partition :apigatew ay: region::/apis/api-id/ stages/stage-name /routeset tings/ route-key HTTP API and WebSocket API resources 1263 Amazon API Gateway Resource Stage Stages VpcLink VpcLinks REST API resources Resource Account ApiKey ApiKeys Authorizer Authorizers Developer Guide ARN arn:partition :apigatew ay: region::/apis/api-id/ stages/stage-name arn:partition :apigatew ay: region::/apis/api-id/stages arn:partition :apigatew ay: region::/vpclinks/ vpclink-id arn:partition :apigatew ay: region::/vpclinks ARN arn:partition :apigatew ay: region::/account arn:partition :apigatew ay: region::/apikeys/ id arn:partition :apigatew ay: region::/apikeys arn:partition :apigatew ay: region::/restapis/ api-id/ authorizers/ id arn:partition :apigatew ay: region::/restapis/ api-id/ authorizers REST API resources 1264 Amazon API Gateway Resource ARN Developer Guide BasePathMapping arn:partition :apigatew ay: region::/domainnames/ domain-na me /basepathmappings/ basepath BasePathMappings arn:partition :apigatew ay: region::/domainnames/ domain-na me /basepathmappings ClientCertificate ClientCertificates Deployment Deployments DocumentationPart DocumentationParts arn:partition :apigatew ay: region::/clientcertifica tes/ id arn:partition :apigatew ay: region::/clientcertificates arn:partition :apigatew ay: region::/restapis/ api-id/ deployments/ id arn:partition :apigatew ay: region::/restapis/ api-id/ deployments arn:partition :apigatew ay: region::/restapis/ api-id/ documentation/parts/ id arn:partition :apigatew ay: region::/restapis/ api-id/ documentation/parts DocumentationVersion arn:partition :apigatew ay: region::/restapis/ api-id/ documentation/versions/ version REST API resources 1265 Amazon API Gateway Resource DocumentationVersions Developer Guide ARN arn:partition :apigatew ay: region::/restapis/ api-id/ documentation/versions DomainName arn:partition :apigatew ay: region::/domainnames/ domain-na me DomainNameAccessAssociation arn:partition :apigatew ay: region:account-id :/domainn ameaccessassociations/domai nname/ domain-name /vpcesour ce/ vpce-source-id DomainNameAccessAssociations arn:partition :apigatew DomainNames GatewayResponse GatewayResponses Integration ay: region:account-id :/domainn ameaccessassociations arn:partition :apigatew ay: region::/domainnames arn:partition :apigatew ay: region::/restapis/ api-id/ gatewayresponses/ response-type arn:partition :apigatew ay: region::/restapis/ api-id/ gatewayresponses arn:partition :apigatew ay: region::/restapis/ api-id/ resources/ resource-id /methods/ http-method /integration REST API resources 1266 Amazon API Gateway Resource ARN Developer Guide IntegrationResponse arn:partition :apigatew Method MethodResponse Model Models ay: region::/restapis/ api-id/ resources/ resource-id /methods/ http-method /integration/respo nses/ status-code arn:partition :apigatew ay: region::/restapis/ api-id/ resources/ resource-id /methods/ http-method arn:partition :apigatew ay: region::/restapis/ api-id/ resources/ resource-id /methods/ http-method /responses/ status-co de arn:partition :apigatew ay: region::/restapis/ api-id/ models/model-name arn:partition :apigatew ay: region::/restapis/ api-id/ models PrivateDomainName arn:partition :apigatew RequestValidator RequestValidators ay: region:account-id :/domainn ames/ domain-name arn:partition :apigatew ay: region::/restapis/ api-id/ requestvalidators/ id arn:partition :apigatew ay: region::/restapis/ api-id/ requestvalidators REST API resources 1267 Amazon API Gateway Resource Resource Resources RestApi RestApis Stage Stages Tags Template UsagePlan UsagePlans Developer Guide ARN arn:partition :apigatew ay: region::/restapis/ api-id/ resources/ id arn:partition :apigatew ay: region::/restapis/ api-id/ resources arn:partition :apigatew ay: region::/restapis/ api-id arn:partition :apigatew ay: region::/restapis arn:partition :apigatew ay: region::/restapis/ api-id/ stages/stage-name arn:partition :apigatew ay: region::/restapis/ api-id/ stages arn:partition :apigatew ay: region::/tags/url-encoded- resource-arn arn:partition :apigatew ay: region::/restapis/models / model-name /template arn:partition :apigatew ay: region::/usageplans/ usageplan -id arn:partition :apigatew ay: region::/usageplans REST API resources 1268 Amazon API Gateway Resource UsagePlanKey Developer Guide ARN arn:partition :apigatew ay: region::/usageplans/ usageplan -id /keys/id UsagePlanKeys arn:partition :apigatew VpcLink VpcLinks ay: region::/usageplans/ usageplan -id /keys arn:partition :apigatew ay: region::/vpclinks/ vpclink-id arn:partition :apigatew ay: region::/vpclinks execute-api (HTTP APIs, WebSocket APIs, and REST APIs) Resource ARN WebSocket API endpoint arn:partition :execute- api: region:account-id :api- id/stage/route-key HTTP API and REST API endpoint * arn:partition :execute- Lambda authorizer ** api: region:account-id :api- id/stage/http-method /resource- path arn:partition :execute- api: region:account-id :api-id/ authorizers/ authorizer-id * The ARN for the $default route endpoint for HTTP APIs is arn:partition:execute- api:region:account-id:api-id/*/$default. execute-api (HTTP APIs, WebSocket APIs, and REST APIs)
apigateway-dg-344
apigateway-dg.pdf
344
Amazon API Gateway Resource UsagePlanKey Developer Guide ARN arn:partition :apigatew ay: region::/usageplans/ usageplan -id /keys/id UsagePlanKeys arn:partition :apigatew VpcLink VpcLinks ay: region::/usageplans/ usageplan -id /keys arn:partition :apigatew ay: region::/vpclinks/ vpclink-id arn:partition :apigatew ay: region::/vpclinks execute-api (HTTP APIs, WebSocket APIs, and REST APIs) Resource ARN WebSocket API endpoint arn:partition :execute- api: region:account-id :api- id/stage/route-key HTTP API and REST API endpoint * arn:partition :execute- Lambda authorizer ** api: region:account-id :api- id/stage/http-method /resource- path arn:partition :execute- api: region:account-id :api-id/ authorizers/ authorizer-id * The ARN for the $default route endpoint for HTTP APIs is arn:partition:execute- api:region:account-id:api-id/*/$default. execute-api (HTTP APIs, WebSocket APIs, and REST APIs) 1269 Amazon API Gateway Developer Guide ** This ARN is applicable only when setting the SourceArn condition in the resource policy for a Lambda authorizer function. For an example, see the section called “Create a Lambda authorizer”. execute-api (HTTP APIs, WebSocket APIs, and REST APIs) 1270 Amazon API Gateway Developer Guide OpenAPI extensions for API Gateway The API Gateway extensions support the AWS-specific authorization and API Gateway-specific API integrations for REST APIs and HTTP APIs. In this section, we describe the API Gateway extensions to the OpenAPI specification. Tip To understand how the API Gateway extensions are used in an application, you can use the API Gateway console to create a REST API or HTTP API and export it to an OpenAPI definition file. For more information on how to export an API, see Export a REST API from API Gateway and Export HTTP APIs from API Gateway. Topics • x-amazon-apigateway-any-method object • x-amazon-apigateway-cors object • x-amazon-apigateway-api-key-source property • x-amazon-apigateway-auth object • x-amazon-apigateway-authorizer object • x-amazon-apigateway-authtype property • x-amazon-apigateway-binary-media-types property • x-amazon-apigateway-documentation object • x-amazon-apigateway-endpoint-configuration object • x-amazon-apigateway-gateway-responses object • x-amazon-apigateway-gateway-responses.gatewayResponse object • x-amazon-apigateway-gateway-responses.responseParameters object • x-amazon-apigateway-gateway-responses.responseTemplates object • x-amazon-apigateway-importexport-version • x-amazon-apigateway-integration object • x-amazon-apigateway-integrations object • x-amazon-apigateway-integration.requestTemplates object • x-amazon-apigateway-integration.requestParameters object 1271 Amazon API Gateway Developer Guide • x-amazon-apigateway-integration.responses object • x-amazon-apigateway-integration.response object • x-amazon-apigateway-integration.responseTemplates object • x-amazon-apigateway-integration.responseParameters object • x-amazon-apigateway-integration.tlsConfig object • x-amazon-apigateway-minimum-compression-size • x-amazon-apigateway-policy • x-amazon-apigateway-request-validator property • x-amazon-apigateway-request-validators object • x-amazon-apigateway-request-validators.requestValidator object • x-amazon-apigateway-tag-value property x-amazon-apigateway-any-method object Specifies the OpenAPI Operation Object for the API Gateway catch-all ANY method in an OpenAPI Path Item Object. This object can exist alongside other Operation objects and will catch any HTTP method that wasn't explicitly declared. The following table lists the properties extended by API Gateway. For the other OpenAPI Operation properties, see the OpenAPI specification. Property name Type Description isDefaultRoute Boolean x-amazon-apigateway- integration x-amazon-apigateway-integra tion object Specifies whether a route is the $default route. Supported only for HTTP APIs. To learn more, see Create routes for HTTP APIs in API Gateway. Specifies the integration of the method with the backend. This is an extended property of the OpenAPI Operation object. The integration can x-amazon-apigateway-any-method 1272 Amazon API Gateway Developer Guide Property name Type Description be of type AWS, AWS_PROXY , HTTP, HTTP_PROXY , or MOCK. x-amazon-apigateway-any-method examples The following example integrates the ANY method on a proxy resource, {proxy+}, with a Lambda function, TestSimpleProxy. "/{proxy+}": { "x-amazon-apigateway-any-method": { "produces": [ "application/json" ], "parameters": [ { "name": "proxy", "in": "path", "required": true, "type": "string" } ], "responses": {}, "x-amazon-apigateway-integration": { "uri": "arn:aws:apigateway:us-east-1:lambda:path/2015-03-31/functions/ arn:aws:lambda:us-east-1:123456789012:function:TestSimpleProxy/invocations", "httpMethod": "POST", "type": "aws_proxy" } The following example creates a $default route for an HTTP API that integrates with a Lambda function, HelloWorld. "/$default": { "x-amazon-apigateway-any-method": { "isDefaultRoute": true, "x-amazon-apigateway-integration": { "type": "AWS_PROXY", "httpMethod": "POST", x-amazon-apigateway-any-method examples 1273 Amazon API Gateway Developer Guide "uri": "arn:aws:apigateway:us-east-1:lambda:path/2015-03-31/functions/ arn:aws:lambda:us-east-1:123456789012:function:HelloWorld/invocations", "timeoutInMillis": 1000, "connectionType": "INTERNET", "payloadFormatVersion": 1.0 } } } x-amazon-apigateway-cors object Specifies the cross-origin resource sharing (CORS) configuration for an HTTP API. The extension applies to the root-level OpenAPI structure. To learn more, see Configure CORS for HTTP APIs in API Gateway. Property name allowOrigins Type Array allowCredentials Boolean exposeHeaders Array maxAge Integer allowMethods Array Description Specifies the allowed origins. Specifies whether credentia ls are included in the CORS request. Specifies the headers that are exposed. Specifies the number of seconds that the browser should cache preflight request results. Specifies the allowed HTTP methods. allowHeaders Array Specifies the allowed headers. x-amazon-apigateway-cors example The following is an example CORS configuration for an HTTP API. x-amazon-apigateway-cors 1274 Amazon API Gateway Developer Guide "x-amazon-apigateway-cors": { "allowOrigins": [ "https://www.example.com" ], "allowCredentials": true, "exposeHeaders": [ "x-apigateway-header", "x-amz-date", "content-type" ], "maxAge": 3600, "allowMethods": [ "GET", "OPTIONS", "POST" ], "allowHeaders": [ "x-apigateway-header", "x-amz-date", "content-type" ] } x-amazon-apigateway-api-key-source property Specify the source to receive an API key to throttle API methods that require a key. This API-level property is a String type. For more information about configuring a method to require an API key, see the section called “Configure a method to use API keys with an OpenAPI definition”. Specify the source of the API key for requests. Valid values are: • HEADER for receiving the API key from the X-API-Key header of a request. • AUTHORIZER for
apigateway-dg-345
apigateway-dg.pdf
345
"x-apigateway-header", "x-amz-date", "content-type" ], "maxAge": 3600, "allowMethods": [ "GET", "OPTIONS", "POST" ], "allowHeaders": [ "x-apigateway-header", "x-amz-date", "content-type" ] } x-amazon-apigateway-api-key-source property Specify the source to receive an API key to throttle API methods that require a key. This API-level property is a String type. For more information about configuring a method to require an API key, see the section called “Configure a method to use API keys with an OpenAPI definition”. Specify the source of the API key for requests. Valid values are: • HEADER for receiving the API key from the X-API-Key header of a request. • AUTHORIZER for receiving the API key from the UsageIdentifierKey from a Lambda authorizer (formerly known as a custom authorizer). x-amazon-apigateway-api-key-source example The following example sets the X-API-Key header as the API key source. x-amazon-apigateway-api-key-source 1275 Developer Guide Amazon API Gateway OpenAPI 2.0 { "swagger" : "2.0", "info" : { "title" : "Test1" }, "schemes" : [ "https" ], "basePath" : "/import", "x-amazon-apigateway-api-key-source" : "HEADER", . . . } OpenAPI 3.0.1 { "openapi" : "3.0.1", "info" : { "title" : "Test1" }, "servers" : [ { "url" : "/{basePath}", "variables" : { "basePath" : { "default" : "import" } } } ], "x-amazon-apigateway-api-key-source" : "HEADER", . . . } x-amazon-apigateway-auth object Defines an authorization type to be applied for authorization of method invocations in API Gateway. x-amazon-apigateway-auth 1276 Amazon API Gateway Property name type Type string Developer Guide Description Specifies the authoriza tion type. Specify "NONE" for open access. Specify "AWS_IAM" to use IAM permissions. Values are case insensitive. x-amazon-apigateway-auth example The following example sets the authorization type for an API method. OpenAPI 3.0.1 { "openapi": "3.0.1", "info": { "title": "openapi3", "version": "1.0" }, "paths": { "/protected-by-iam": { "get": { "x-amazon-apigateway-auth": { "type": "AWS_IAM" } } } } } x-amazon-apigateway-authorizer object Defines a Lambda authorizer, Amazon Cognito user pool, or JWT authorizer to be applied for authorization of method invocations in API Gateway. This extension applies to the security definition in OpenAPI 2 and OpenAPI 3. x-amazon-apigateway-auth example 1277 Amazon API Gateway Property name type Type string authorizerUri string Developer Guide Description The type of the authorizer. This is a required property. For REST APIs, specify token for an authorize r with the caller identity embedded in an authoriza tion token. Specify request for an authorizer with the caller identity contained in request parameters. Specify cognito_user_pools for an authorizer that uses an Amazon Cognito user pool to control access to your API. For HTTP APIs, specify request for a Lambda authorizer with the caller identity contained in request parameters. Specify jwt for a JWT authorizer. The Uniform Resource Identifier (URI) of the authorizer Lambda function. The syntax is as follows: "arn:aws:apigatewa y:us-east-1:lambda :path/2015-03-31/ functions/ arn:aws:lambda:us- east-1: account-i d :function: auth_func x-amazon-apigateway-authorizer 1278 Amazon API Gateway Developer Guide Property name Type Description authorizerCredenti string als authorizerPayloadF string ormatVersion enableSimpleRespon Boolean ses tion_name /invocati ons" The credentials required for invoking the authorize r, if any, in the form of an ARN of an IAM execution role. For example, "arn:aws:iam::account-i d :IAM_role". For HTTP APIs, specifies the format of the data that API Gateway sends to a Lambda authorizer, and how API Gateway interprets the response from Lambda. To learn more, see the section called “Payload format version”. For HTTP APIs, specifies whether a request authorize r returns a Boolean value or an IAM policy. Supported only for authorizers with an authorizerPayloadF of 2.0. ormatVersion If enabled, the Lambda authorizer function returns a Boolean value. To learn more, see the section called “Lambda function response for format 2.0”. x-amazon-apigateway-authorizer 1279 Amazon API Gateway Developer Guide Property name Type Description identitySource string jwtConfiguration Object identityValidation string Expression authorizerResultTt string lInSeconds providerARNs An array of string A comma-separated list of mapping expressions of the request parameters as the identity source. Applicabl e for the authorizer of the request and jwt type only. Specifies the issuer and audiences for a JWT authorize r. To learn more, see JWTConfiguration in the API Gateway Version 2 API Reference. Supported only for HTTP APIs. A regular expression for validating the token as the incoming identity. For example, "^x-[a-z]+". Supported only for TOKEN authorizers for REST APIs. The number of seconds during which authorizer result is cached. A list of the Amazon Cognito user pool ARNs for the COGNITO_USER_POOLS . x-amazon-apigateway-authorizer examples for REST APIs The following OpenAPI security definitions example specifies a Lambda authorizer of the "token" type and named test-authorizer. x-amazon-apigateway-authorizer examples for REST APIs 1280 Amazon API Gateway Developer Guide "securityDefinitions" : { "test-authorizer" : { "type" : "apiKey", // Required and the value must be "apiKey" for an API Gateway API. "name" : "Authorization", // The name of the header containing the authorization token. "in" : "header", // Required and the value must be "header" for an API Gateway
apigateway-dg-346
apigateway-dg.pdf
346
authorizer result is cached. A list of the Amazon Cognito user pool ARNs for the COGNITO_USER_POOLS . x-amazon-apigateway-authorizer examples for REST APIs The following OpenAPI security definitions example specifies a Lambda authorizer of the "token" type and named test-authorizer. x-amazon-apigateway-authorizer examples for REST APIs 1280 Amazon API Gateway Developer Guide "securityDefinitions" : { "test-authorizer" : { "type" : "apiKey", // Required and the value must be "apiKey" for an API Gateway API. "name" : "Authorization", // The name of the header containing the authorization token. "in" : "header", // Required and the value must be "header" for an API Gateway API. "x-amazon-apigateway-authtype" : "custom", // Specifies the authorization mechanism for the client. "x-amazon-apigateway-authorizer" : { // An API Gateway Lambda authorizer definition "type" : "token", // Required property and the value must "token" "authorizerUri" : "arn:aws:apigateway:us-east-1:lambda:path/2015-03-31/ functions/arn:aws:lambda:us-east-1:account-id:function:function-name/invocations", "authorizerCredentials" : "arn:aws:iam::account-id:role", "identityValidationExpression" : "^x-[a-z]+", "authorizerResultTtlInSeconds" : 60 } } } The following OpenAPI operation object snippet sets the GET /http to use the preceding Lambda authorizer. "/http" : { "get" : { "responses" : { }, "security" : [ { "test-authorizer" : [ ] } ], "x-amazon-apigateway-integration" : { "type" : "http", "responses" : { "default" : { "statusCode" : "200" } }, "httpMethod" : "GET", "uri" : "http://api.example.com" x-amazon-apigateway-authorizer examples for REST APIs 1281 Amazon API Gateway } } } Developer Guide The following OpenAPI security definitions example specifies a Lambda authorizer of the "request" type, with a single header parameter (auth) as the identity source. The securityDefinitions is named request_authorizer_single_header. "securityDefinitions": { "request_authorizer_single_header" : { "type" : "apiKey", "name" : "auth", // The name of a single header or query parameter as the identity source. "in" : "header", // The location of the single identity source request parameter. The valid value is "header" or "query" "x-amazon-apigateway-authtype" : "custom", "x-amazon-apigateway-authorizer" : { "type" : "request", "identitySource" : "method.request.header.auth", // Request parameter mapping expression of the identity source. In this example, it is the 'auth' header. "authorizerCredentials" : "arn:aws:iam::123456789012:role/AWSepIntegTest-CS- LambdaRole", "authorizerUri" : "arn:aws:apigateway:us-east-1:lambda:path/2015-03-31/ functions/arn:aws:lambda:us-east-1:123456789012:function:APIGateway-Request- Authorizer:vtwo/invocations", "authorizerResultTtlInSeconds" : 300 } } } The following OpenAPI security definitions example specifies a Lambda authorizer of the "request" type, with one header (HeaderAuth1) and one query string parameter QueryString1 as the identity sources. "securityDefinitions": { "request_authorizer_header_query" : { "type" : "apiKey", "name" : "Unused", // Must be "Unused" for multiple identity sources or non header or query type of request parameters. "in" : "header", // Must be "header" for multiple identity sources or non header or query type of request parameters. "x-amazon-apigateway-authtype" : "custom", x-amazon-apigateway-authorizer examples for REST APIs 1282 Amazon API Gateway Developer Guide "x-amazon-apigateway-authorizer" : { "type" : "request", "identitySource" : "method.request.header.HeaderAuth1, method.request.querystring.QueryString1", // Request parameter mapping expressions of the identity sources. "authorizerCredentials" : "arn:aws:iam::123456789012:role/AWSepIntegTest-CS- LambdaRole", "authorizerUri" : "arn:aws:apigateway:us-east-1:lambda:path/2015-03-31/ functions/arn:aws:lambda:us-east-1:123456789012:function:APIGateway-Request- Authorizer:vtwo/invocations", "authorizerResultTtlInSeconds" : 300 } } } The following OpenAPI security definitions example specifies an API Gateway Lambda authorizer of the "request" type, with a single stage variable (stage) as the identity source. "securityDefinitions": { "request_authorizer_single_stagevar" : { "type" : "apiKey", "name" : "Unused", // Must be "Unused", for multiple identity sources or non header or query type of request parameters. "in" : "header", // Must be "header", for multiple identity sources or non header or query type of request parameters. "x-amazon-apigateway-authtype" : "custom", "x-amazon-apigateway-authorizer" : { "type" : "request", "identitySource" : "stageVariables.stage", // Request parameter mapping expression of the identity source. In this example, it is the stage variable. "authorizerCredentials" : "arn:aws:iam::123456789012:role/AWSepIntegTest-CS- LambdaRole", "authorizerUri" : "arn:aws:apigateway:us-east-1:lambda:path/2015-03-31/ functions/arn:aws:lambda:us-east-1:123456789012:function:APIGateway-Request- Authorizer:vtwo/invocations", "authorizerResultTtlInSeconds" : 300 } } } The following OpenAPI security definition example specifies an Amazon Cognito user pool as an authorizer. x-amazon-apigateway-authorizer examples for REST APIs 1283 Amazon API Gateway Developer Guide "securityDefinitions": { "cognito-pool": { "type": "apiKey", "name": "Authorization", "in": "header", "x-amazon-apigateway-authtype": "cognito_user_pools", "x-amazon-apigateway-authorizer": { "type": "cognito_user_pools", "providerARNs": [ "arn:aws:cognito-idp:us-east-1:123456789012:userpool/us-east-1_ABC123" ] } } The following OpenAPI operation object snippet sets the GET /http to use the preceding Amazon Cognito user pool as an authorizer, with no custom scopes. "/http" : { "get" : { "responses" : { }, "security" : [ { "cognito-pool" : [ ] } ], "x-amazon-apigateway-integration" : { "type" : "http", "responses" : { "default" : { "statusCode" : "200" } }, "httpMethod" : "GET", "uri" : "http://api.example.com" } } } x-amazon-apigateway-authorizer examples for HTTP APIs The following OpenAPI 3.0 example creates a JWT authorizer for an HTTP API that uses Amazon Cognito as an identity provider, with the Authorization header as an identity source. x-amazon-apigateway-authorizer examples for HTTP APIs 1284 Amazon API Gateway Developer Guide "securitySchemes": { "jwt-authorizer-oauth": { "type": "oauth2", "x-amazon-apigateway-authorizer": { "type": "jwt", "jwtConfiguration": { "issuer": "https://cognito-idp.region.amazonaws.com/userPoolId", "audience": [ "audience1", "audience2" ] }, "identitySource": "$request.header.Authorization" } } } The following OpenAPI 3.0 example produces the same JWT authorizer as the previous example. However, this example uses the OpenAPI openIdConnectUrl property to automatically detect the issuer. The openIdConnectUrl
apigateway-dg-347
apigateway-dg.pdf
347
} x-amazon-apigateway-authorizer examples for HTTP APIs The following OpenAPI 3.0 example creates a JWT authorizer for an HTTP API that uses Amazon Cognito as an identity provider, with the Authorization header as an identity source. x-amazon-apigateway-authorizer examples for HTTP APIs 1284 Amazon API Gateway Developer Guide "securitySchemes": { "jwt-authorizer-oauth": { "type": "oauth2", "x-amazon-apigateway-authorizer": { "type": "jwt", "jwtConfiguration": { "issuer": "https://cognito-idp.region.amazonaws.com/userPoolId", "audience": [ "audience1", "audience2" ] }, "identitySource": "$request.header.Authorization" } } } The following OpenAPI 3.0 example produces the same JWT authorizer as the previous example. However, this example uses the OpenAPI openIdConnectUrl property to automatically detect the issuer. The openIdConnectUrl must be fully formed. "securitySchemes": { "jwt-authorizer-autofind": { "type": "openIdConnect", "openIdConnectUrl": "https://cognito-idp.region.amazonaws.com/userPoolId/.well- known/openid-configuration", "x-amazon-apigateway-authorizer": { "type": "jwt", "jwtConfiguration": { "audience": [ "audience1", "audience2" ] }, "identitySource": "$request.header.Authorization" } } } The following example creates a Lambda authorizer for an HTTP API. This example authorizer uses the Authorization header as its identity source. The authorizer uses the 2.0 payload format version, and returns Boolean value, because enableSimpleResponses is set to true. x-amazon-apigateway-authorizer examples for HTTP APIs 1285 Amazon API Gateway Developer Guide "securitySchemes" : { "lambda-authorizer" : { "type" : "apiKey", "name" : "Authorization", "in" : "header", "x-amazon-apigateway-authorizer" : { "type" : "request", "identitySource" : "$request.header.Authorization", "authorizerUri" : "arn:aws:apigateway:us-west-2:lambda:path/2015-03-31/functions/ arn:aws:lambda:us-west-2:123456789012:function:function-name/invocations", "authorizerPayloadFormatVersion" : "2.0", "authorizerResultTtlInSeconds" : 300, "enableSimpleResponses" : true } } } x-amazon-apigateway-authtype property For REST APIs, this extension can be used to define a custom type of a Lambda authorizer. In this case, the value is free-form. For example, an API may have multiple Lambda authorizers that use different internal schemes. You can use this extension to identify the internal scheme of a Lambda authorizer. More commonly, in HTTP APIs and REST APIs, it can also be used as a way to define IAM authorization across several operations that share the same security scheme. In this case, the term awsSigv4 is a reserved term, along with any term prefixed by aws. This extension applies to the apiKey type security scheme in OpenAPI 2 and OpenAPI 3. x-amazon-apigateway-authtype example The following OpenAPI 3 example defines IAM authorization across multiple resources in a REST API or HTTP API: { "openapi" : "3.0.1", "info" : { "title" : "openapi3", "version" : "1.0" x-amazon-apigateway-authtype 1286 Developer Guide Amazon API Gateway }, "paths" : { "/operation1" : { "get" : { "responses" : { "default" : { "description" : "Default response" } }, "security" : [ { "sigv4Reference" : [ ] } ] } }, "/operation2" : { "get" : { "responses" : { "default" : { "description" : "Default response" } }, "security" : [ { "sigv4Reference" : [ ] } ] } } }, "components" : { "securitySchemes" : { "sigv4Reference" : { "type" : "apiKey", "name" : "Authorization", "in" : "header", "x-amazon-apigateway-authtype": "awsSigv4" } } } } The following OpenAPI 3 example defines a Lambda authorizer with a custom scheme for a REST API: { x-amazon-apigateway-authtype example 1287 Amazon API Gateway Developer Guide "openapi" : "3.0.1", "info" : { "title" : "openapi3 for REST API", "version" : "1.0" }, "paths" : { "/protected-by-lambda-authorizer" : { "get" : { "responses" : { "200" : { "description" : "Default response" } }, "security" : [ { "myAuthorizer" : [ ] } ] } } }, "components" : { "securitySchemes" : { "myAuthorizer" : { "type" : "apiKey", "name" : "Authorization", "in" : "header", "x-amazon-apigateway-authorizer" : { "identitySource" : "method.request.header.Authorization", "authorizerUri" : "arn:aws:apigateway:us-east-1:lambda:path/2015-03-31/ functions/arn:aws:lambda:us-east-1:account-id:function:function-name/invocations", "authorizerResultTtlInSeconds" : 300, "type" : "request", "enableSimpleResponses" : false }, "x-amazon-apigateway-authtype": "Custom scheme with corporate claims" } } }, "x-amazon-apigateway-importexport-version" : "1.0" } See also authorizer.authType See also 1288 Amazon API Gateway Developer Guide x-amazon-apigateway-binary-media-types property Specifies the list of binary media types to be supported by API Gateway, such as application/ octet-stream and image/jpeg. This extension is a JSON array. It should be included as a top- level vendor extension to the OpenAPI document. x-amazon-apigateway-binary-media-types example The following example shows the encoding lookup order of an API. "x-amazon-apigateway-binary-media-types": [ "application/octet", "image/jpeg" ] x-amazon-apigateway-documentation object Defines the documentation parts to be imported into API Gateway. This object is a JSON object containing an array of the DocumentationPart instances. Property name Type Description documentationParts Array version String An array of the exported or imported Documenta tionPart instances. The version identifier of the snapshot of the exported documentation parts. x-amazon-apigateway-documentation example The following example of the API Gateway extension to OpenAPI defines DocumentationParts instances to be imported to or exported from an API in API Gateway. { ... "x-amazon-apigateway-documentation": { "version": "1.0.3", "documentationParts": [ { x-amazon-apigateway-binary-media-type 1289 Developer Guide Amazon API Gateway "location": { "type": "API" }, "properties": { "description": "API description", "info": { "description": "API info description 4", "version": "API info version 3" } } }, { … // Another DocumentationPart instance } ] } } x-amazon-apigateway-endpoint-configuration object Specifies details of the
apigateway-dg-348
apigateway-dg.pdf
348
or imported Documenta tionPart instances. The version identifier of the snapshot of the exported documentation parts. x-amazon-apigateway-documentation example The following example of the API Gateway extension to OpenAPI defines DocumentationParts instances to be imported to or exported from an API in API Gateway. { ... "x-amazon-apigateway-documentation": { "version": "1.0.3", "documentationParts": [ { x-amazon-apigateway-binary-media-type 1289 Developer Guide Amazon API Gateway "location": { "type": "API" }, "properties": { "description": "API description", "info": { "description": "API info description 4", "version": "API info version 3" } } }, { … // Another DocumentationPart instance } ] } } x-amazon-apigateway-endpoint-configuration object Specifies details of the endpoint configuration for an API. This extension is an extended property of the OpenAPI Operation object. This object should be present in top-level vendor extensions for Swagger 2.0. For OpenAPI 3.0, it should be present under the vendor extensions of the Server object. Property name Type Description disableExecuteApiE Boolean ndpoint Specifies whether clients can invoke your API by using the default execute-a pi endpoint. By default, clients can invoke your API with the default https:// {api_id}.execute-ap i.{region}.amazona ws.com endpoint. To require that clients use a custom domain name to invoke your API, specify true. x-amazon-apigateway-endpoint-configuration 1290 Amazon API Gateway Developer Guide Property name Type Description vpcEndpointIds An array of String ipAddressType string A list of VpcEndpoint identifie rs against which to create Route 53 alias records for a REST API. It is only supported for REST APIs the PRIVATE endpoint type. The IP address types that can invoke an HTTP API. Use ipv4 to allow IPv4 address types to invoke an HTTP API. Use dualstack to allow IPv4 and IPv6 address types to invoke an HTTP API. It is only supported for HTTP APIs. x-amazon-apigateway-endpoint-configuration examples The following example associates specified VPC endpoints to the REST API. "x-amazon-apigateway-endpoint-configuration": { "vpcEndpointIds": ["vpce-0212a4ababd5b8c3e", "vpce-01d622316a7df47f9"] } The following example disables the default endpoint for an API. "x-amazon-apigateway-endpoint-configuration": { "disableExecuteApiEndpoint": true } The following example sets the IP address type to dualstack for an HTTP API. "x-amazon-apigateway-endpoint-configuration": { "ipAddressType": "dualstack" } x-amazon-apigateway-endpoint-configuration examples 1291 Amazon API Gateway Developer Guide x-amazon-apigateway-gateway-responses object Defines the gateway responses for an API as a string-to-GatewayResponse map of key-value pairs. The extension applies to the root-level OpenAPI structure. Property name Type Description responseType x-amazon-apigateway- gateway-responses.gateway Response A GatewayResponse for the specified responseT ype . x-amazon-apigateway-gateway-responses example The following API Gateway extension to OpenAPI example defines a GatewayResponses map that contains two GatewayResponse instances—one for the DEFAULT_4XX type and another for the INVALID_API_KEY type. { "x-amazon-apigateway-gateway-responses": { "DEFAULT_4XX": { "responseParameters": { "gatewayresponse.header.Access-Control-Allow-Origin": "'domain.com'" }, "responseTemplates": { "application/json": "{\"message\": test 4xx b }" } }, "INVALID_API_KEY": { "statusCode": "429", "responseTemplates": { "application/json": "{\"message\": test forbidden }" } } } } x-amazon-apigateway-gateway-responses 1292 Amazon API Gateway Developer Guide x-amazon-apigateway-gateway-responses.gatewayResponse object Defines a gateway response of a given response type, including the status code, any applicable response parameters, or response templates. Property name Type Description responseParameters x-amazon-apigateway- gateway-responses.respons Specifies the GatewayRe sponse parameters, namely eParameters the header parameters. The parameter values can take any incoming request parameter value or a static custom value. responseTemplates x-amazon-apigateway- gateway-responses.respons Specifies the mapping templates of the gateway eTemplates statusCode string response. The templates are not processed by the VTL engine. An HTTP status code for the gateway response. x-amazon-apigateway-gateway-responses.gatewayResponse example The following example of the API Gateway extension to OpenAPI defines a GatewayResponse to customize the INVALID_API_KEY response to return the status code of 456, the incoming request's api-key header value, and a "Bad api-key" message. "INVALID_API_KEY": { "statusCode": "456", "responseParameters": { "gatewayresponse.header.api-key": "method.request.header.api-key" }, x-amazon-apigateway-gateway-responses.gatewayResponse 1293 Amazon API Gateway Developer Guide "responseTemplates": { "application/json": "{\"message\": \"Bad api-key\" }" } } x-amazon-apigateway-gateway-responses.responseParameters object Defines a string-to-string map of key-value pairs to generate gateway response parameters from the incoming request parameters or using literal strings. Supported only for REST APIs. Property name gatewayre sponse. param-pos ition .param-name Type string Description param-position can be header, path, or querystri ng . For more information, see Parameter mapping for REST APIs in API Gateway. x-amazon-apigateway-gateway-responses.responseParameters example The following OpenAPI extensions example shows a GatewayResponse response parameter mapping expression to enable CORS support for resources on the *.example.domain domains. "responseParameters": { "gatewayresponse.header.Access-Control-Allow-Origin": '*.example.domain', "gatewayresponse.header.from-request-header" : method.request.header.Accept, "gatewayresponse.header.from-request-path" : method.request.path.petId, "gatewayresponse.header.from-request-query" : method.request.querystring.qname } x-amazon-apigateway-gateway-responses.responseParameters 1294 Amazon API Gateway Developer Guide x-amazon-apigateway-gateway-responses.responseTemplates object Defines GatewayResponse mapping templates, as a string-to-string map of key-value pairs, for a given gateway response. For each key-value pair, the key is the content type. For example, "application/json" and the value is a stringified mapping template for simple variable substitutions. A GatewayResponse mapping template isn't processed by the Velocity Template Language (VTL) engine. Property name content-type Type string Description A GatewayResponse body mapping template supporting only simple variable substitut ion to customize a gateway response body. x-amazon-apigateway-gateway-responses.responseTemplates example The following OpenAPI extensions example shows a GatewayResponse mapping template to
apigateway-dg-349
apigateway-dg.pdf
349
} x-amazon-apigateway-gateway-responses.responseParameters 1294 Amazon API Gateway Developer Guide x-amazon-apigateway-gateway-responses.responseTemplates object Defines GatewayResponse mapping templates, as a string-to-string map of key-value pairs, for a given gateway response. For each key-value pair, the key is the content type. For example, "application/json" and the value is a stringified mapping template for simple variable substitutions. A GatewayResponse mapping template isn't processed by the Velocity Template Language (VTL) engine. Property name content-type Type string Description A GatewayResponse body mapping template supporting only simple variable substitut ion to customize a gateway response body. x-amazon-apigateway-gateway-responses.responseTemplates example The following OpenAPI extensions example shows a GatewayResponse mapping template to customize an API Gateway–generated error response into an app-specific format. "responseTemplates": { "application/json": "{ \"message\": $context.error.messageString, \"type\": $context.error.responseType, \"statusCode\": '488' }" } The following OpenAPI extensions example shows a GatewayResponse mapping template to override an API Gateway–generated error response with a static error message. "responseTemplates": { "application/json": "{ \"message\": 'API-specific errors' }" } x-amazon-apigateway-gateway-responses.responseTemplates 1295 Amazon API Gateway Developer Guide x-amazon-apigateway-importexport-version Specifies the version of the API Gateway import and export algorithm for HTTP APIs. Currently, the only supported value is 1.0. To learn more, see exportVersion in the API Gateway Version 2 API Reference. x-amazon-apigateway-importexport-version example The following example sets the import and export version to 1.0. { "openapi": "3.0.1", "x-amazon-apigateway-importexport-version": "1.0", "info": { ... x-amazon-apigateway-integration object Specifies details of the backend integration used for this method. This extension is an extended property of the OpenAPI Operation object. The result is an API Gateway integration object. Property name Type Description cacheKeyParameters An array of string cacheNamespace string connectionId string connectionType string A list of request parameter s whose values are to be cached. An API-specific tag group of related cached parameters. The ID of a VpcLink for the private integration. The integration connectio n type. The valid value is "VPC_LINK" for private integration or "INTERNET" , otherwise. x-amazon-apigateway-importexport-version 1296 Amazon API Gateway Property name credentials Type string contentHandling string Developer Guide Description For AWS IAM role-based credentials, specify the ARN of an appropriate IAM role. If unspecified, credentials default to resource-based permissions that must be added manually to allow the API to access the resource. For more information, see Granting Permissions Using a Resource Policy. Note: When using IAM credentials, make sure that AWS STS Regional endpoints are enabled for the Region where this API is deployed for best performance. Request payload encoding conversion types. Valid values are 1) CONVERT_TO_TEXT , for converting a binary payload into a base64-en coded string or converting a text payload into a utf-8- encoded string or passing through the text payload natively without modificat ion, and 2) CONVERT_T O_BINARY , for converting a text payload into a base64- decoded blob or passing through a binary payload natively without modification. x-amazon-apigateway-integration 1297 Amazon API Gateway Property name httpMethod Type string integrationSubtype string passthroughBehavior string Developer Guide Description The HTTP method used in the integration request. For Lambda function invocations, the value must be POST. Specifies the integration subtype for an AWS service integration. Supported only for HTTP APIs. For supported integration subtypes, see the section called “AWS service integrations reference”. Specifies how a request payload of unmapped content type is passed through the integration request without modificat ion. Supported values are when_no_templates , when_no_match , and never. For more informati on, see Integration.passth roughBehavior. x-amazon-apigateway-integration 1298 Amazon API Gateway Developer Guide Property name Type Description payloadFormatVersion string Specifies the format of the payload sent to an integrati on. Required for HTTP APIs. For HTTP APIs, supported values for Lambda proxy integrations are 1.0 and 2.0. For all other integrations, 1.0 is the only supported value. To learn more, see the section called “AWS Lambda integrati ons” and the section called “AWS service integrations reference”. x-amazon-apigateway-integration 1299 Amazon API Gateway Developer Guide Property name Type Description requestParameters x-amazon-apigateway-integra tion.requestParameters object For REST APIs, specifies mappings from method request parameters to integration request parameter s. Supported request parameters are querystri ng , path, header, and body. For HTTP APIs, request parameters are a key- value map specifying parameters that are passed to AWS_PROXY integrations with a specified integrati onSubtype . You can provide static values, or map request data, stage variables , or context variables that are evaluated at runtime. To learn more, see the section called “AWS service integrations”. requestTemplates x-amazon-apigateway-integra tion.requestTemplates object Mapping templates for a request payload of specified responses x-amazon-apigateway-integra tion.responses object MIME types. Defines the method's responses and specifies desired parameter mappings or payload mappings from integration responses to method responses. x-amazon-apigateway-integration 1300 Amazon API Gateway Developer Guide Property name Type Description timeoutInMillis integer type string tlsConfig the section called “x-amazon -apigateway-integration.tls Config” Integration timeouts between 50 ms and 29,000 ms. The type of integration with the specified backend. Valid values are: • http or http_proxy , for integration with an
apigateway-dg-350
apigateway-dg.pdf
350
are evaluated at runtime. To learn more, see the section called “AWS service integrations”. requestTemplates x-amazon-apigateway-integra tion.requestTemplates object Mapping templates for a request payload of specified responses x-amazon-apigateway-integra tion.responses object MIME types. Defines the method's responses and specifies desired parameter mappings or payload mappings from integration responses to method responses. x-amazon-apigateway-integration 1300 Amazon API Gateway Developer Guide Property name Type Description timeoutInMillis integer type string tlsConfig the section called “x-amazon -apigateway-integration.tls Config” Integration timeouts between 50 ms and 29,000 ms. The type of integration with the specified backend. Valid values are: • http or http_proxy , for integration with an HTTP backend. • aws_proxy , for integrati on with AWS Lambda functions. • aws, for integration with AWS Lambda functions or other AWS services, such as Amazon DynamoDB, Amazon Simple Notification Service, or Amazon Simple Queue Service. • mock, for integration with API Gateway without invoking any backend. For more information about the integration types, see integration:type. Specifies the TLS configura tion for an integration. x-amazon-apigateway-integration 1301 Amazon API Gateway Property name uri Type string Developer Guide Description The endpoint URI of the backend. For integrations of the aws type, this is an ARN value. For the HTTP integrati on, this is the URL of the HTTP endpoint including the https or http scheme. x-amazon-apigateway-integration examples For HTTP APIs, you can define integrations in the components section of your OpenAPI definition. To learn more, see x-amazon-apigateway-integrations object. "x-amazon-apigateway-integration": { "$ref": "#/components/x-amazon-apigateway-integrations/integration1" } The following example creates an integration with a Lambda function. For demonstration purposes, the sample mapping templates shown in requestTemplates and responseTemplates of the examples below are assumed to apply to the following JSON-formatted payload: { "name":"value_1", "key":"value_2", "redirect": {"url" :"..."} } to generate a JSON output of { "stage":"value_1", "user- id":"value_2" } or an XML output of <stage>value_1</stage>. "x-amazon-apigateway-integration" : { "type" : "aws", "uri" : "arn:aws:apigateway:us-east-1:lambda:path/2015-03-31/functions/ arn:aws:lambda:us-east-1:012345678901:function:HelloWorld/invocations", "httpMethod" : "POST", "credentials" : "arn:aws:iam::012345678901:role/apigateway-invoke-lambda-exec- role", "requestTemplates" : { "application/json" : "#set ($root=$input.path('$')) { \"stage\": \"$root.name\", \"user-id\": \"$root.key\" }", "application/xml" : "#set ($root=$input.path('$')) <stage>$root.name</ stage> " x-amazon-apigateway-integration examples 1302 Amazon API Gateway }, Developer Guide "requestParameters" : { "integration.request.path.stage" : "method.request.querystring.version", "integration.request.querystring.provider" : "method.request.querystring.vendor" }, "cacheNamespace" : "cache namespace", "cacheKeyParameters" : [], "responses" : { "2\\d{2}" : { "statusCode" : "200", "responseParameters" : { "method.response.header.requestId" : "integration.response.header.cid" }, "responseTemplates" : { "application/json" : "#set ($root=$input.path('$')) { \"stage\": \"$root.name\", \"user-id\": \"$root.key\" }", "application/xml" : "#set ($root=$input.path('$')) <stage>$root.name</ stage> " } }, "302" : { "statusCode" : "302", "responseParameters" : { "method.response.header.Location" : "integration.response.body.redirect.url" } }, "default" : { "statusCode" : "400", "responseParameters" : { "method.response.header.test-method-response-header" : "'static value'" } } } } Note that double quotes (") for the JSON string in the mapping templates must be string-escaped (\"). x-amazon-apigateway-integration examples 1303 Amazon API Gateway Developer Guide x-amazon-apigateway-integrations object Defines a collection of integrations. You can define integrations in the components section of your OpenAPI definition, and reuse the integrations for multiple routes. Supported only for HTTP APIs. Property name Type Description integration x-amazon-apigateway-integra tion object A collection of integration objects. x-amazon-apigateway-integrations example The following example creates an HTTP API that defines two integrations, and references the integrations by using $ref": "#/components/x-amazon-apigateway- integrations/integration-name. { "openapi": "3.0.1", "info": { "title": "Integrations", "description": "An API that reuses integrations", "version": "1.0" }, "servers": [ { "url": "https://example.com/{basePath}", "description": "The production API server", "variables": { "basePath": { "default": "example/path" } } }], "paths": { "/": { x-amazon-apigateway-integrations 1304 Amazon API Gateway "get": { "x-amazon-apigateway-integration": { Developer Guide "$ref": "#/components/x-amazon-apigateway-integrations/integration1" } } }, "/pets": { "get": { "x-amazon-apigateway-integration": { "$ref": "#/components/x-amazon-apigateway-integrations/integration1" } } }, "/checkout": { "get": { "x-amazon-apigateway-integration": { "$ref": "#/components/x-amazon-apigateway-integrations/integration2" } } } }, "components": { "x-amazon-apigateway-integrations": { "integration1": { "type": "aws_proxy", "httpMethod": "POST", "uri": "arn:aws:apigateway:us-east-2:lambda:path/2015-03-31/functions/ arn:aws:lambda:us-east-2:123456789012:function:my-function/invocations", "passthroughBehavior": "when_no_templates", "payloadFormatVersion": "1.0" }, "integration2": x-amazon-apigateway-integrations example 1305 Amazon API Gateway { "type": "aws_proxy", "httpMethod": "POST", Developer Guide "uri": "arn:aws:apigateway:us-east-2:lambda:path/2015-03-31/functions/ arn:aws:lambda:us-east-2:123456789012:function:example-function/invocations", "passthroughBehavior": "when_no_templates", "payloadFormatVersion" : "1.0" } } } } x-amazon-apigateway-integration.requestTemplates object Specifies mapping templates for a request payload of the specified MIME types. Property name MIME type Type string Description An example of the MIME type is application/json . For information about creating a mapping template, see the section called “Mapping template transformations”. x-amazon-apigateway-integration.requestTemplates example The following example sets mapping templates for a request payload of the application/json and application/xml MIME types. "requestTemplates" : { "application/json" : "#set ($root=$input.path('$')) { \"stage\": \"$root.name\", \"user-id\": \"$root.key\" }", "application/xml" : "#set ($root=$input.path('$')) <stage>$root.name</stage> " } x-amazon-apigateway-integration.requestTemplates 1306 Amazon API Gateway Developer Guide x-amazon-apigateway-integration.requestParameters object For REST APIs, specifies mappings from named method request parameters to integration request parameters. The method request parameters must be defined before being referenced. For HTTP APIs, specifies parameters that are passed to AWS_PROXY integrations with a specified integrationSubtype. Property name Type Description integration.reques string t. <param-ty pe> .<param-name> parameter string For REST APIs, the value is typically a predefined method request
apigateway-dg-351
apigateway-dg.pdf
351
request payload of the application/json and application/xml MIME types. "requestTemplates" : { "application/json" : "#set ($root=$input.path('$')) { \"stage\": \"$root.name\", \"user-id\": \"$root.key\" }", "application/xml" : "#set ($root=$input.path('$')) <stage>$root.name</stage> " } x-amazon-apigateway-integration.requestTemplates 1306 Amazon API Gateway Developer Guide x-amazon-apigateway-integration.requestParameters object For REST APIs, specifies mappings from named method request parameters to integration request parameters. The method request parameters must be defined before being referenced. For HTTP APIs, specifies parameters that are passed to AWS_PROXY integrations with a specified integrationSubtype. Property name Type Description integration.reques string t. <param-ty pe> .<param-name> parameter string For REST APIs, the value is typically a predefined method request parameter of the method.re quest. <param-ty pe> .<param-na me> format, where <param-type> can be querystring , path, header, or body. However, $context. VARIABLE_ NAME , $stageVar iables. VARIABLE_NAME , and STATIC_VALUE are also valid. For the body parameter , the <param-name> is a JSON path expression without the $. prefix. For HTTP APIs, request parameters are a key- value map specifying parameters that are passed to AWS_PROXY integrations with a specified integrati onSubtype . You can x-amazon-apigateway-integration.requestParameters 1307 Amazon API Gateway Developer Guide Property name Type Description provide static values, or map request data, stage variables , or context variables that are evaluated at runtime. To learn more, see the section called “AWS service integrations”. x-amazon-apigateway-integration.requestParameters example The following request parameter mappings example translates a method request's query (version), header (x-user-id), and path (service) parameters to the integration request's query (stage), header (x-userid), and path parameters (op), respectively. Note If you're creating resources through OpenAPI or AWS CloudFormation, static values should be enclosed in single quotes. To add this value from the console, enter application/json in the box, without quotation marks. "requestParameters" : { "integration.request.querystring.stage" : "method.request.querystring.version", "integration.request.header.x-userid" : "method.request.header.x-user-id", "integration.request.path.op" : "method.request.path.service" }, x-amazon-apigateway-integration.responses object Defines the method's responses and specifies parameter mappings or payload mappings from integration responses to method responses. x-amazon-apigateway-integration.requestParameters example 1308 Amazon API Gateway Developer Guide Property name Type Description Response status pattern x-amazon-apigateway-integra tion.response object Either a regular expression used to match the integrati on response to the method response, or default to catch any response that you haven't configured. For HTTP integrations, the regex applies to the integration response status code. For Lambda invocations, the regex applies to the errorMessage field of the error informati on object returned by AWS Lambda as a failure response body when the Lambda function execution throws an exception. Note The Response status pattern property name refers to a response status code or regular expression describin g a group of response status codes. It does not correspond to any identifier of an IntegrationRespons e resource in the API Gateway REST API. x-amazon-apigateway-integration.responses 1309 Amazon API Gateway Developer Guide x-amazon-apigateway-integration.responses example The following example shows a list of responses from 2xx and 302 responses. For the 2xx response, the method response is mapped from the integration response's payload of the application/json or application/xml MIME type. This response uses the supplied mapping templates. For the 302 response, the method response returns a Location header whose value is derived from the redirect.url property on the integration response's payload. "responses" : { "2\\d{2}" : { "statusCode" : "200", "responseTemplates" : { "application/json" : "#set ($root=$input.path('$')) { \"stage\": \"$root.name\", \"user-id\": \"$root.key\" }", "application/xml" : "#set ($root=$input.path('$')) <stage>$root.name</ stage> " } }, "302" : { "statusCode" : "302", "responseParameters" : { "method.response.header.Location": "integration.response.body.redirect.url" } } } x-amazon-apigateway-integration.response object Defines a response and specifies parameter mappings or payload mappings from the integration response to the method response. Property name statusCode Type string Description HTTP status code for the method response; for example, "200". This must x-amazon-apigateway-integration.responses example 1310 Amazon API Gateway Developer Guide Property name Type Description correspond to a matching response in the OpenAPI Operation responses field. responseTemplates x-amazon-apigateway-integra tion.responseTemplates Specifies MIME type-specific mapping templates for the object response’s payload. responseParameters x-amazon-apigateway-integra tion.responseParameters Specifies parameter mappings for the response. Only the object contentHandling string header and body parameter s of the integration response can be mapped to the header parameters of the method. Response payload encoding conversion types. Valid values are 1) CONVERT_TO_TEXT , for converting a binary payload into a base64-en coded string or converting a text payload into a utf-8- encoded string or passing through the text payload natively without modificat ion, and 2) CONVERT_T O_BINARY , for converting a text payload into a base64- decoded blob or passing through a binary payload natively without modification. x-amazon-apigateway-integration.response 1311 Amazon API Gateway Developer Guide x-amazon-apigateway-integration.response example The following example defines a 302 response for the method that derives a payload of the application/json or application/xml MIME type from the backend. The response uses the supplied mapping templates and returns the redirect URL from the integration response in the method's Location header. { "statusCode" : "302", "responseTemplates" : { "application/json" : "#set ($root=$input.path('$')) {