Lecture 256: AWS CloudTrail
- 课程:[NEW] AWS Certified Advanced Networking Specialty 2026
- 视频时长:05:30
- 来源:Udemy Lecture 33789974
- Slide 数量:5
- 画面切换:00:40、01:45、02:24、03:39
扫描说明
逐条读取了 Transcript 面板中的 131 条英文 cue,并按播放器进度同步全长约 5:30 的视频。依据 Management Service Boundary、Event History、Regional/Global Scope、Trail Destination/Analytics 与 Event Anatomy/Security Operations 划分为 5 个小节。5 张截图来自真实课程 Slide,统一为 1364×770。讲义纠正了两个常见简化:Event History 默认保留的是近 90 天 Management Events,而非所有 Event;CloudTrail 交付到 S3 的记录是压缩 JSON,不要求先转成 CSV 才能用 Athena 查询。
Transcript 来自 Udemy 页面自带的英文自动字幕,没有使用 ASR。下面保留页面原文,包括其中的语法或识别错误。
1. CloudFormation 负责 Build,Config 负责 State/Compliance,CloudTrail 负责 API/Event Audit
时间范围:00:00–00:40
总结 / Summary
中文
管理服务按问题拆分:CloudFormation/Service Catalog 创建受控 Infrastructure;AWS Config 记录 Resource Configuration 与 Compliance;AWS CloudTrail 记录 AWS Account/Organization 中受支持的 API Activity 与 Service Event。CloudTrail 回答 Who、When、Where、What action、Against which resource,以及 Success/Error。它是 Control-plane Forensics 的基础,但不记录 Network Packet/Flow;Traffic Analysis 仍需 VPC Flow Logs、ELB Logs、DNS Logs 等数据源。
English
Management services answer different questions: CloudFormation and Service Catalog build governed infrastructure, AWS Config records resource configuration and compliance, and AWS CloudTrail records supported API activity and service events in an AWS account or organization. CloudTrail answers who, when, where, what action, against which resource, and whether it succeeded or failed. It is foundational for control-plane forensics, but it does not record network packets or flows; traffic analysis still requires VPC Flow Logs, load-balancer logs, DNS logs, and similar sources.
Transcript
00:00 Hello and welcome to this lecture,
00:02 AWS CloudTrail.
00:03 So I know sometimes these services could be confusing
00:07 and you might not able to clearly tell
00:09 what service does what.
00:10 But understand that AWS CloudFormation is a service
00:15 which helps you create the infrastructure
00:17 in automated manner.
00:19 Then AWS Service Catalog, it's just a wrapper over that.
00:23 And then AWS Config is the service
00:25 which helps you track the changes
00:27 which happens to your resources over the time.
00:30 And how Config does it?
00:32 It basically gets the data
00:34 from lot of internal AWS Services,
00:37 and AWS Cloud release one of those service.
2. Event History 默认提供近 90 天 Management Event;长期留存需 Trail 或 Event Data Store
时间范围:00:40–01:45
总结 / Summary
中文
CloudTrail Event History 无需先创建 Trail,即可按 Region 查看近 90 天的 Management Events,例如 Console、CLI、SDK 或 AWS Service 发起的 CreateVpc、ModifyRoute、AuthorizeSecurityGroupIngress、TerminateInstances。这里不能简化为“所有 API Call”:S3 Object-level、Lambda Invocation 等 Data Event 通常需要在 Event Selector 中显式启用,覆盖范围与费用不同。需要长期、集中或可查询留存时,创建 Trail 交付至 S3/CloudWatch Logs,或使用 CloudTrail Lake Event Data Store。
English
CloudTrail Event History works without first creating a trail and provides the last 90 days of regional management events, such as CreateVpc, ModifyRoute, AuthorizeSecurityGroupIngress, or TerminateInstances initiated through the console, CLI, SDK, or an AWS service. Do not simplify this to every API call: data events such as S3 object access or Lambda invocation generally require explicit event selectors and have different coverage and cost. For long-term, centralized, or queryable retention, create a trail that delivers to S3 or CloudWatch Logs, or use a CloudTrail Lake event data store.
Transcript
00:40 So what is CloudTrail?
00:41 It provides audit for your AWS Account activities
00:45 by logging in all API calls.
00:47 And it is enabled by default.
00:50 Now, this is advisable as well
00:51 that you should have CloudTrail enabled
00:54 so that you can audit your account.
00:57 If something happens to your account,
00:59 maybe someone terminate some machines
01:01 or someone is trying to get hold of your resources,
01:05 then you can go to the CloudTrail and see what's happening.
01:10 Now you can get also the history of API calls
01:13 made within your AWS Account.
01:15 So these API calls could be made through console,
01:18 or SDK, or CLI, or from another AWS Service.
01:22 All these events are kept in AWS CloudTrail
01:26 for 90 days by default.
01:28 And then you can persist those further
01:30 into the CloudWatch or S3.
01:33 Now, if resource is deleted in AWS,
01:35 look at the CloudTrail.
01:36 That's the message, basically.
01:38 That's the single source of truth
01:39 for you to find out what happened,
01:42 when it happened,
01:43 and who did that?
3. Trail 可覆盖单 Region 或所有 Region,并纳入 Global Service Event
时间范围:01:45–02:24
总结 / Summary
中文
Trail 是 Event Delivery Configuration,不是 Event 本身。Multi-region Trail 自动把所有已启用 Region 的 Event 送往同一 Destination,并可包含 IAM、STS 等 Global Service Event;组织环境优先使用 Organization Trail 统一覆盖成员账号。Event History 仍按 Region 查看,Global Service Event 的记录/交付有特殊 Region 语义,因此排查 IAM 变更时应确认查询 Region 与 Trail Setting,而不是假设每个 Region 都有一份相同副本。
English
A trail is an event-delivery configuration, not the event itself. A multi-region trail sends events from all enabled regions to one destination and can include global-service events such as IAM or STS activity; organizations can use an organization trail for consistent member-account coverage. Event History remains regional, and global-service events have special regional recording and delivery semantics. When investigating IAM changes, verify the query region and trail settings rather than assuming identical copies exist in every region.
Transcript
01:45 Now, if you followed the AWS Config lecture,
01:49 it also does similar thing,
01:51 but then Config is an abstraction over AWS CloudTrail
01:55 and few other services.
01:57 Now, AWS CloudTrail are regional by default,
02:00 but then you could also enable
02:02 the global-level CloudTrail event
02:04 such that, you know, AWS IAM is a global service.
02:08 It is not per region.
02:09 But then CloudTrail also can log all the API calls
02:12 made to the AWS IAM service.
02:15 And if you want to collect the CloudTrail
02:17 from different regions into a single S3 bucket,
02:20 you can also do that.
02:22 And we'll just see that shortly.
4. Central S3/CloudWatch Logs Pipeline 支撑 Athena、OpenSearch、SIEM 与 Alarm
时间范围:02:24–03:39
总结 / Summary
中文
Central Trail/Organization Trail 可把多 Account/Region Event 交付到安全日志账号的 S3 Bucket,并可选发送到 CloudWatch Logs。S3 中的 CloudTrail Log File 是 GZIP 压缩 JSON;Athena 通过 Schema/Table 直接查询这些 JSON,并不要求 CSV。CloudWatch Logs Metric Filter/Alarm 可检测敏感 API,EventBridge Rule 可近实时触发响应;S3 数据也可进入 OpenSearch 或 SIEM。生产环境应启用 KMS Encryption、Log File Validation、严格 Bucket Policy/Access、Retention 与防篡改控制。
English
A central or organization trail can deliver multi-account and multi-region events to an S3 bucket in a security logging account and optionally to CloudWatch Logs. CloudTrail log files in S3 are GZIP-compressed JSON; Athena queries them through a schema and table without requiring CSV. CloudWatch Logs metric filters and alarms can detect sensitive APIs, while EventBridge rules can trigger near-real-time responses; S3 data can also feed OpenSearch or a SIEM. Production designs should use KMS encryption, log-file validation, strict bucket access, retention, and anti-tampering controls.
Transcript
02:24 So this is how it works.
02:25 You would have AWS Accounts.
02:27 And then inside Account, you use multiple AWS Regions.
02:31 And then you can create CloudTrail Trail.
02:34 Now CloudTrail trail is a sequence of all these events
02:38 which can then persisted into maybe S3
02:41 or maybe in CloudWatch for, you know, long-term archival.
02:45 Now, you can create a trail.
02:47 You can create a trail
02:49 and all that trail can go to a single S3 bucket,
02:51 or it can go to an individual S3 bucket per region.
02:55 Now choice is up to you,
02:56 but the CloudTrail trail can be collected
03:00 into a one single S3 bucket.
03:02 Now, why do we do that?
03:03 Basically, once you have these events in S3 bucket,
03:06 then you can apply some logic
03:09 or you can query that data
03:10 using AWS Athena service, for example.
03:13 Now, Athena is an SQL interface to S3.
03:17 If your data is in CSV format,
03:20 then Athena can query that data.
03:22 And then you can get a deeper insights about your data.
03:25 Similarly, this data can also be sent to elastic search
03:29 or open search,
03:29 and then you can run your searches on top of that data,
03:33 or this can go to a third-party logging tool
03:36 or some SIM system for audit purpose.
5. Event JSON 用 userIdentity、eventTime、eventSource/eventName 与 requestParameters 还原动作
时间范围:03:39–05:30
总结 / Summary
中文
调查时先看 userIdentity(IAM User、AssumedRole、AWS Service 等)、eventTime、eventSource、eventName、awsRegion、sourceIPAddress 与 userAgent,再检查 requestParameters、responseElements、resources、errorCode/errorMessage。网络事件如 CreateVpc、CreateRoute、ReplaceRoute、AttachInternetGateway、AssociateRouteTable、AuthorizeSecurityGroupIngress 都能据此还原 Control-plane 变化。跨账号场景还需查看 recipientAccountId、sessionContext 与 Role Session。CloudTrail 能证明 API Event,不代表请求一定导致预期 Data-plane Effect;应再与 Config Timeline、Flow Logs 和资源状态关联。
English
Start an investigation with userIdentity, including IAM user, assumed role, or AWS service, then eventTime, eventSource, eventName, awsRegion, sourceIPAddress, and userAgent. Continue with requestParameters, responseElements, resources, errorCode, and errorMessage. Network events such as CreateVpc, CreateRoute, ReplaceRoute, AttachInternetGateway, AssociateRouteTable, and AuthorizeSecurityGroupIngress reconstruct control-plane changes. Cross-account cases also require recipientAccountId, sessionContext, and role-session details. CloudTrail proves an API event occurred; it does not prove the intended data-plane effect, so correlate it with Config timelines, flow logs, and current resource state.
Transcript
03:39 And alternatively, if you have an event in CloudWatch,
03:43 you can write a CloudWatch filter,
03:45 which looks at those logs
03:46 and maybe some interesting event you got,
03:49 you can create an alarm on top of that.
03:51 And then you can send an SMS notification
03:54 via SMS or email, whatever you prefer.
03:57 So ultimately you have full control
03:59 because this CloudTrail logs, you get in CloudWatch or S3,
04:03 and then you decide what to do of these logs.
04:06 I have seen cases where maybe customer wants to collect
04:09 all these logs from all accounts at one place
04:12 and then provide access to the audit team
04:14 to look at if they see any suspicious activity
04:17 into their AWS Account.
04:20 So this can be very well done with CloudTrail trails.
04:23 This is a sample event.
04:25 You can see I've masked some of the data.
04:27 But if you see CloudTrail event,
04:29 it shows you who was the user,
04:31 what time this event occurred,
04:34 what action was triggered,
04:36 and then what resource it was triggered on.
04:38 And there are a lot
04:39 of other information data points as well,
04:43 but at bare minimum,
04:44 this is the information you would look for
04:47 and then you can find out what happened at what time.
04:50 So essentially that is a CloudTrail,
04:52 very important service
04:53 with respect to security and audit purpose,
04:57 and all the actions with respect to the networking
04:59 where you are creating the VPCs, or subnets,
05:02 or whatever, right?
05:03 All the actions are captured in AWS CloudTrail.
05:07 So that's it about this lecture.
05:09 I hope you understand well
05:11 the difference between all the management
05:13 and governance services that we talked about
05:14 in this section.
05:16 And we just touched upon all this services
05:18 at a very high level,
05:19 because for AWS Networking Specialty Certification,
05:23 these are not mandatory, but just good to know.
05:26 So that's it for this section.
05:29 Thanks for watching.
整讲总结 / Overall Summary
中文
CloudTrail 的考试主线是 Event History、Trail/Organization Trail、Management vs Data Event、Regional/Global Scope、S3/CloudWatch Logs Destination 与 Event JSON Forensics。看到“谁删除了资源、谁改了 Route/Security Group、调用来自哪里”选 CloudTrail;看到“资源配置如何变化/是否合规”选 Config;看到“包是否到达”则选 Flow Logs 或其他 Data-plane Telemetry。
English
CloudTrail exam priorities are Event History, trails and organization trails, management versus data events, regional and global scope, S3 or CloudWatch Logs destinations, and event JSON forensics. Choose CloudTrail for who deleted a resource, who changed a route or security group, and where the call originated; choose Config for how configuration changed or whether it is compliant; choose flow logs or other data-plane telemetry for whether packets arrived.
返回顶部 ↑