@mapbox/cloudfriend 9.2.1 → 9.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. package/changelog.md +4 -0
  2. package/lib/shortcuts/api.md +37 -0
  3. package/lib/shortcuts/glue-iceberg-table.js +187 -0
  4. package/lib/shortcuts/index.js +1 -0
  5. package/package.json +3 -3
  6. package/requirements.dev.txt +2 -2
  7. package/test/fixtures/shortcuts/glue-iceberg-table-defaults.json +41 -0
  8. package/test/fixtures/shortcuts/glue-iceberg-table-no-defaults.json +39 -0
  9. package/test/fixtures/shortcuts/glue-iceberg-table-with-all-optimizers.json +101 -0
  10. package/test/fixtures/shortcuts/glue-iceberg-table-with-both-optimizers.json +80 -0
  11. package/test/fixtures/shortcuts/glue-iceberg-table-with-compaction-custom.json +68 -0
  12. package/test/fixtures/shortcuts/glue-iceberg-table-with-compaction-defaults.json +57 -0
  13. package/test/fixtures/shortcuts/glue-iceberg-table-with-optimizer-custom.json +75 -0
  14. package/test/fixtures/shortcuts/glue-iceberg-table-with-optimizer-defaults.json +64 -0
  15. package/test/fixtures/shortcuts/glue-iceberg-table-with-orphan-deletion-custom.json +74 -0
  16. package/test/fixtures/shortcuts/glue-iceberg-table-with-orphan-deletion-defaults.json +62 -0
  17. package/test/shortcuts.test.js +294 -3
  18. package/coverage/clover.xml +0 -598
  19. package/coverage/coverage-final.json +0 -32
  20. package/coverage/lcov-report/base.css +0 -224
  21. package/coverage/lcov-report/block-navigation.js +0 -87
  22. package/coverage/lcov-report/cloudfriend/bin/build-template.js.html +0 -130
  23. package/coverage/lcov-report/cloudfriend/bin/index.html +0 -131
  24. package/coverage/lcov-report/cloudfriend/bin/validate-template.js.html +0 -142
  25. package/coverage/lcov-report/cloudfriend/index.html +0 -116
  26. package/coverage/lcov-report/cloudfriend/index.js.html +0 -307
  27. package/coverage/lcov-report/cloudfriend/lib/build.js.html +0 -217
  28. package/coverage/lcov-report/cloudfriend/lib/conditions.js.html +0 -430
  29. package/coverage/lcov-report/cloudfriend/lib/index.html +0 -206
  30. package/coverage/lcov-report/cloudfriend/lib/intrinsic.js.html +0 -979
  31. package/coverage/lcov-report/cloudfriend/lib/merge.js.html +0 -478
  32. package/coverage/lcov-report/cloudfriend/lib/pseudo.js.html +0 -370
  33. package/coverage/lcov-report/cloudfriend/lib/rules.js.html +0 -349
  34. package/coverage/lcov-report/cloudfriend/lib/shortcuts/cross-account-role.js.html +0 -244
  35. package/coverage/lcov-report/cloudfriend/lib/shortcuts/event-lambda.js.html +0 -367
  36. package/coverage/lcov-report/cloudfriend/lib/shortcuts/glue-database.js.html +0 -286
  37. package/coverage/lcov-report/cloudfriend/lib/shortcuts/glue-json-table.js.html +0 -235
  38. package/coverage/lcov-report/cloudfriend/lib/shortcuts/glue-orc-table.js.html +0 -226
  39. package/coverage/lcov-report/cloudfriend/lib/shortcuts/glue-parquet-table.js.html +0 -268
  40. package/coverage/lcov-report/cloudfriend/lib/shortcuts/glue-presto-view.js.html +0 -358
  41. package/coverage/lcov-report/cloudfriend/lib/shortcuts/glue-spark-view.js.html +0 -241
  42. package/coverage/lcov-report/cloudfriend/lib/shortcuts/glue-table.js.html +0 -481
  43. package/coverage/lcov-report/cloudfriend/lib/shortcuts/hookshot.js.html +0 -1504
  44. package/coverage/lcov-report/cloudfriend/lib/shortcuts/index.html +0 -416
  45. package/coverage/lcov-report/cloudfriend/lib/shortcuts/index.js.html +0 -154
  46. package/coverage/lcov-report/cloudfriend/lib/shortcuts/kinesis-firehose-base.js.html +0 -418
  47. package/coverage/lcov-report/cloudfriend/lib/shortcuts/lambda.js.html +0 -832
  48. package/coverage/lcov-report/cloudfriend/lib/shortcuts/log-subscription-lambda.js.html +0 -310
  49. package/coverage/lcov-report/cloudfriend/lib/shortcuts/queue-lambda.js.html +0 -364
  50. package/coverage/lcov-report/cloudfriend/lib/shortcuts/queue.js.html +0 -619
  51. package/coverage/lcov-report/cloudfriend/lib/shortcuts/role.js.html +0 -382
  52. package/coverage/lcov-report/cloudfriend/lib/shortcuts/s3-kinesis-firehose.js.html +0 -568
  53. package/coverage/lcov-report/cloudfriend/lib/shortcuts/scheduled-lambda.js.html +0 -490
  54. package/coverage/lcov-report/cloudfriend/lib/shortcuts/service-role.js.html +0 -307
  55. package/coverage/lcov-report/cloudfriend/lib/shortcuts/stream-lambda.js.html +0 -493
  56. package/coverage/lcov-report/cloudfriend/lib/validate.js.html +0 -154
  57. package/coverage/lcov-report/favicon.png +0 -0
  58. package/coverage/lcov-report/index.html +0 -161
  59. package/coverage/lcov-report/prettify.css +0 -1
  60. package/coverage/lcov-report/prettify.js +0 -2
  61. package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
  62. package/coverage/lcov-report/sorter.js +0 -210
  63. package/coverage/lcov.info +0 -1240
