terraform apply, you need four things in place: an AWS account with credentials, the AWS CLI, Terraform 1.0 or higher, and an SSH key pair created in EC2. This page walks through each one.
All commands in this guide run from inside the
redStack/ directory. Clone the repository first (Step 3 below), then run everything from that directory. This ensures the .pem key file lands in the right place for Terraform to find it.What you need
AWS account
An active AWS account with IAM credentials. A dedicated throwaway account used only for this lab is strongly recommended. See IAM Permissions.
AWS CLI
Version 2.x. Used to create the SSH key pair and verify credentials before Terraform runs.
Terraform >= 1.0
Terraform provisions all AWS infrastructure. Version 1.0 or higher is required (
required_version = ">= 1.0" in main.tf).Your public IP
Used to scope SSH access in security group rules. Find it with
curl -s ifconfig.me.SSH key pair
An RSA key pair created in AWS EC2. Terraform does not create this — you must create it manually before deploying.
Steps
Install AWS CLI
Install the AWS CLI for your platform:
Verify the installation:Expected output:
| Platform | Method |
|---|---|
| macOS | brew install awscli |
| Linux (Ubuntu/Debian) | sudo apt install awscli |
| Linux (any distro) | curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" && unzip awscliv2.zip && sudo ./aws/install |
| Windows | Download and run the MSI installer from the AWS CLI page |
aws-cli/2.x.x ...Install Terraform
Install Terraform 1.0 or higher:
Verify the installation:Expected output:
| Platform | Method |
|---|---|
| macOS | brew install terraform |
| Linux | Follow the HashiCorp install guide for your distro |
| Windows | choco install terraform or download from HashiCorp |
Terraform v1.x.x — any version 1.0 or higher is supported.Clone the repository
Clone redStack and change into the project directory:All subsequent commands in this guide run from inside
redStack/.Configure AWS credentials
Run You will be prompted for four values:
See IAM Permissions for instructions on creating an IAM user and generating an access key.
aws configure to store your IAM credentials locally. Terraform reads these automatically.| Prompt | What to enter |
|---|---|
| AWS Access Key ID | The access key ID from your IAM user’s security credentials |
| AWS Secret Access Key | The secret shown once at key creation time |
| Default region name | The region where redStack will deploy — use us-east-1 unless you have a reason to pick another |
| Default output format | Enter json |
Create the AWS SSH key pair
Terraform does not create the SSH key pair. You must create it manually before running Verify the key pair was created in AWS:Expected output: a JSON object containing
terraform apply. The key pair must exist in AWS EC2, and the .pem file must be present in your redStack/ directory.- Linux / macOS
- Windows (PowerShell)
chmod 400 restricts the file to owner-read-only. SSH will refuse to use the key if permissions are too open."KeyName": "rs-rsa-key" and a fingerprint. Any error means the key was not created — check your IAM permissions and retry.You can also create the key pair in the AWS Console under EC2 → Key Pairs → Create key pair. Use RSA format and
.pem file type. Download the file into your redStack/ directory, then set permissions using the chmod or icacls command above.Run verification commands
Confirm everything is in place before moving to Terraform configuration:Expected results:
aws sts get-caller-identityreturns a JSON object with yourAccount,UserId, andArn. Any error means credentials are not configured correctly.terraform --versionshowsTerraform v1.x.xor higher.curl -s ifconfig.meprints your public IP address. Copy this — you will append/32and use it aslocalPub_ipinterraform.tfvars.
Checklist
Before continuing to Terraform Variables, confirm all of the following:- AWS CLI installed and
aws --versionreturns 2.x - Terraform installed and
terraform --versionreturns 1.0 or higher -
redStack/repository cloned and you are working from inside it -
aws configurecompleted with a valid access key, secret, region, and output format -
aws sts get-caller-identityreturns your account details without error -
rs-rsa-keykey pair exists in AWS (aws ec2 describe-key-pairs --key-names rs-rsa-key) -
rs-rsa-key.pemfile is in yourredStack/directory with restricted permissions - Your public IP noted from
curl -s ifconfig.me
