Giter Club home page Giter Club logo

aws-ctrail-s3-cwatch-demo's Introduction

aws-ctrail-s3-cwatch-demo 🐳

Stars Issues Forks Report an issue

reference

docsamazon

AWS CloudTrail

  1. BEFORE CREATE

  • can see info in Event history (NOT in Trails)

screenshot info: DeleteLogGroup ctrail

  1. CREATE

  • choose S3 & CWatch create1
  • after created create2

AWS S3

  • access into AWSLogs/<AWS_ACCID!!!>/CloudTrail/us-east-1/2022/02/21/ & download json file s3

NOTE :

  1. Luôn có độ trễ giữa sự kiện (events) xảy ra so với hiển thị trên bảng điều khiển CloudTrail
  2. Được gửi cứ sau 5 phút (hoạt động) vs với độ trễ tối đa 15 phút

AWS CloudWatch

screenshot info: DeleteLogGroup => /aws/codebuild cwatch_s3

AWS CLI

  1. list

aws cloudtrail describe-trails
=>
{
    "trailList": [
        {
            "Name": "DTQCTrailDemo",
            "S3BucketName": "aws-dtq-cloudtrail-logs-<AWS_ACCID!!!>-e5c21b44",
            "IncludeGlobalServiceEvents": true,
            "IsMultiRegionTrail": true,
            "HomeRegion": "us-east-1",
            "TrailARN": ...
        }
    ]
}
  1. validate logs

aws cloudtrail validate-logs --trail-arn arn:aws:cloudtrail:us-east-1:<AWS_ACCID!!!>:trail/DTQCTrailDemo --start-time 2022-02-21T06:09:00Z --verbose
=>
Validating log files for trail arn:aws:cloudtrail:us-east-1:<AWS_ACCID!!!>:trail/DTQCTrailDemo between 2022-02-21T06:09:00Z and 2022-02-21T07:51:54Z
Digest file     s3://aws-dtq-cloudtrail-logs-<AWS_ACCID!!!>-e5c21b44/AWSLogs/<AWS_ACCID!!!>/CloudTrail-Digest/us-east-1/2022/02/21/<AWS_ACCID!!!>_CloudTrail-Digest_us-east-1_DTQCTrailDemo_us-east-1_20220221T065548Z.json.gz        valid
1/1 digest files valid
  • same with result in s3: AWSLogs/<AWS_ACCID!!!>/CloudTrail-Digest/us-east-1/2022/02/21/ s3_digest
  1. start logging (after deleted trail by AWS CLI)

aws cloudtrail create-trail --name DTQCTrailDemo --s3-bucket-name <BUCKET MUST EXIST!!!> --is-multi-region-trail --enable-log-file-validation
=>     
{
    "Name": "DTQCTrailDemo",
    "S3BucketName": ...
}
aws cloudtrail start-logging --name DTQCTrailDemo
aws cloudtrail get-trail-status --name DTQCTrailDemo
=>     
{
    "IsLogging": true,
    "StartLoggingTime": "2022-02-21T17:12:30.511000+09:00",
    "LatestDeliveryAttemptTime": "",
    "LatestNotificationAttemptTime": "",
    "LatestNotificationAttemptSucceeded": "",
    "LatestDeliveryAttemptSucceeded": "",
    "TimeLoggingStarted": "2022-02-21T08:12:30Z",
    "TimeLoggingStopped": ""
}
  1. stop logging (after created trail by AWS console)

aws cloudtrail get-trail-status --name DTQCTrailDemo
=>     
{
    "IsLogging": true,
    "LatestDeliveryTime": "2022-02-21T16:56:00.818000+09:00",
    "StartLoggingTime": "2022-02-21T15:55:48.373000+09:00",
    "LatestCloudWatchLogsDeliveryTime": "2022-02-21T16:57:40.916000+09:00",
    "LatestDigestDeliveryTime": "2022-02-21T16:45:24.875000+09:00",
    "LatestDeliveryAttemptTime": "2022-02-21T07:56:00Z",
    ...
}
aws cloudtrail stop-logging --name DTQCTrailDemo
aws cloudtrail get-trail-status --name DTQCTrailDemo
=>     
{
    "IsLogging": false,
    "LatestDeliveryTime": "2022-02-21T16:56:00.818000+09:00",
    "StartLoggingTime": "2022-02-21T15:55:48.373000+09:00",
    "StopLoggingTime": "2022-02-21T16:59:24.934000+09:00",
    "LatestCloudWatchLogsDeliveryTime": "2022-02-21T16:57:40.916000+09:00",
    "LatestDigestDeliveryTime": "2022-02-21T16:45:24.875000+09:00",
    "LatestDeliveryAttemptTime": "2022-02-21T07:56:00Z",
    ...
}

delete AWS resources

./del_aws_resource.sh

terraform

terraform$ terraform init && terraform apply -auto-approve
=> Apply complete! Resources: 3 added, 0 changed, 0 destroyed.
terraform destroy -auto-approve
=> Plan: 0 to add, 0 to change, 3 to destroy.

terraform

aws-ctrail-s3-cwatch-demo's People

Contributors

tquangdo avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.