☁️
CTHFM: AWS
  • Welcome
  • Getting Started
    • Account Setup
  • AWS CLI
    • AWS CLI Overview
    • Installation
  • AWS Fundamentals
    • AWS Documentation
    • AWS Shared Responsibility Model
    • Organizational Hierarchy
    • AWS Principals
    • IAM Fundamentals
      • IAM Policy Components
      • IAM Documentation References
    • AWS Security Services Overview
    • AWS Core Services
    • AWS Frameworks
    • Regions and Availability Zones
  • SQL
    • SQL Refresher for Threat Hunting
  • Logging Reference
    • Cloudtrail
      • What is Cloudtrail?
      • Setting Up Cloudtrail
      • Cloudtrail Events Structure
      • Filtering and Searching CloudTrail Logs
      • IAM ID Prefixes
      • Additional Resources
      • API References
    • VPCFlow Logs
    • GuardDuty
      • Multi-Account Setup
      • GuardDuty Concepts
      • GuardDuty Finding References
      • S3 Protection
      • Malware Protection
        • EC2 Malware Protection
          • EC2 Protection Resources
          • Monitoring Scans
          • EC2 Malware Protection Events: CloudWatch
        • S3 Malware Protection
          • Enabling S3 Malware Protection
          • After Enabling S3 Malware Protection
          • S3 Malware Resource Plan Status
          • S3 Malware Protection Quotas
      • RDS Protection Enablement
      • Lambda Protection Enablement
      • Trusted IP Lists and Threat Lists in Amazon GuardDuty
      • Remediation Recommendations
      • GuardDuty API Reference
      • GuardDuty Quotas
    • Access Analyzer
      • Setup
      • External Access and Unused Access Analyzer Findings
      • Review Findings
      • Access Analyzer Resources
      • Access Analyzer API Reference
    • AWS Network Firewall
      • Permissions
      • Firewall Log Contents
      • Logging Destinations
      • CloudWatch Firewall Metrics
    • AWS Config
      • Resource Management in AWS Config
      • AWS Config Integrations
      • AWS Config Resources
      • Configuration Item
      • Config Rules
        • Evaluation Modes
  • CloudWatch
    • Amazon CloudWatch
      • CloudWatch Concepts
      • CloudWatch Metrics
        • Filter Pattern Syntax
      • CloudWatch Alarms
        • Alarm Recommendations
      • Subscriptions
      • CloudWatch Agent
      • CloudWatch Insights
        • Supported Logs and Discovered Fields
        • CloudWatch Insights Query Syntax
      • Anomaly Detection
        • Create Anomaly Detector
        • Alarms for Anomaly Detections
      • CloudWatch Filter Syntax
      • CloudWatch Service Quota
  • Athena For Threat Hunting
    • Introduction to Athena
    • Setting Up Athena
    • SQL For Threat Hunters
    • Automated Response
    • Query Best Practices
  • AWS Security Research and Resources
    • AWS Security Blog
    • AWS Goat
    • Cloud Goat
    • Pacu
    • Prowler
    • Scout Suite
  • Threat Hunting in AWS
    • Threat Hunting in AWS
    • Threat Hunting Introduction
    • Threat Hunting Process
      • Hypothesis Generation
      • Investigation
      • Identification
      • Resolution & Follow Up
    • Pyramid of Pain
    • MITRE Att&ck
      • MITRE Att&ck Concepts
      • MITRE Att&CK Data Sources
      • MITRE Att&CK Mitigations
    • MITRE Att&ck: AWS
      • MITRE Att&CK Matrix
      • Amazon Web Services Security Control Mappings
    • AWS Threat Hunting Ideas
      • AWS Threat Hunting Ideas: EC2
      • AWS Threat Hunting Ideas: Lambda
      • AWS Threat Hunting Ideas: SQS
      • AWS Threat Hunting Ideas: SNS
      • AWS Threat Hunting Ideas: RDS
Powered by GitBook
On this page
  • Overview
  • Step 1: Enabling CloudTrail in Your AWS Environment
  • Step 2: Configuring Advanced Settings
  • Step 3: Verifying Your CloudTrail Configuration
  • Step 4: Managing and Monitoring CloudTrail
  • Best Practices for Setting Up CloudTrail
  1. Logging Reference
  2. Cloudtrail

Setting Up Cloudtrail

Overview

Setting up AWS CloudTrail is a fundamental step in ensuring the security and compliance of your AWS environment. This lesson will guide you through the process of configuring CloudTrail, from enabling trails to integrating with other AWS services. By the end of this lesson, you’ll be able to create and manage CloudTrail trails effectively, ensuring that you capture and store crucial event data for monitoring and auditing purposes.

