1{
2    "version": "1.1",
3    "parameters": {
4        "Region": {
5            "builtIn": "AWS::Region",
6            "required": true,
7            "documentation": "The AWS region used to dispatch the request.",
8            "type": "String"
9        },
10        "UseDualStack": {
11            "builtIn": "AWS::UseDualStack",
12            "required": true,
13            "default": false,
14            "documentation": "When true, use the dual-stack endpoint. If the configured endpoint does not support dual-stack, dispatching the request MAY return an error.",
15            "type": "Boolean"
16        },
17        "UseFIPS": {
18            "builtIn": "AWS::UseFIPS",
19            "required": true,
20            "default": false,
21            "documentation": "When true, send this request to the FIPS-compliant regional endpoint. If the configured endpoint does not have a FIPS compliant endpoint, dispatching the request will return an error.",
22            "type": "Boolean"
23        }
24    },
25    "rules": [
26        {
27            "conditions": [
28                {
29                    "fn": "aws.partition",
30                    "argv": [
31                        {
32                            "ref": "Region"
33                        }
34                    ],
35                    "assign": "PartitionResult"
36                }
37            ],
38            "type": "tree",
39            "rules": [
40                {
41                    "conditions": [
42                        {
43                            "fn": "booleanEquals",
44                            "argv": [
45                                {
46                                    "ref": "UseFIPS"
47                                },
48                                true
49                            ]
50                        },
51                        {
52                            "fn": "booleanEquals",
53                            "argv": [
54                                {
55                                    "ref": "UseDualStack"
56                                },
57                                true
58                            ]
59                        }
60                    ],
61                    "type": "tree",
62                    "rules": [
63                        {
64                            "conditions": [
65                                {
66                                    "fn": "booleanEquals",
67                                    "argv": [
68                                        true,
69                                        {
70                                            "fn": "getAttr",
71                                            "argv": [
72                                                {
73                                                    "ref": "PartitionResult"
74                                                },
75                                                "supportsFIPS"
76                                            ]
77                                        }
78                                    ]
79                                },
80                                {
81                                    "fn": "booleanEquals",
82                                    "argv": [
83                                        true,
84                                        {
85                                            "fn": "getAttr",
86                                            "argv": [
87                                                {
88                                                    "ref": "PartitionResult"
89                                                },
90                                                "supportsDualStack"
91                                            ]
92                                        }
93                                    ]
94                                }
95                            ],
96                            "type": "tree",
97                            "rules": [
98                                {
99                                    "conditions": [],
100                                    "endpoint": {
101                                        "url": "https://dynamodb-fips.{Region}.{PartitionResult#dualStackDnsSuffix}",
102                                        "properties": {
103                                            "authSchemes": [
104                                                {
105                                                    "name": "sigv4",
106                                                    "signingRegion": "{Region}",
107                                                    "signingName": "dynamodb"
108                                                }
109                                            ]
110                                        },
111                                        "headers": {}
112                                    },
113                                    "type": "endpoint"
114                                }
115                            ]
116                        },
117                        {
118                            "conditions": [],
119                            "error": "FIPS and DualStack are enabled, but this partition does not support one or both",
120                            "type": "error"
121                        }
122                    ]
123                },
124                {
125                    "conditions": [
126                        {
127                            "fn": "booleanEquals",
128                            "argv": [
129                                {
130                                    "ref": "UseFIPS"
131                                },
132                                true
133                            ]
134                        }
135                    ],
136                    "type": "tree",
137                    "rules": [
138                        {
139                            "conditions": [
140                                {
141                                    "fn": "booleanEquals",
142                                    "argv": [
143                                        true,
144                                        {
145                                            "fn": "getAttr",
146                                            "argv": [
147                                                {
148                                                    "ref": "PartitionResult"
149                                                },
150                                                "supportsFIPS"
151                                            ]
152                                        }
153                                    ]
154                                }
155                            ],
156                            "type": "tree",
157                            "rules": [
158                                {
159                                    "conditions": [],
160                                    "type": "tree",
161                                    "rules": [
162                                        {
163                                            "conditions": [
164                                                {
165                                                    "fn": "stringEquals",
166                                                    "argv": [
167                                                        "aws-us-gov",
168                                                        {
169                                                            "fn": "getAttr",
170                                                            "argv": [
171                                                                {
172                                                                    "ref": "PartitionResult"
173                                                                },
174                                                                "name"
175                                                            ]
176                                                        }
177                                                    ]
178                                                }
179                                            ],
180                                            "endpoint": {
181                                                "url": "https://dynamodb.{Region}.{PartitionResult#dnsSuffix}",
182                                                "properties": {
183                                                    "authSchemes": [
184                                                        {
185                                                            "name": "sigv4",
186                                                            "signingRegion": "{Region}",
187                                                            "signingName": "dynamodb"
188                                                        }
189                                                    ]
190                                                },
191                                                "headers": {}
192                                            },
193                                            "type": "endpoint"
194                                        },
195                                        {
196                                            "conditions": [],
197                                            "endpoint": {
198                                                "url": "https://dynamodb-fips.{Region}.{PartitionResult#dnsSuffix}",
199                                                "properties": {
200                                                    "authSchemes": [
201                                                        {
202                                                            "name": "sigv4",
203                                                            "signingRegion": "{Region}",
204                                                            "signingName": "dynamodb"
205                                                        }
206                                                    ]
207                                                },
208                                                "headers": {}
209                                            },
210                                            "type": "endpoint"
211                                        }
212                                    ]
213                                }
214                            ]
215                        },
216                        {
217                            "conditions": [],
218                            "error": "FIPS is enabled but this partition does not support FIPS",
219                            "type": "error"
220                        }
221                    ]
222                },
223                {
224                    "conditions": [
225                        {
226                            "fn": "booleanEquals",
227                            "argv": [
228                                {
229                                    "ref": "UseDualStack"
230                                },
231                                true
232                            ]
233                        }
234                    ],
235                    "type": "tree",
236                    "rules": [
237                        {
238                            "conditions": [
239                                {
240                                    "fn": "booleanEquals",
241                                    "argv": [
242                                        true,
243                                        {
244                                            "fn": "getAttr",
245                                            "argv": [
246                                                {
247                                                    "ref": "PartitionResult"
248                                                },
249                                                "supportsDualStack"
250                                            ]
251                                        }
252                                    ]
253                                }
254                            ],
255                            "type": "tree",
256                            "rules": [
257                                {
258                                    "conditions": [],
259                                    "endpoint": {
260                                        "url": "https://dynamodb.{Region}.{PartitionResult#dualStackDnsSuffix}",
261                                        "properties": {
262                                            "authSchemes": [
263                                                {
264                                                    "name": "sigv4",
265                                                    "signingRegion": "{Region}",
266                                                    "signingName": "dynamodb"
267                                                }
268                                            ]
269                                        },
270                                        "headers": {}
271                                    },
272                                    "type": "endpoint"
273                                }
274                            ]
275                        },
276                        {
277                            "conditions": [],
278                            "error": "DualStack is enabled but this partition does not support DualStack",
279                            "type": "error"
280                        }
281                    ]
282                },
283                {
284                    "conditions": [],
285                    "type": "tree",
286                    "rules": [
287                        {
288                            "conditions": [
289                                {
290                                    "fn": "stringEquals",
291                                    "argv": [
292                                        {
293                                            "ref": "Region"
294                                        },
295                                        "local"
296                                    ]
297                                }
298                            ],
299                            "endpoint": {
300                                "url": "https://localhost:8000",
301                                "properties": {
302                                    "authSchemes": [
303                                        {
304                                            "name": "sigv4",
305                                            "signingRegion": "us-east-1",
306                                            "signingName": "dynamodb"
307                                        }
308                                    ]
309                                },
310                                "headers": {}
311                            },
312                            "type": "endpoint"
313                        },
314                        {
315                            "conditions": [],
316                            "endpoint": {
317                                "url": "https://dynamodb.{Region}.{PartitionResult#dnsSuffix}",
318                                "properties": {
319                                    "authSchemes": [
320                                        {
321                                            "name": "sigv4",
322                                            "signingRegion": "{Region}",
323                                            "signingName": "dynamodb"
324                                        }
325                                    ]
326                                },
327                                "headers": {}
328                            },
329                            "type": "endpoint"
330                        }
331                    ]
332                }
333            ]
334        }
335    ]
336}