Note: This blog is for you to make your life easier.
Don't make your life complicated, just enjoy the blog. ^_^
Please pardon my simplicity of my own blog and look for the content.
To make it more easier for you just click one photos, follow then scroll. ⏩
Enjoy reading! ^_^
Configure the Older CloudWatch Logs Agent on a Running EC2 Linux Instance
You can use the CloudWatch Logs agent installer on an existing EC2 instance to install and configure the CloudWatch Logs agent. After installation is complete, logs automatically flow from the instance to the log stream you create while installing the agent. The agent confirms that it has started and it stays running until you disable it.
Step 1: Configure Your IAM Role or User for CloudWatch Logs
From IAM choose roles by selecting the role name then attach policies and create policy. New browser will open then choose the JSON tab and type the following to JSON policy document.
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"logs:CreateLogGroup",
"logs:CreateLogStream",
"logs:PutLogEvents",
"logs:DescribeLogStreams"
],
"Resource": [
"*"
]
}
]
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"logs:CreateLogGroup",
"logs:CreateLogStream",
"logs:PutLogEvents",
"logs:DescribeLogStreams"
],
"Resource": [
"*"
]
}
]
Then review policy, from the review policy page type Name and a Description.
Now, Create policy. After that close the summary and create policy. Now, close the browser and return to add permission page for your role then refresh and attach policy.
Creating a Role
In IAM from the left side panel select role tab then create new role.
From creating role window select AWS services and select EC2 and click permission.
From permission, select the policy you created then click tag.
From tag window, give a tag for the role.
Then review and put a name to your role.
You should now be able to see your role you created.
Attach IAM Role to a Instances
Attach the IAM role then add the details by selecting the role you created.
Step 2: Install and Configure CloudWatch Logs on an Existing Amazon EC2 Instance
The process for installing the CloudWatch Logs agent differs depending on whether your Amazon EC2 instance is running Amazon Linux, Ubuntu, CentOS, or Red Hat. Use the steps appropriate for the version of Linux on your instance.
Install the CloudWatch Agent and log-in to instances. Use your public IP address and putty to log to your Instances.
And type the commands:
Update Instances: sudo yum update -y
Install AWS Logs: sudo yum install -y awslogs
Start AWS Log Services: sudo systemctl start awslogsd
Check the Logservicese Status: sudo systemctl status awslogsd.service
Enable the Logservicese at each boot: sudo systemctl enable awslogsd.service
After that, check the CloudWatch Logs.
Go to CloudWatch then Management & Governance select CloudWatch, click logs & view it.
Lastly, click on the Path(/var/log/messages)
You should now see all the log file.
Problems Encountered:
None
Realisation:
The unified CloudWatch agent enables you to collect both logs and advanced metrics with one agent. It offers support across operating systems, including servers running Windows Server. This agent also provides better performance.
References:
AWS Site













No comments:
Post a Comment