Collector "AWS-TransitGateway" Configuration Manual¶
Before reading this document, please read:
Tip
Before using this collector, you must install the "Integration Core Package" and its accompanying third-party dependencies.
1. Configuration Structure¶
The configuration structure of this collector is as follows:
Field | Type | Required | Description |
---|---|---|---|
regions |
list | Required | List of regions to be collected |
regions[#] |
str | Required | Region ID. For example: 'cn-north-1' See the appendix for the complete list |
2. Configuration Example¶
Collect instance data from the Beijing region
Configuration Filter (Optional)¶
This collector script supports user-defined filters, allowing users to filter target resources based on object attributes. The filter function returns True or False.
-
True: The target resource should be collected.
-
False: The target resource should not be collected.
Supported object attributes for filtering:
Attribute | Description |
---|---|
TransitGatewayId | The ID of the transit gateway |
TransitGatewayArn | The Amazon Resource Name (ARN) of the transit gateway |
State | The state of the transit gateway |
OwnerId | The ID of the Amazon Web Services account that owns the transit gateway |
# Example: Enable the filter to filter based on the TransitGatewayId and State attributes of the object. The configuration format is as follows:
def filter_instance(instance):
'''
return True|False
'''
instance_id = instance['TransitGatewayId']
state = instance['State']
if instance_id in ['xxx'] and state in ['xxx']:
return True
return False
###### Do not modify the following contents #####
from integration_core__runner import Runner
import integration_aws_transit_gateway__main as main
@DFF.API('AWS-TransitGateway Collection', timeout=3600, fixed_crontab='* * * * *')
def run():
collectors = [
main.DataCollector(account, collector_configs, filters=[filter_instance]),
]
Runner(collectors).run()
3. Data Reporting Format¶
After data is successfully synchronized, you can view the data in the "Infrastructure - Resource Catalog" of TrueWatch.
An example of the reported data is as follows:
{
"measurement": "aws_transit_gateway",
"tags": {
"OwnerId" : "xxxx",
"RegionId" : "cn-north-1",
"State" : "available",
"TransitGatewayArn": "arn: xxx",
"TransitGatewayId" : "tgw-xxx",
"name" : "tgw-xxx"
},
"fields": {
"CreationTime": "2023-11-22T09:00:42Z",
"Description" : "Description of the transit gateway",
"Options" : "{Transit gateway options}",
"Tags" : "[Tags of the transit gateway]",
"message" : "{Instance JSON data}"
}
}
Note
The fields in tags and fields may change with subsequent updates.
4. IAM Policy Permissions¶
Note
If users use the method of bringing in IAM roles to collect resources, certain operation permissions need to be enabled.
This collector requires the following permissions:
ec2:DescribeTransitGateways
X. Appendix¶
Please refer to the official AWS documentation: