A Terraform solution for provisioning an AWS EC2 instance running Ubuntu for load testing.
- Guide: Follow the official Terraform Installation instructions.
- Verification: Run
terraform -v
to confirm installation.
- Installation: Install the AWS CLI by following the AWS CLI User Guide.
- Configuration: Execute the following command and provide your credentials:
aws configure AWS Access Key ID: [Your IAM Access Key] AWS Secret Access Key: [Your IAM Secret Key] Default region name: eu-west-3 Default output format: json
aws ec2 create-key-pair --key-name load_testing_keypair --query "KeyMaterial" --output text > "$(pwd)/load_testing_keypair.pem"
chmod 400 ./load_testing_keypair.pem
Export the required variables in your shell to configure the deployment:
export TF_VAR_development_repo_url="https://oauth2:$GITLAB_IRSN_TOKEN@gitlab.extra.irsn.fr/webteleray/development.git"
export TF_VAR_rclone_config_repo_url="https://oauth2:$GITLAB_IRSN_TOKEN@gitlab.extra.irsn.fr/webteleray/deployment/teleray-staging.git"
export TF_VAR_sops_age_key=$(grep '^AGE-SECRET-KEY-' "$DEVELOPMENT_DIR/age/keys.txt")
export TF_VAR_admin_jwt_access_token="your-jwt-token"
Initialize and apply the Terraform configuration:
terraform init && terraform plan && terraform apply --auto-approve
Important
Check the public IP with: terraform output instance_ip
- SSH Access: Connect to the instance using:
ssh -i ./load_testing_keypair.pem ubuntu@<PUBLIC_IP>
- Check Logs:
- Setup Script: View the provisioning logs:
sudo cat /var/log/setup_script.log
- Docker Container: List running containers and inspect logs:
sudo docker ps sudo docker logs <CONTAINER_ID>
- Setup Script: View the provisioning logs:
Remove all provisioned resources when testing is complete:
terraform destroy --auto-approve
Copyright (c) 2017-20xx Kalisio
Licensed under the MIT license.
This project is sponsored by