Ilhaan plays around with Terraform. Followed getting started guide here.
Instructions below are outdated. Update coming soon!
This repo can be used to spin up an EC2 instance that only allows SSH inbound connections via port 22 and all outbound connections.
This repo assumes that AWS configuration and credential files are managed by awscli
based on this.
Once your AWS credentials are set up, follow the instructions below:
- Clone this repo and
cd
into theec2_instance
directory. Createterraform.tfvars
in this directory and add the following line:
keypair_name="<keypair-name-without-extension>"
The keypair above can be stored in ~/.ssh/
.
- Run
terraform apply
to deploy instance - Once the instance is deployed, the instance's public DNS will be output to the terminal, which can be used to gain SSH access to the instance.
- To spin down the instance, run
terraform destroy