Put logs from EC2 to CloudWatch Logs

To Nha Notes | Aug. 6, 2021, 4:51 p.m.

Uploads a batch of log events to the specified log stream.

  • Create log group in CloudWatch
  • Create log stream under created log group
  • Put logs to CloudWatch via aws clid command put-log-events

aws logs put-log-events --log-group-name my-logs --log-stream-name 20150601 --log-events file://events

For more information: https://docs.aws.amazon.com/cli/latest/reference/logs/put-log-events.html