-
Clone this repository:
git clone https://github.com/learntocloud/linux-ctfs cd linux-ctfs/aws -
(Optional) Modify the AWS region by creating a
terraform.tfvarsfile:aws_region = "us-east-1" -
Initialize and apply Terraform:
terraform init terraform apply
Type
yeswhen prompted. -
Note the
public_ip_addressoutput—you'll use this to connect.
-
Connect via SSH:
ssh ctf_user@<public_ip_address>
-
On first login you will be asked if you want to add fingerprints to the known hosts file; type
yesand press Enter. -
When prompted, enter the password:
CTFpassword123!
If you'd like to pause the lab, you can utilize the following commands to start or stop the VM and reduce lab cost:
# power off (stop instance)
terraform apply \
-var ctf_instance_state="stopped" \
-auto-approve
# power on (start instance)
terraform apply \
-var ctf_instance_state="running" \
-auto-approveNote: This module uses an ephemeral public IP. After stopping/starting the instance, public_ip_address may change.
After a restart, check for a new IP.
terraform output public_ip_addressIf you see a “Remote host identification has changed” warning after a restart, remove the old key, then reconnect:
# 1) Remove the old host key for that IP
ssh-keygen -R <public_ip>
# 2) Reconnect and accept the new key
ssh <user>@<public_ip>Destroy the resources when you're done to avoid charges:
terraform destroyType yes when prompted.
- Ensure your AWS CLI is configured with valid credentials
- Check that you're using Terraform v1.9.0 or later
- Verify you have permissions to create EC2, VPC, and Security Group resources
If problems persist, please open an issue in this repository.
This lab uses password authentication for simplicity. In production, use key-based authentication.