Governance has always been of one of the key issues faced by cloud administrators, especially when it comes to tracking EC2 instances for cost and compliance purposes. In this use case, we are going to automate the tagging of EC2 instances and its corresponding resources using a simple Lambda function used in conjuncture with AWS CloudTrail and CloudWatch. The function will ensure that users can work only on those resources that they have created based on resource tags.
How it all works is as follows. We start off by creating a trail in CloudTrail to track all the API calls and events taking place within the AWS account. Next, we create a dummy user in IAM, which will not only have permissions ...