commit | e637da83452eb15297c95d9ee51e711290b140a7 | [log] [tgz] |
---|---|---|
author | Rahul Bajaj <rahulrb0509@gmail.com> | Mon Aug 07 22:58:32 2023 -0400 |
committer | GitHub <noreply@github.com> | Tue Aug 08 10:58:32 2023 +0800 |
tree | 765abcf0450ce5a3b5c9f1b82215e9e5636c2d19 | |
parent | 30c3573d0e3760547a8dde325550e738f9d8815a [diff] |
Add SkyWalking on AWS Terraform Documentation (#20)
This repository contains the Terraform scripts to create the infrastructure for SkyWalking on cloud vendors, and the Ansible playbooks to install SkyWalking on the created infrastructure, or on the existing infrastructure, no matter on-premises or on cloud vendors, such as AWS.
For now, we have supported the following cloud vendors, and we welcome everyone to contribute supports for more cloud vendors:
AWS_ACCESS_KEY_ID
and AWS_SECRET_ACCESS_KEY
).Before applying any Terraform script, initialize your Terraform working directory:
cd aws/ terraform init
The script is designed with modularity and reusability in mind. Various parameters like region, instance count, instance type, etc., are exposed as variables for easier customization.
Variable Name | Description | Default Value |
---|---|---|
oap_instance_count | Number of SkyWalking OAP instances | 1 |
ui_instance_count | Number of SkyWalking UI instances | 1 |
region | AWS region where resources will be provisioned | us-east-1 |
instance_type | AWS instance type for SkyWalking OAP and UI | t2.medium |
public_key_path | Path where the SSH key for instances will be stored | ~/.ssh |
extra_tags | Additional tags that can be applied to all resources | {} |
To modify the default values, you can create a terraform.tfvars
file in the same directory as your Terraform script:
oap_instance_count = 2 ui_instance_count = 2 region = "us-west-1" instance_type = "t2.large" public_key_path = "/path/to/your/desired/location" extra_tags = { "Environment" = "Production" }
After adjusting your configuration, test and apply the script:
terraform plan
terraform apply
Once the resources are created:
oap-server
and ui-server
respectively) under the ansible/inventory/
directory, relative to the module's path.ssh -i /path/to/skywalking.pem ec2-user@<INSTANCE_PUBLIC_IP>
ssh-access
: Allows SSH access from any IP (0.0.0.0/0
). Please note that this is potentially insecure and you should restrict the IP range wherever possible.public-egress-access
: Allows egress access to the internet for the instances.To destroy the resources when they are no longer needed:
terraform destroy
This command will prompt you to confirm before destroying the resources.
SSH access is open to the entire internet (0.0.0.0/0
). This is not recommended for production environments. Always restrict the CIDR block to known IP ranges for better security.
You can use the Ansible playbook in combination with the Terraform to create necessary infrastructure and install SkyWalking on the created infrastructure, or you can use the Ansible to install SkyWalking on the existing infrastructure.
This guide provides steps on using Ansible to install Apache SkyWalking on AWS instances.
Save the SSH key file path generated by Terraform to a variable for future use:
cd ansible SSH_KEY_FILE=$(terraform -chdir=../aws output -raw ssh-user-key-file) echo $SSH_KEY_FILE
Expected Output:
You should see a file path similar to: /Users/kezhenxu94/.ssh/skywalking.pem
Before installing SkyWalking, ensure that you can connect to the EC2 instances:
ANSIBLE_HOST_KEY_CHECKING=False ansible -m ping all -u ec2-user --private-key "$SSH_KEY_FILE"
Expected Output:
You should see output for each IP with a SUCCESS
status:
<ip1> | SUCCESS => { "ansible_facts": { "discovered_interpreter_python": "/usr/bin/python3" }, "changed": false, "ping": "pong" } <ip2> | SUCCESS => { "ansible_facts": { "discovered_interpreter_python": "/usr/bin/python3" }, "changed": false, "ping": "pong" }
After confirming connectivity, proceed to install Apache SkyWalking using the Ansible playbook:
ANSIBLE_HOST_KEY_CHECKING=False ansible-playbook -u ec2-user --private-key "$SSH_KEY_FILE" playbooks/install-skywalking.yml