Before using Terraform to manage your infrastructure, make sure you have configured your AWS credentials. If you haven't done so already, you can set up your AWS CLI by running:
aws configureFollow the prompts to enter your Access Key ID, Secret Access Key, default region, and output format.
Once your AWS credentials are configured, navigate to your Terraform project directory and initialize Terraform by running:
terraform initThis command initializes your working directory and downloads any necessary plugins.
After initialization, apply your Terraform configuration to create the resources defined in your Terraform files:
terraform apply -auto-approveTerraform will generate an execution plan and prompt you to confirm before making any changes. Use the -auto-approve flag to automatically approve the plan and apply changes without user input.
To SSH into your development server, follow these steps:
-
Change Permissions of Private Key: First, ensure that the permissions of your private key file are set correctly. Run the following command in your terminal:
chmod 400 ~/.ssh/pieceowater-dev-serv.pem -
SSH Command: Once the permissions are set, use the following command to SSH into your development server:
ssh -i "~/.ssh/pieceowater-dev-serv.pem" ec2-user@ec2-16-171-242-247.eu-north-1.compute.amazonaws.comReplace
~/.ssh/pieceowater-dev-serv.pemwith the path to your private key file andec2-16-171-242-247.eu-north-1.compute.amazonaws.comwith the Public IPv4 DNS of your development server.After running this command, you should be able to access your development server via SSH.