package/changelog.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 9.3.1
4
+
5
+ - Add `GlueIcebergTable` shortcut for creating AWS Glue tables backed by Apache Iceberg format with support for table optimizers.
6
+
3
7
  ## 9.2.1
4
8
 
5
9
  - Refactor tests to use `jest` instead of `tape` & update linting dependencies to fix security vulnerabilities.
@@ -12,6 +12,9 @@ a Lambda permission.</p>
12
12
  <dt><a href="#GlueDatabase">GlueDatabase</a></dt>
13
13
  <dd><p>Create a Glue Database.</p>
14
14
  </dd>
15
+ <dt><a href="#GlueIcebergTable">GlueIcebergTable</a></dt>
16
+ <dd><p>Create a Glue table backed by Apache Iceberg format on S3.</p>
17
+ </dd>
15
18
  <dt><a href="#GlueJsonTable">GlueJsonTable</a></dt>
16
19
  <dd><p>Create a Glue Table backed by line-delimited JSON files on S3.</p>
17
20
  </dd>
@@ -202,6 +205,40 @@ const db = new cf.shortcuts.GlueDatabase({
202
205
 
203
206
  module.exports = cf.merge(myTemplate, db);
204
207
  ```
208
+ <a name="GlueIcebergTable"></a>
209
+
210
+ ## GlueIcebergTable
211
+ Create a Glue table backed by Apache Iceberg format on S3.
212
+
213
+ **Kind**: global class
214
+ <a name="new_GlueIcebergTable_new"></a>
215
+
216
+ ### new GlueIcebergTable(options)
217
+
218
+ | Param | Type | Default | Description |
219
+ | --- | --- | --- | --- |
220
+ | options | <code>Object</code> | | Options for creating an Iceberg table. |
221
+ | options.LogicalName | <code>String</code> | | The logical name of the Glue Table within the CloudFormation template. |
222
+ | options.Name | <code>String</code> | | The name of the table. |
223
+ | options.DatabaseName | <code>String</code> | | The name of the database the table resides in. |
224
+ | options.Location | <code>String</code> | | The physical location of the table (S3 URI). Required. |
225
+ | options.Schema | <code>Object</code> | | Full Iceberg schema definition with Type: "struct" and Fields array. Each field must have Id (integer), Name (string), Type (string or object for complex types), and Required (boolean). See [AWS documentation](https://docs.aws.amazon.com/glue/latest/webapi/API_IcebergSchema.html). |
226
+ | [options.PartitionSpec] | <code>Object</code> | | Iceberg partition specification. See [AWS documentation](https://docs.aws.amazon.com/glue/latest/webapi/API_IcebergPartitionSpec.html). |
227
+ | [options.WriteOrder] | <code>Object</code> | | Iceberg write order specification. See [AWS documentation](https://docs.aws.amazon.com/glue/latest/webapi/API_IcebergSortOrder.html). |
228
+ | [options.CatalogId] | <code>String</code> | <code>AccountId</code> | The AWS account ID for the account in which to create the table. |
229
+ | [options.IcebergVersion] | <code>String</code> | <code>&#x27;2&#x27;</code> | The table version for the Iceberg table. |
230
+ | [options.EnableOptimizer] | <code>Boolean</code> | <code>false</code> | Whether to enable the snapshot retention optimizer. |
231
+ | [options.OptimizerRoleArn] | <code>String</code> | | The ARN of the IAM role for the retention optimizer. Required if EnableOptimizer is true. |
232
+ | [options.SnapshotRetentionPeriodInDays] | <code>Number</code> | <code>5</code> | The number of days to retain snapshots. |
233
+ | [options.NumberOfSnapshotsToRetain] | <code>Number</code> | <code>1</code> | The minimum number of snapshots to retain. |
234
+ | [options.CleanExpiredFiles] | <code>Boolean</code> | <code>true</code> | Whether to delete expired data files after expiring snapshots. |
235
+ | [options.EnableCompaction] | <code>Boolean</code> | <code>false</code> | Whether to enable the compaction optimizer. |
236
+ | [options.CompactionRoleArn] | <code>String</code> | | The ARN of the IAM role for the compaction optimizer. Required if EnableCompaction is true. |
237
+ | [options.EnableOrphanFileDeletion] | <code>Boolean</code> | <code>false</code> | Whether to enable the orphan file deletion optimizer. |
238
+ | [options.OrphanFileDeletionRoleArn] | <code>String</code> | | The ARN of the IAM role for the orphan file deletion optimizer. Required if EnableOrphanFileDeletion is true. |
239
+ | [options.OrphanFileRetentionPeriodInDays] | <code>Number</code> | <code>3</code> | The number of days to retain orphan files before deleting them. |
240
+ | [options.OrphanFileDeletionLocation] | <code>String</code> | | The S3 location to scan for orphan files. |
241
+
205
242
  <a name="GlueJsonTable"></a>
206
243
 
207
244
  ## GlueJsonTable
@@ -0,0 +1,187 @@
1
+ 'use strict';
2
+
3
+ /**
4
+ * Create a Glue table backed by Apache Iceberg format on S3.
5
+ *
6
+ * @param {Object} options - Options for creating an Iceberg table.
7
+ * @param {String} options.LogicalName - The logical name of the Glue Table within the CloudFormation template.
8
+ * @param {String} options.Name - The name of the table.
9
+ * @param {String} options.DatabaseName - The name of the database the table resides in.
10
+ * @param {String} options.Location - The physical location of the table (S3 URI). Required.
11
+ * @param {Object} options.Schema - Full Iceberg schema definition with Type: "struct" and Fields array.
12
+ * Each field must have Id (integer), Name (string), Type (string or object for complex types), and Required (boolean).
13
+ * See [AWS
14
+ * documentation](https://docs.aws.amazon.com/glue/latest/webapi/API_IcebergSchema.html).
15
+ * @param {Object} [options.PartitionSpec] - Iceberg partition specification. See [AWS
16
+ * documentation](https://docs.aws.amazon.com/glue/latest/webapi/API_IcebergPartitionSpec.html).
17
+ * @param {Object} [options.WriteOrder] - Iceberg write order specification. See [AWS
18
+ * documentation](https://docs.aws.amazon.com/glue/latest/webapi/API_IcebergSortOrder.html).
19
+ * @param {String} [options.CatalogId=AccountId] - The AWS account ID for the account in which to create the table.
20
+ * @param {String} [options.IcebergVersion='2'] - The table version for the Iceberg table.
21
+ * @param {Boolean} [options.EnableOptimizer=false] - Whether to enable the snapshot retention optimizer.
22
+ * @param {String} [options.OptimizerRoleArn=undefined] - The ARN of the IAM role for the retention optimizer. Required if EnableOptimizer is true.
23
+ * @param {Number} [options.SnapshotRetentionPeriodInDays=5] - The number of days to retain snapshots.
24
+ * @param {Number} [options.NumberOfSnapshotsToRetain=1] - The minimum number of snapshots to retain.
25
+ * @param {Boolean} [options.CleanExpiredFiles=true] - Whether to delete expired data files after expiring snapshots.
26
+ * @param {Boolean} [options.EnableCompaction=false] - Whether to enable the compaction optimizer.
27
+ * @param {String} [options.CompactionRoleArn=undefined] - The ARN of the IAM role for the compaction optimizer. Required if EnableCompaction is true.
28
+ * @param {Boolean} [options.EnableOrphanFileDeletion=false] - Whether to enable the orphan file deletion optimizer.
29
+ * @param {String} [options.OrphanFileDeletionRoleArn=undefined] - The ARN of the IAM role for the orphan file deletion optimizer. Required if EnableOrphanFileDeletion is true.
30
+ * @param {Number} [options.OrphanFileRetentionPeriodInDays=3] - The number of days to retain orphan files before deleting them.
31
+ * @param {String} [options.OrphanFileDeletionLocation=undefined] - The S3 location to scan for orphan files.
32
+ */
33
+ class GlueIcebergTable {
34
+ constructor(options) {
35
+ if (!options) throw new Error('Options required');
36
+ const {
37
+ LogicalName,
38
+ Name,
39
+ DatabaseName,
40
+ Location,
41
+ Schema,
42
+ PartitionSpec,
43
+ WriteOrder,
44
+ CatalogId = { Ref: 'AWS::AccountId' },
45
+ IcebergVersion = '2',
46
+ EnableOptimizer = false,
47
+ OptimizerRoleArn,
48
+ SnapshotRetentionPeriodInDays = 5,
49
+ NumberOfSnapshotsToRetain = 1,
50
+ CleanExpiredFiles = true,
51
+ EnableCompaction = false,
52
+ CompactionRoleArn,
53
+ EnableOrphanFileDeletion = false,
54
+ OrphanFileDeletionRoleArn,
55
+ OrphanFileRetentionPeriodInDays = 3,
56
+ OrphanFileDeletionLocation
57
+ } = options;
58
+
59
+ // Validate required fields
60
+ const required = [LogicalName, Name, DatabaseName, Location, Schema];
61
+ if (required.some((variable) => !variable))
62
+ throw new Error('You must provide a LogicalName, Name, DatabaseName, Location, and Schema');
63
+
64
+ if (EnableOptimizer && !OptimizerRoleArn)
65
+ throw new Error('You must provide an OptimizerRoleArn when EnableOptimizer is true');
66
+
67
+ if (EnableCompaction && !CompactionRoleArn)
68
+ throw new Error('You must provide a CompactionRoleArn when EnableCompaction is true');
69
+
70
+ if (EnableOrphanFileDeletion && !OrphanFileDeletionRoleArn)
71
+ throw new Error('You must provide an OrphanFileDeletionRoleArn when EnableOrphanFileDeletion is true');
72
+
73
+ // Build the Iceberg table resource (no TableInput!)
74
+ this.Resources = {
75
+ [LogicalName]: {
76
+ Type: 'AWS::Glue::Table',
77
+ Properties: {
78
+ CatalogId,
79
+ DatabaseName,
80
+ Name,
81
+ OpenTableFormatInput: {
82
+ IcebergInput: {
83
+ MetadataOperation: 'CREATE', // NOTE: this is _always_ CREATE because it's about creating a new metadata version, not creating a new table
84
+ Version: IcebergVersion,
85
+ IcebergTableInput: {
86
+ Location,
87
+ Schema
88
+ }
89
+ }
90
+ }
91
+ }
92
+ }
93
+ };
94
+
95
+ // Add optional PartitionSpec if provided
96
+ if (PartitionSpec) {
97
+ this.Resources[LogicalName].Properties.OpenTableFormatInput.IcebergInput.IcebergTableInput.PartitionSpec = PartitionSpec;
98
+ }
99
+
100
+ // Add optional WriteOrder if provided
101
+ if (WriteOrder) {
102
+ this.Resources[LogicalName].Properties.OpenTableFormatInput.IcebergInput.IcebergTableInput.WriteOrder = WriteOrder;
103
+ }
104
+
105
+ // Optionally add TableOptimizer for configuring snapshot retention
106
+ if (EnableOptimizer) {
107
+ const optimizerLogicalName = `${LogicalName}RetentionOptimizer`;
108
+ this.Resources[optimizerLogicalName] = {
109
+ Type: 'AWS::Glue::TableOptimizer',
110
+ DependsOn: LogicalName,
111
+ Properties: {
112
+ CatalogId,
113
+ DatabaseName,
114
+ TableName: Name,
115
+ Type: 'retention',
116
+ TableOptimizerConfiguration: {
117
+ RoleArn: OptimizerRoleArn,
118
+ Enabled: true,
119
+ RetentionConfiguration: {
120
+ IcebergConfiguration: {
121
+ SnapshotRetentionPeriodInDays,
122
+ NumberOfSnapshotsToRetain,
123
+ CleanExpiredFiles
124
+ }
125
+ }
126
+ }
127
+ }
128
+ };
129
+ }
130
+
131
+ // Optionally add TableOptimizer for compaction
132
+ // NOTE: CloudFormation does not support CompactionConfiguration properties
133
+ // (strategy, minInputFiles, deleteFileThreshold). These must be configured
134
+ // via AWS CLI/API after stack creation, or will use AWS defaults.
135
+ // See: https://github.com/aws-cloudformation/cloudformation-coverage-roadmap/issues/2257
136
+ if (EnableCompaction) {
137
+ const compactionLogicalName = `${LogicalName}CompactionOptimizer`;
138
+ this.Resources[compactionLogicalName] = {
139
+ Type: 'AWS::Glue::TableOptimizer',
140
+ DependsOn: LogicalName,
141
+ Properties: {
142
+ CatalogId,
143
+ DatabaseName,
144
+ TableName: Name,
145
+ Type: 'compaction',
146
+ TableOptimizerConfiguration: {
147
+ RoleArn: CompactionRoleArn,
148
+ Enabled: true
149
+ }
150
+ }
151
+ };
152
+ }
153
+
154
+ // Optionally add TableOptimizer for orphan file deletion
155
+ if (EnableOrphanFileDeletion) {
156
+ const orphanLogicalName = `${LogicalName}OrphanFileDeletionOptimizer`;
157
+ const icebergConfiguration = {
158
+ OrphanFileRetentionPeriodInDays
159
+ };
160
+
161
+ // Only add Location if specified, otherwise it defaults to table location
162
+ if (OrphanFileDeletionLocation) {
163
+ icebergConfiguration.Location = OrphanFileDeletionLocation;
164
+ }
165
+
166
+ this.Resources[orphanLogicalName] = {
167
+ Type: 'AWS::Glue::TableOptimizer',
168
+ DependsOn: LogicalName,
169
+ Properties: {
170
+ CatalogId,
171
+ DatabaseName,
172
+ TableName: Name,
173
+ Type: 'orphan_file_deletion',
174
+ TableOptimizerConfiguration: {
175
+ RoleArn: OrphanFileDeletionRoleArn,
176
+ Enabled: true,
177
+ OrphanFileDeletionConfiguration: {
178
+ IcebergConfiguration: icebergConfiguration
179
+ }
180
+ }
181
+ }
182
+ };
183
+ }
184
+ }
185
+ }
186
+
187
+ module.exports = GlueIcebergTable;
@@ -16,6 +16,7 @@ module.exports = {
16
16
  GlueJsonTable: require('./glue-json-table'),
17
17
  GlueOrcTable: require('./glue-orc-table'),
18
18
  GlueParquetTable: require('./glue-parquet-table'),
19
+ GlueIcebergTable: require('./glue-iceberg-table'),
19
20
  GluePrestoView: require('./glue-presto-view'),
20
21
  GlueSparkView: require('./glue-spark-view'),
21
22
  hookshot: require('./hookshot'),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mapbox/cloudfriend",
3
- "version": "9.2.1",
3
+ "version": "9.3.2",
4
4
  "description": "Helper functions for assembling CloudFormation templates in JavaScript",
5
5
  "main": "index.js",
6
6
  "engines": {
@@ -38,10 +38,10 @@
38
38
  "eslint": "^8.57.0",
39
39
  "eslint-plugin-node": "^6.0.1",
40
40
  "jest": "^29.7.0",
41
- "jsdoc-to-markdown": "^7.1.1"
41
+ "jsdoc-to-markdown": "^9.1.3"
42
42
  },
43
43
  "dependencies": {
44
- "@aws-sdk/client-cloudformation": "^3.848.0",
44
+ "@aws-sdk/client-cloudformation": "^3.985.0",
45
45
  "minimist": "^1.2.6",
46
46
  "redent": "^2.0.0"
47
47
  },
@@ -1,2 +1,2 @@
1
- aws-sam-cli==1.142.1
2
- cfn-lint==1.36.1
1
+ aws-sam-cli==1.149.0
2
+ cfn-lint==1.41.0
@@ -0,0 +1,41 @@
1
+ {
2
+ "AWSTemplateFormatVersion": "2010-09-09",
3
+ "Metadata": {},
4
+ "Parameters": {},
5
+ "Rules": {},
6
+ "Mappings": {},
7
+ "Conditions": {},
8
+ "Resources": {
9
+ "MyTable": {
10
+ "Type": "AWS::Glue::Table",
11
+ "Properties": {
12
+ "CatalogId": {
13
+ "Ref": "AWS::AccountId"
14
+ },
15
+ "DatabaseName": "my_database",
16
+ "Name": "my_table",
17
+ "OpenTableFormatInput": {
18
+ "IcebergInput": {
19
+ "MetadataOperation": "CREATE",
20
+ "Version": "2",
21
+ "IcebergTableInput": {
22
+ "Location": "s3://fake/location",
23
+ "Schema": {
24
+ "Type": "struct",
25
+ "Fields": [
26
+ {
27
+ "Name": "column",
28
+ "Type": "string",
29
+ "Id": 1,
30
+ "Required": true
31
+ }
32
+ ]
33
+ }
34
+ }
35
+ }
36
+ }
37
+ }
38
+ }
39
+ },
40
+ "Outputs": {}
41
+ }
@@ -0,0 +1,39 @@
1
+ {
2
+ "AWSTemplateFormatVersion": "2010-09-09",
3
+ "Metadata": {},
4
+ "Parameters": {},
5
+ "Rules": {},
6
+ "Mappings": {},
7
+ "Conditions": {},
8
+ "Resources": {
9
+ "MyTable": {
10
+ "Type": "AWS::Glue::Table",
11
+ "Properties": {
12
+ "CatalogId": "1234",
13
+ "DatabaseName": "my_database",
14
+ "Name": "my_table",
15
+ "OpenTableFormatInput": {
16
+ "IcebergInput": {
17
+ "MetadataOperation": "CREATE",
18
+ "Version": "2",
19
+ "IcebergTableInput": {
20
+ "Location": "s3://fake/location",
21
+ "Schema": {
22
+ "Type": "struct",
23
+ "Fields": [
24
+ {
25
+ "Name": "column",
26
+ "Type": "string",
27
+ "Id": 1,
28
+ "Required": true
29
+ }
30
+ ]
31
+ }
32
+ }
33
+ }
34
+ }
35
+ }
36
+ }
37
+ },
38
+ "Outputs": {}
39
+ }
@@ -0,0 +1,101 @@
1
+ {
2
+ "AWSTemplateFormatVersion": "2010-09-09",
3
+ "Metadata": {},
4
+ "Parameters": {},
5
+ "Rules": {},
6
+ "Mappings": {},
7
+ "Conditions": {},
8
+ "Resources": {
9
+ "MyTable": {
10
+ "Type": "AWS::Glue::Table",
11
+ "Properties": {
12
+ "CatalogId": {
13
+ "Ref": "AWS::AccountId"
14
+ },
15
+ "DatabaseName": "my_database",
16
+ "Name": "my_table",
17
+ "OpenTableFormatInput": {
18
+ "IcebergInput": {
19
+ "MetadataOperation": "CREATE",
20
+ "Version": "2",
21
+ "IcebergTableInput": {
22
+ "Location": "s3://fake/location",
23
+ "Schema": {
24
+ "Type": "struct",
25
+ "Fields": [
26
+ {
27
+ "Name": "column",
28
+ "Type": "string",
29
+ "Id": 1,
30
+ "Required": true
31
+ }
32
+ ]
33
+ }
34
+ }
35
+ }
36
+ }
37
+ }
38
+ },
39
+ "MyTableRetentionOptimizer": {
40
+ "Type": "AWS::Glue::TableOptimizer",
41
+ "DependsOn": "MyTable",
42
+ "Properties": {
43
+ "CatalogId": {
44
+ "Ref": "AWS::AccountId"
45
+ },
46
+ "DatabaseName": "my_database",
47
+ "TableName": "my_table",
48
+ "Type": "retention",
49
+ "TableOptimizerConfiguration": {
50
+ "RoleArn": "arn:aws:iam::123456789012:role/SharedRole",
51
+ "Enabled": true,
52
+ "RetentionConfiguration": {
53
+ "IcebergConfiguration": {
54
+ "SnapshotRetentionPeriodInDays": 5,
55
+ "NumberOfSnapshotsToRetain": 1,
56
+ "CleanExpiredFiles": true
57
+ }
58
+ }
59
+ }
60
+ }
61
+ },
62
+ "MyTableCompactionOptimizer": {
63
+ "Type": "AWS::Glue::TableOptimizer",
64
+ "DependsOn": "MyTable",
65
+ "Properties": {
66
+ "CatalogId": {
67
+ "Ref": "AWS::AccountId"
68
+ },
69
+ "DatabaseName": "my_database",
70
+ "TableName": "my_table",
71
+ "Type": "compaction",
72
+ "TableOptimizerConfiguration": {
73
+ "RoleArn": "arn:aws:iam::123456789012:role/SharedRole",
74
+ "Enabled": true
75
+ }
76
+ }
77
+ },
78
+ "MyTableOrphanFileDeletionOptimizer": {
79
+ "Type": "AWS::Glue::TableOptimizer",
80
+ "DependsOn": "MyTable",
81
+ "Properties": {
82
+ "CatalogId": {
83
+ "Ref": "AWS::AccountId"
84
+ },
85
+ "DatabaseName": "my_database",
86
+ "TableName": "my_table",
87
+ "Type": "orphan_file_deletion",
88
+ "TableOptimizerConfiguration": {
89
+ "RoleArn": "arn:aws:iam::123456789012:role/SharedRole",
90
+ "Enabled": true,
91
+ "OrphanFileDeletionConfiguration": {
92
+ "IcebergConfiguration": {
93
+ "OrphanFileRetentionPeriodInDays": 3
94
+ }
95
+ }
96
+ }
97
+ }
98
+ }
99
+ },
100
+ "Outputs": {}
101
+ }
@@ -0,0 +1,80 @@
1
+ {
2
+ "AWSTemplateFormatVersion": "2010-09-09",
3
+ "Metadata": {},
4
+ "Parameters": {},
5
+ "Rules": {},
6
+ "Mappings": {},
7
+ "Conditions": {},
8
+ "Resources": {
9
+ "MyTable": {
10
+ "Type": "AWS::Glue::Table",
11
+ "Properties": {
12
+ "CatalogId": {
13
+ "Ref": "AWS::AccountId"
14
+ },
15
+ "DatabaseName": "my_database",
16
+ "Name": "my_table",
17
+ "OpenTableFormatInput": {
18
+ "IcebergInput": {
19
+ "MetadataOperation": "CREATE",
20
+ "Version": "2",
21
+ "IcebergTableInput": {
22
+ "Location": "s3://fake/location",
23
+ "Schema": {
24
+ "Type": "struct",
25
+ "Fields": [
26
+ {
27
+ "Name": "column",
28
+ "Type": "string",
29
+ "Id": 1,
30
+ "Required": true
31
+ }
32
+ ]
33
+ }
34
+ }
35
+ }
36
+ }
37
+ }
38
+ },
39
+ "MyTableRetentionOptimizer": {
40
+ "Type": "AWS::Glue::TableOptimizer",
41
+ "DependsOn": "MyTable",
42
+ "Properties": {
43
+ "CatalogId": {
44
+ "Ref": "AWS::AccountId"
45
+ },
46
+ "DatabaseName": "my_database",
47
+ "TableName": "my_table",
48
+ "Type": "retention",
49
+ "TableOptimizerConfiguration": {
50
+ "RoleArn": "arn:aws:iam::123456789012:role/RetentionRole",
51
+ "Enabled": true,
52
+ "RetentionConfiguration": {
53
+ "IcebergConfiguration": {
54
+ "SnapshotRetentionPeriodInDays": 5,
55
+ "NumberOfSnapshotsToRetain": 1,
56
+ "CleanExpiredFiles": true
57
+ }
58
+ }
59
+ }
60
+ }
61
+ },
62
+ "MyTableCompactionOptimizer": {
63
+ "Type": "AWS::Glue::TableOptimizer",
64
+ "DependsOn": "MyTable",
65
+ "Properties": {
66
+ "CatalogId": {
67
+ "Ref": "AWS::AccountId"
68
+ },
69
+ "DatabaseName": "my_database",
70
+ "TableName": "my_table",
71
+ "Type": "compaction",
72
+ "TableOptimizerConfiguration": {
73
+ "RoleArn": "arn:aws:iam::123456789012:role/CompactionRole",
74
+ "Enabled": true
75
+ }
76
+ }
77
+ }
78
+ },
79
+ "Outputs": {}
80
+ }
@@ -0,0 +1,68 @@
1
+ {
2
+ "AWSTemplateFormatVersion": "2010-09-09",
3
+ "Metadata": {},
4
+ "Parameters": {},
5
+ "Rules": {},
6
+ "Mappings": {},
7
+ "Conditions": {},
8
+ "Resources": {
9
+ "CompactionRole": {
10
+ "Type": "AWS::IAM::Role",
11
+ "Properties": {
12
+ "AssumeRolePolicyDocument": {}
13
+ }
14
+ },
15
+ "MyTable": {
16
+ "Type": "AWS::Glue::Table",
17
+ "Properties": {
18
+ "CatalogId": {
19
+ "Ref": "AWS::AccountId"
20
+ },
21
+ "DatabaseName": "my_database",
22
+ "Name": "my_table",
23
+ "OpenTableFormatInput": {
24
+ "IcebergInput": {
25
+ "MetadataOperation": "CREATE",
26
+ "Version": "2",
27
+ "IcebergTableInput": {
28
+ "Location": "s3://fake/location",
29
+ "Schema": {
30
+ "Type": "struct",
31
+ "Fields": [
32
+ {
33
+ "Name": "column",
34
+ "Type": "string",
35
+ "Id": 1,
36
+ "Required": true
37
+ }
38
+ ]
39
+ }
40
+ }
41
+ }
42
+ }
43
+ }
44
+ },
45
+ "MyTableCompactionOptimizer": {
46
+ "Type": "AWS::Glue::TableOptimizer",
47
+ "DependsOn": "MyTable",
48
+ "Properties": {
49
+ "CatalogId": {
50
+ "Ref": "AWS::AccountId"
51
+ },
52
+ "DatabaseName": "my_database",
53
+ "TableName": "my_table",
54
+ "Type": "compaction",
55
+ "TableOptimizerConfiguration": {
56
+ "RoleArn": {
57
+ "Fn::GetAtt": [
58
+ "CompactionRole",
59
+ "Arn"
60
+ ]
61
+ },
62
+ "Enabled": true
63
+ }
64
+ }
65
+ }
66
+ },
67
+ "Outputs": {}
68
+ }
@@ -0,0 +1,57 @@
1
+ {
2
+ "AWSTemplateFormatVersion": "2010-09-09",
3
+ "Metadata": {},
4
+ "Parameters": {},
5
+ "Rules": {},
6
+ "Mappings": {},
7
+ "Conditions": {},
8
+ "Resources": {
9
+ "MyTable": {
10
+ "Type": "AWS::Glue::Table",
11
+ "Properties": {
12
+ "CatalogId": {
13
+ "Ref": "AWS::AccountId"
14
+ },
15
+ "DatabaseName": "my_database",
16
+ "Name": "my_table",
17
+ "OpenTableFormatInput": {
18
+ "IcebergInput": {
19
+ "MetadataOperation": "CREATE",
20
+ "Version": "2",
21
+ "IcebergTableInput": {
22
+ "Location": "s3://fake/location",
23
+ "Schema": {
24
+ "Type": "struct",
25
+ "Fields": [
26
+ {
27
+ "Name": "column",
28
+ "Type": "string",
29
+ "Id": 1,
30
+ "Required": true
31
+ }
32
+ ]
33
+ }
34
+ }
35
+ }
36
+ }
37
+ }
38
+ },
39
+ "MyTableCompactionOptimizer": {
40
+ "Type": "AWS::Glue::TableOptimizer",
41
+ "DependsOn": "MyTable",
42
+ "Properties": {
43
+ "CatalogId": {
44
+ "Ref": "AWS::AccountId"
45
+ },
46
+ "DatabaseName": "my_database",
47
+ "TableName": "my_table",
48
+ "Type": "compaction",
49
+ "TableOptimizerConfiguration": {
50
+ "RoleArn": "arn:aws:iam::123456789012:role/CompactionRole",
51
+ "Enabled": true
52
+ }
53
+ }
54
+ }
55
+ },
56
+ "Outputs": {}
57
+ }