There are a lot of AWS services that start with ‘Cloud’.<\/p>\n\n\n\n
Initially, CloudTrail and CloudWatch sound similar, but there are some key differences to what they do, how they monitor services, and when you might need them in isolation or in combination.<\/p>\n\n\n\n
What does CloudWatch do?<\/a>
When to use CloudWatch<\/a>
What does CloudTrail do?<\/a>
When to use CloudTrail<\/a>
How to use them together?<\/a>
Getting Started<\/a><\/strong><\/p><\/blockquote>\n\n\n\n
\n\n\n\nWhat does CloudWatch do?<\/h2>\n\n\n\n
CloudWatch is concerned with the ‘what?’<\/strong><\/p>\n\n\n\n
- Is CPU usage high?<\/li>
- Is disk space low?<\/li>
- Have billing limits been exceeded?<\/li><\/ul>\n\n\n\n
CloudWatch needs to be turned on and configured but can be used with not only AWS Services, but with custom logs as well.<\/p>\n\n\n\n
\n\n\n\nWhen to use CloudWatch<\/h2>\n\n\n\n
CloudWatch allows us to see ‘what’<\/strong> is happening in real time.<\/p>\n\n\n\n
- CloudWatch Logs:<\/strong> log data from AWS services – CPU utilisation.<\/li>
- CloudWatch Metrics:<\/strong> capture variables to monitor – CPU utilisation over time.<\/li>
- CloudWatch Events:<\/strong> trigger an event based on a condition – every hour take a snapshot of a server.<\/li>
- CloudWatch Alarms:<\/strong> triggers notifications based on metrics when a defined threshold is breached.<\/li>
- CloudWatch Dashboards:<\/strong> create visualisations based on metrics.<\/li><\/ul>\n\n\n\n
Some of the services you can watch are:<\/p>\n\n\n\n
- Load Balancers<\/li>
- Auto-Scaling Groups<\/li>
- EC2 instances<\/a><\/li>
- SQS queues<\/a><\/li>
- SNS topics<\/a><\/li>
- Databases<\/a><\/li>
- Objects in S3<\/a><\/li><\/ul>\n\n\n\n
\n\n\n\nWhat does CloudTrail do?<\/h2>\n\n\n\n
CloudTrail is concerned with the ‘who?’<\/strong><\/p>\n\n\n\n
- Who made the API call?<\/li>
- Which IP address has done something?<\/li>
- How did a user access<\/a> a bucket?<\/li><\/ul>\n\n\n\n
This is turned on by default and sends logs to an S3 bucket<\/a> for further analysis.<\/p>\n\n\n\n
\n\n\n\nWhen to use CloudTrail<\/h2>\n\n\n\n
CloudTrail can help with auditing and allows us to start with the problem, and track back to where the problem began.<\/p>\n\n\n\n
Its timestamps and record of ‘who’<\/strong> lets us follow the trail<\/strong> to find the cause of any problems.<\/p>\n\n\n\n
\n\n\n\nHow to use them together?<\/h2>\n\n\n\n
Like so many other AWS Services<\/a>, we can use CloudWatch and CloudTrail together.<\/p>\n\n\n\n