Step 1: Enabling CloudTrail in Your AWS Environment

  1. Accessing the CloudTrail Console:

    • Navigate to the AWS Management Console.

    • In the services menu, search for and select "CloudTrail."

  2. Creating a New Trail:

    • Click on “Create trail” in the CloudTrail console.

    • Trail Name: Provide a unique name for your trail. This name will help you identify the trail in your account.

    • Apply trail to all regions: Choose whether you want to apply the trail to all regions. For most use cases, especially for security monitoring and compliance, it's recommended to enable multi-region trails to ensure comprehensive coverage of your AWS account activity.

  3. Choosing the Type of Events to Log:

    • Management Events:

      • These include API activities that create, modify, or delete AWS resources.

      • Enable management events if you want to track activities like launching instances, modifying security groups, or changing IAM policies.

    • Data Events:

      • These include operations on the data itself, such as S3 object-level activities (e.g., GetObject, PutObject).

      • Enable data events if you need detailed logging of specific resource activities. Keep in mind that logging data events can generate a large volume of logs, so consider enabling them only for critical resources.

  4. Specifying Log Storage Location:

    • Create a New S3 Bucket: If you don’t have an existing S3 bucket for CloudTrail logs, you can create a new one during the trail setup. The S3 bucket will store your CloudTrail log files.

    • Specify S3 Bucket Settings:

      • Bucket Name: Enter a unique name for the S3 bucket.

      • Log File Prefix: Optionally, specify a prefix for the log files. This prefix can help organize logs, especially when you have multiple trails or other logs stored in the same bucket.

  5. Enabling Log File Encryption:

    • For enhanced security, you can encrypt the log files using AWS Key Management Service (KMS).

    • Choose a KMS Key: You can use an existing KMS key or create a new one specifically for CloudTrail log file encryption.

  6. Enabling Log File Validation:

    • Log file validation ensures that your log files are not tampered with. CloudTrail creates a digest file for each log file, which you can use to verify the integrity of your logs.

    • Enable this option if you require assurance that your logs remain unaltered.

  7. Sending Notifications to CloudWatch Logs:

    • Enable CloudWatch Logs: If you want to monitor and trigger alarms based on CloudTrail events, enable integration with CloudWatch Logs.

    • Create or Select a CloudWatch Log Group: Specify the log group where CloudTrail will send log data.

    • IAM Role for CloudWatch: Create or select an IAM role that allows CloudTrail to send logs to CloudWatch. This role needs to have the necessary permissions for CloudWatch Logs.

Step 2: Configuring Advanced Settings

  1. Global Service Events:

    • Enable Global Service Events: By default, CloudTrail logs global service events (e.g., IAM, AWS STS) for your AWS account. These events are critical for security and compliance, as they include actions that can affect resources across all regions.

  2. API Activity Read/Write Events:

    • Read Events: Log events where resources are read (e.g., DescribeInstances in EC2). Enable this if you want to monitor read-only actions.

    • Write Events: Log events where resources are modified (e.g., CreateBucket in S3). Enable this to monitor changes to your resources.

  3. SNS Notifications:

    • If you want to receive notifications when new log files are delivered, enable Amazon SNS notifications.

    • Create or Select an SNS Topic: Specify the SNS topic that will receive notifications. You can use these notifications to trigger additional workflows or alerting mechanisms.

Step 3: Verifying Your CloudTrail Configuration

  1. View the Trail Summary:

    • After creating the trail, review the summary to ensure that all settings are correct.

    • Verify that the trail is enabled and that it applies to all regions if you selected that option.

  2. Testing the Trail:

    • Perform some actions in your AWS account (e.g., creating or modifying a resource).

    • Check the S3 bucket or CloudWatch Logs to verify that CloudTrail is capturing and logging the events as expected.

  3. Reviewing Logs in S3:

    • Navigate to the S3 bucket specified during setup.

    • Open the logs to review the captured events. Ensure that the logs are in the expected format and contain the correct data.

Step 4: Managing and Monitoring CloudTrail

  1. Editing an Existing Trail:

    • You can modify trail settings at any time from the CloudTrail console. This includes changing the S3 bucket, enabling/disabling data events, or adjusting the regions covered by the trail.

  2. Monitoring CloudTrail with CloudWatch:

    • Set up CloudWatch Alarms based on specific events captured by CloudTrail. For example, you might want to be alerted when a root user logs in or when security group rules are modified.

    • Use CloudWatch Dashboards to visualize trends and patterns in API activity.

  3. Automating Responses with AWS Lambda:

    • Integrate CloudTrail with AWS Lambda to automatically respond to specific events. For instance, you can automatically revoke access if an unauthorized API call is detected.

Best Practices for Setting Up CloudTrail

  • Enable Multi-Region Trails: Ensure you capture events from all regions to avoid blind spots in your security monitoring.

  • Use Log File Encryption and Validation: Protect your logs from tampering and unauthorized access by enabling encryption and validation.

  • Monitor Critical Events: Focus on logging and monitoring critical actions, such as changes to IAM roles or security group rules.

  • Limit Access to CloudTrail Logs: Secure the S3 bucket where logs are stored with strict IAM policies and bucket permissions.

  • Review and Adjust Trails Regularly: Periodically review your CloudTrail settings to ensure they meet your current security and compliance needs.

PreviousWhat is Cloudtrail?NextCloudtrail Events Structure

Last updated 8 months ago