Skip to content

ControlTower - EventRule - DeregisterManagedAccount

0

Hi,

I try to catch an event when I "unmanage" and AWS Account in ControlTower.

I test whith this pattern but it is never triggered

  event_pattern = <<PATTERN
{
  "detail-type": ["AWS Service Event via CloudTrail"],
  "source": ["aws.controltower"],
  "detail": {
    "eventName": ["DeregisterManagedAccount"],
    "eventSource": ["controltower.amazonaws.com"]
  }
}
PATTERN
}

Nonetheless the trigger for a new manage account works fine

  event_pattern = <<PATTERN
{
  "detail-type": ["AWS Service Event via CloudTrail"],
  "source": ["aws.controltower"],
  "detail": {
    "eventName": ["CreateManagedAccount"],
    "eventSource": ["controltower.amazonaws.com"]
  }
}
PATTERN
}

What event can be used to catch the fact that an account is unmanaged by CT.

Regards

asked 2 years ago428 views

1 Answer
0

Hi Fabien,

Based on the AWS documentation, the "DeregisterManagedAccount" API isn't available. Instead, you may need to use the following API:

{
  "source": ["aws.controltower"],
  "detail-type": ["AWS Service Event via CloudTrail"],
  "detail": {
    "eventName": ["UpdateManagedAccount"]
  }
}

You can review more details about this in the AWS documentation on Logging AWS Control Tower Actions with AWS CloudTrail.

Additionally, AWS Control Tower offers Lifecycle Events, which are specifically designed for handling accounts and organizational units created or managed through Control Tower.

Another interesting point is that if you want to create a new AWS account using the AWS CLI via Control Tower, there isn't a direct API for this. Instead, you need to use the Service Catalog CLI commands. Here's an article that provides more information on how to do this: A programmatic way to create an account in AWS Control Tower.

answered 2 years ago

EXPERT

reviewed 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.