Standard Operating Procedure (SOP): Installation of ELK Stack with Filebeat on AWS Servers
1. Purpose
This SOP outlines the step-by-step process for installing and configuring the ELK (Elasticsearch, Logstash, and Kibana) stack with Filebeat on AWS servers. The document includes prerequisites, system requirements, cluster setup, and AWS-specific configurations.
2. Prerequisites
- AWS Account: Access to an active AWS account with appropriate IAM permissions.
-
Networking:
- VPC created for deployment.
- Subnets for public/private resources.
- Security groups with the required ports opened (refer to the Ports section).
-
System Access:
- SSH key pair for accessing EC2 instances.
- Admin/root privileges on servers.
-
Software Tools:
- AWS CLI installed and configured locally.
- Terraform/CloudFormation (optional for automation).
- Remote terminal such as PuTTY or a compatible SSH client.
3. System Requirements
Compute Requirements
Component | Instance Type | Minimum vCPU | Minimum Memory |
---|---|---|---|
Elasticsearch | t3.medium or higher | 2 | 8 GB |
Logstash | t3.medium or higher | 2 | 4 GB |
Kibana | t3.small or higher | 1 | 2 GB |
Filebeat Agents | t2.micro or higher | 1 | 1 GB |
Storage Requirements
Component | Disk Type | Minimum Storage |
---|---|---|
Elasticsearch | SSD (gp3) | 50 GB |
Logstash | SSD (gp3) | 10 GB |
Kibana | General HDD | 10 GB |
Ports to Open
Service | Protocol | Port |
---|---|---|
Elasticsearch | HTTP/HTTPS | 9200 |
Kibana | HTTP | 5601 |
Logstash | TCP/UDP | 5044 |
Filebeat | Outbound HTTP | 9200 |
4. Cluster Creation
AWS Perspective
-
VPC Setup:
- Create a VPC and enable DNS hostnames.
- Set up two subnets (public and private) for different components.
- Create an Internet Gateway (IGW) and attach it to the VPC.
-
Security Groups:
- Allow inbound traffic for required ports in the security group associated with EC2 instances.
- Restrict access to trusted IP ranges for Kibana and Elasticsearch.
-
EC2 Instances:
- Launch EC2 instances for Elasticsearch, Logstash, Kibana, and Filebeat.
- Use Amazon Linux 2 or Ubuntu 20.04 for compatibility.
- Allocate Elastic IPs for external access if required.
-
IAM Role:
- Attach an IAM role with S3 and CloudWatch permissions for backup and monitoring.
Landing Zone Perspective
- Use AWS Landing Zone (if applicable) to standardize account setup and ensure governance.
- Configure logging and monitoring through AWS CloudTrail and AWS CloudWatch.
- Ensure tagging standards are applied for resource identification.
5. Installation Steps
Elasticsearch
- Install Elasticsearch:
sudo apt update
wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -
sudo apt install apt-transport-https
echo "deb https://artifacts.elastic.co/packages/7.x/apt stable main" | sudo tee -a /etc/apt/sources.list.d/elastic-7.x.list
sudo apt update && sudo apt install elasticsearch
-
Configure Elasticsearch:
- Update
/etc/elasticsearch/elasticsearch.yml
with the following:
network.host: 0.0.0.0 cluster.name: elk-cluster
- Update
-
Restart the service:
sudo systemctl enable elasticsearch sudo systemctl start elasticsearch
Logstash
- Install Logstash:
sudo apt install logstash
-
Configure Logstash:
- Create a configuration file at
/etc/logstash/conf.d/logstash.conf
:
input { beats { port => 5044 } } output { elasticsearch { hosts => ["http://
:9200"] index => "logs-%{+YYYY.MM.dd}" } } - Create a configuration file at
-
Start the service:
sudo systemctl enable logstash sudo systemctl start logstash
Kibana
- Install Kibana:
sudo apt install kibana
-
Configure Kibana:
- Update
/etc/kibana/kibana.yml
:
server.host: "0.0.0.0" elasticsearch.hosts: ["http://
:9200" ] - Update
-
Restart the service:
sudo systemctl enable kibana sudo systemctl start kibana
Filebeat
- Install Filebeat:
sudo apt install filebeat
-
Configure Filebeat:
- Update
/etc/filebeat/filebeat.yml
:
filebeat.inputs: - type: log paths: - /var/log/*.log output.logstash: hosts: ["
:5044" ] - Update
-
Start Filebeat:
sudo systemctl enable filebeat sudo systemctl start filebeat
6. Post-Installation Verification
-
Elasticsearch:
- Verify connectivity:
curl http://
:9200 -
Logstash:
- Check for log ingestion in Elasticsearch.
-
Kibana:
- Access the Kibana UI at
http://
and configure an index pattern.:5601
- Access the Kibana UI at
-
Filebeat:
- Confirm logs are being sent to Logstash and indexed in Elasticsearch.
7. Maintenance and Monitoring
-
Backup:
- Configure snapshot backups to an S3 bucket.
-
Monitoring:
- Use Elastic Stack’s monitoring features or integrate with AWS CloudWatch.
-
Scaling:
- Use AWS Auto Scaling Groups for horizontal scaling of Elasticsearch nodes.
8. Troubleshooting
-
Logs:
- Check service logs for Elasticsearch (
/var/log/elasticsearch
), Logstash (/var/log/logstash
), and Kibana (/var/log/kibana
).
- Check service logs for Elasticsearch (
-
Network Issues:
- Verify VPC routing tables and security group configurations.
-
Resource Bottlenecks:
- Monitor instance metrics and upgrade instance types or increase storage as needed.
This SOP ensures a standardized deployment of the ELK stack with Filebeat on AWS, facilitating efficient log management and monitoring.