-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
skip: Merge pull request #27 from epam/feature/ecc-aws-552-dynamodb_t…
…ables_unused new: added policy ecc-aws-552-dynamodb_tables_unused
- Loading branch information
Showing
24 changed files
with
343 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# Copyright (c) 2023 EPAM Systems, Inc. | ||
# | ||
# This Source Code Form is subject to the terms of the Mozilla Public | ||
# License, v. 2.0. If a copy of the MPL was not distributed with this | ||
# file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
|
||
|
||
policies: | ||
- name: ecc-aws-552-dynamodb_tables_unused | ||
comment: '010002062000' | ||
description: | | ||
Unused Amazon DynamoDB tables | ||
resource: aws.dynamodb-table | ||
filters: | ||
- and: | ||
- type: value | ||
key: ProvisionedThroughput.ReadCapacityUnits | ||
op: ne | ||
value: 0 | ||
- type: value | ||
key: TableStatus | ||
value: ACTIVE | ||
- type: value | ||
key: CreationDateTime | ||
value_type: age | ||
value: 60 | ||
op: ge | ||
- or: | ||
- type: value | ||
key: ItemCount | ||
value: 0 | ||
- and: | ||
- type: metrics | ||
name: ConsumedWriteCapacityUnits | ||
namespace: AWS/DynamoDB | ||
statistics: Maximum | ||
days: 60 | ||
value: 0 | ||
op: equal | ||
- type: metrics | ||
name: ConsumedReadCapacityUnits | ||
namespace: AWS/DynamoDB | ||
statistics: Maximum | ||
days: 60 | ||
value: 0 | ||
op: equal |
28 changes: 28 additions & 0 deletions
28
terraform/ecc-aws-552-dynamodb_tables_unused/green/dynamodb.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
resource "aws_dynamodb_table" "this" { | ||
name = "552_dynamodb_table_green" | ||
hash_key = "GreenTableHashKey" | ||
billing_mode = "PROVISIONED" | ||
read_capacity = 1 | ||
write_capacity = 1 | ||
|
||
|
||
attribute { | ||
name = "GreenTableHashKey" | ||
type = "S" | ||
} | ||
} | ||
|
||
resource "aws_dynamodb_table_item" "this" { | ||
table_name = aws_dynamodb_table.this.name | ||
hash_key = aws_dynamodb_table.this.hash_key | ||
|
||
item = <<ITEM | ||
{ | ||
"GreenTableHashKey": {"S": "something"}, | ||
"one": {"N": "11111"}, | ||
"two": {"N": "22222"}, | ||
"three": {"N": "33333"}, | ||
"four": {"N": "44444"} | ||
} | ||
ITEM | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
terraform/ecc-aws-552-dynamodb_tables_unused/red/dynamodb.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
resource "aws_dynamodb_table" "this" { | ||
name = "552_dynamodb_table_red" | ||
hash_key = "GreenTableHashKey" | ||
billing_mode = "PROVISIONED" | ||
read_capacity = 1 | ||
write_capacity = 1 | ||
|
||
|
||
attribute { | ||
name = "GreenTableHashKey" | ||
type = "S" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
34 changes: 0 additions & 34 deletions
34
terraform/ecc-aws-916-waf_global_rulegroup_not_empty/green/waf.tf
This file was deleted.
Oops, something went wrong.
4 changes: 0 additions & 4 deletions
4
terraform/ecc-aws-916-waf_global_rulegroup_not_empty/red/waf.tf
This file was deleted.
Oops, something went wrong.
42 changes: 42 additions & 0 deletions
42
tests/ecc-aws-552-dynamodb_tables_unused/placebo-green/dynamodb.DescribeTable_1.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
{ | ||
"status_code": 200, | ||
"data": { | ||
"Table": { | ||
"AttributeDefinitions": [ | ||
{ | ||
"AttributeName": "GreenTableHashKey", | ||
"AttributeType": "S" | ||
} | ||
], | ||
"TableName": "552_dynamodb_table_green", | ||
"KeySchema": [ | ||
{ | ||
"AttributeName": "GreenTableHashKey", | ||
"KeyType": "HASH" | ||
} | ||
], | ||
"TableStatus": "ACTIVE", | ||
"CreationDateTime": { | ||
"__class__": "datetime", | ||
"year": 2023, | ||
"month": 3, | ||
"day": 14, | ||
"hour": 16, | ||
"minute": 44, | ||
"second": 5, | ||
"microsecond": 334000 | ||
}, | ||
"ProvisionedThroughput": { | ||
"NumberOfDecreasesToday": 0, | ||
"ReadCapacityUnits": 1, | ||
"WriteCapacityUnits": 1 | ||
}, | ||
"TableSizeBytes": 57, | ||
"ItemCount": 1, | ||
"TableArn": "arn:aws:dynamodb:us-east-1:123456789012:table/552_dynamodb_table_green", | ||
"TableId": "352e6eb5-5243-487d-8b54-8d99a47658ad", | ||
"DeletionProtectionEnabled": false | ||
}, | ||
"ResponseMetadata": {} | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
tests/ecc-aws-552-dynamodb_tables_unused/placebo-green/dynamodb.ListTables_1.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"status_code": 200, | ||
"data": { | ||
"TableNames": [ | ||
"552_dynamodb_table_green" | ||
], | ||
"ResponseMetadata": {} | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
tests/ecc-aws-552-dynamodb_tables_unused/placebo-green/monitoring.GetMetricStatistics_1.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"status_code": 200, | ||
"data": { | ||
"Label": "ConsumedWriteCapacityUnits", | ||
"Datapoints": [ | ||
{ | ||
"Timestamp": { | ||
"__class__": "datetime", | ||
"year": 2023, | ||
"month": 6, | ||
"day": 17, | ||
"hour": 7, | ||
"minute": 0, | ||
"second": 0, | ||
"microsecond": 0 | ||
}, | ||
"Maximum": 1.0, | ||
"Unit": "Count" | ||
} | ||
], | ||
"ResponseMetadata": {} | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
tests/ecc-aws-552-dynamodb_tables_unused/placebo-green/monitoring.GetMetricStatistics_2.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"status_code": 200, | ||
"data": { | ||
"Label": "ConsumedReadCapacityUnits", | ||
"Datapoints": [ | ||
{ | ||
"Timestamp": { | ||
"__class__": "datetime", | ||
"year": 2023, | ||
"month": 6, | ||
"day": 17, | ||
"hour": 7, | ||
"minute": 0, | ||
"second": 0, | ||
"microsecond": 0 | ||
}, | ||
"Maximum": 0.5, | ||
"Unit": "Count" | ||
} | ||
], | ||
"ResponseMetadata": {} | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
tests/ecc-aws-552-dynamodb_tables_unused/placebo-green/tagging.GetResources_1.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{ | ||
"status_code": 200, | ||
"data": { | ||
"PaginationToken": "", | ||
"ResourceTagMappingList": [ | ||
{ | ||
"ResourceARN": "arn:aws:dynamodb:us-east-1:123456789012:table/552_dynamodb_table_green", | ||
"Tags": [ | ||
{ | ||
"Key": "CustodianRule", | ||
"Value": "ecc-aws-552-dynamodb_tables_unused" | ||
}, | ||
{ | ||
"Key": "ComplianceStatus", | ||
"Value": "Green" | ||
} | ||
] | ||
} | ||
], | ||
"ResponseMetadata": {} | ||
} | ||
} |
42 changes: 42 additions & 0 deletions
42
tests/ecc-aws-552-dynamodb_tables_unused/placebo-red/dynamodb.DescribeTable_1.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
{ | ||
"status_code": 200, | ||
"data": { | ||
"Table": { | ||
"AttributeDefinitions": [ | ||
{ | ||
"AttributeName": "GreenTableHashKey", | ||
"AttributeType": "S" | ||
} | ||
], | ||
"TableName": "552_dynamodb_table_red", | ||
"KeySchema": [ | ||
{ | ||
"AttributeName": "GreenTableHashKey", | ||
"KeyType": "HASH" | ||
} | ||
], | ||
"TableStatus": "ACTIVE", | ||
"CreationDateTime": { | ||
"__class__": "datetime", | ||
"year": 2023, | ||
"month": 2, | ||
"day": 15, | ||
"hour": 10, | ||
"minute": 30, | ||
"second": 45, | ||
"microsecond": 876000 | ||
}, | ||
"ProvisionedThroughput": { | ||
"NumberOfDecreasesToday": 0, | ||
"ReadCapacityUnits": 1, | ||
"WriteCapacityUnits": 1 | ||
}, | ||
"TableSizeBytes": 0, | ||
"ItemCount": 0, | ||
"TableArn": "arn:aws:dynamodb:us-east-1:123456789012:table/552_dynamodb_table_red", | ||
"TableId": "0918e866-a87a-42fd-be35-f8d7b4f29632", | ||
"DeletionProtectionEnabled": false | ||
}, | ||
"ResponseMetadata": {} | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
tests/ecc-aws-552-dynamodb_tables_unused/placebo-red/dynamodb.ListTables_1.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"status_code": 200, | ||
"data": { | ||
"TableNames": [ | ||
"552_dynamodb_table_red" | ||
], | ||
"ResponseMetadata": {} | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
tests/ecc-aws-552-dynamodb_tables_unused/placebo-red/monitoring.GetMetricStatistics_1.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"status_code": 200, | ||
"data": { | ||
"Label": "ConsumedWriteCapacityUnits", | ||
"Datapoints": [ | ||
{ | ||
"Timestamp": { | ||
"__class__": "datetime", | ||
"year": 2023, | ||
"month": 7, | ||
"day": 17, | ||
"hour": 7, | ||
"minute": 35, | ||
"second": 0, | ||
"microsecond": 0 | ||
}, | ||
"Maximum": 0.0, | ||
"Unit": "Count" | ||
} | ||
], | ||
"ResponseMetadata": {} | ||
} | ||
} |
Oops, something went wrong.