- Newest
- Most votes
- Most comments
Hello.
I was looking at the following document, but 'transit-gateway-peering-attachment' does not exist in the 'ResourceType' specified in "TagSpecifications".
I think it should be something like "transit-gateway-attachment".
https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/ec2/client/create_transit_gateway_peering_attachment.html
In other words, I thought it would be necessary to write code like the following.
def create_tgw_peering_attach(region, region_name, project_name, tgw_id, target_tgw_id, target_region, target_region_name):
ec2 = boto3.client('ec2', region_name=region)
peer_account_id = get_account_id()
response = ec2.create_transit_gateway_peering_attachment(
PeerAccountId=peer_account_id,
TransitGatewayId=tgw_id,
PeerTransitGatewayId=target_tgw_id,
PeerRegion=target_region,
TagSpecifications=[
{
'ResourceType': 'transit-gateway-attachment',
'Tags': [
{
'Key': 'Name',
'Value': f'{project_name}-{region_name}-to-{target_region_name}-TGW-Peering'
}
]
}
]
)
peering_tgw_attach_id = response['TransitGatewayPeeringAttachment']['TransitGatewayAttachmentId']
print(f'CREATE Complete: Transit Gateway - Peering {region_name}to {target_region}')
return peering_tgw_attach_id
The error you're encountering is not due to a restriction on the number of CreateTransitGatewayPeeringAttachment operations you can perform. Instead, it's an internal error on AWS's side that persisted despite multiple retry attempts.
This type of error (InternalError) usually indicates a temporary issue with AWS services. It's not something you can directly control or remove. However, there are a few things you can try:
-
Wait and retry: Sometimes, these errors resolve themselves after a short period. You could implement a backoff strategy in your code to wait for increasingly longer periods between retries.
-
Check AWS service health: Verify if there are any ongoing issues with EC2 or Transit Gateway services in your region on the AWS Service Health Dashboard.
-
Verify your inputs: Double-check that all the parameters you're passing to the create_transit_gateway_peering_attachment function are correct, especially the TransitGatewayId, PeerTransitGatewayId, and PeerRegion.
-
Check your permissions: Ensure that your AWS credentials have the necessary permissions to create transit gateway peering attachments.
-
Contact AWS Support: If the issue persists, you may need to reach out to AWS Support for further assistance.
Your code structure for creating the transit gateway peering attachment looks correct. The error is not due to your implementation, but rather an issue on AWS's side. Keep practicing with boto3, and don't be discouraged by temporary service issues!
Sources
Systems Manager examples using SDK for Python (Boto3) - AWS SDK Code Examples
API Gateway examples using SDK for Python (Boto3) - AWS SDK Code Examples
Thanks for your answer. I ran this function code again after about 6 hours. But the result is the same. But I will keep trying.
[1]. I did it after 6 hours, but the error result is the same. [2]. I will check it today! [3]. All parameters are considered correct. [4]. I tested it with root ID. But the result is the same as [1]. [5]. I will try this today too!
Relevant content
- asked a year ago
- AWS OFFICIALUpdated a year ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 3 years ago
- AWS OFFICIALUpdated 5 months ago
u r right! My TagSpecifications is wrong. 'ResourceType': 'transit-gateway-attachment', here! it's right. ty for help me :3 have a good day! riku kobayashi and oleksii bebych! thank you!