Pyae Phyoe Shein
Pyae Phyoe Shein

Reputation: 13827

Could it be able to install AWS Logs agent in EC2 User data?

I'm curious that it could be possible to install aws logs agent in EC2 User-Data and start its service automatically after that, just like CodeDeployAgent?

Because I've found tons of tutorials showing that to install aws logs agent after setting up EC2 but it's not good practice.

Upvotes: 0

Views: 1235

Answers (1)

WarrenG
WarrenG

Reputation: 1850

Yes, it definitely is. Whatever commands you are running on the ec2 instance to install it you could just include in a bash script to download, install and configure the agent.

The best would probably be to upload your config file to s3, and your userdata fetches your config file.

Alternatively, AWS also has a template and sample scripts for exactly this: https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/Install-CloudWatch-Agent-New-Instances-CloudFormation.html

Upvotes: 1

Related Questions