File tree Expand file tree Collapse file tree 1 file changed +52
-0
lines changed
Expand file tree Collapse file tree 1 file changed +52
-0
lines changed Original file line number Diff line number Diff line change @@ -9,6 +9,29 @@ This EC2 instance is configured to run a Docker-based application with the follo
99
1010## Accessing the EC2 Instance
1111
12+ Login into AWS Academy lab and then
13+
14+
15+ To enable Terraform and AWS CLI to communicate with AWS, you need to configure your AWS credentials and config files on your local machine:
16+
17+ - Create or open the AWS credentials file at ` ~/.aws/credentials ` and add your credentials:
18+
19+ Create or open the AWS config file at ~ /.aws/config and set the default region and output format:
20+
21+ ``` bash
22+ [default]
23+ region = us-east-1
24+ output = json
25+
26+
27+ ```
28+
29+
30+ ``` ini
31+ [default]
32+ aws_access_key_id = YOUR_ACCESS_KEY_ID
33+ aws_secret_access_key = YOUR_SECRET_ACCESS_KEY
34+
1235To connect to the EC2 instance via SSH, use the following command:
1336
1437```bash
@@ -44,3 +67,32 @@ Terraform is used to provision the AWS infrastructure, including:
4467- Key pair creation for SSH access
4568- Automated waiting for instance SSH availability
4669- Triggering Ansible playbook execution to provision the EC2 instance after launch
70+
71+
72+ ### Running Terraform
73+ Make sure Terraform is installed locally.
74+
75+ Initialize Terraform:
76+
77+ ``` bash
78+ Copy
79+ Edit
80+ terraform init
81+
82+ ```
83+
84+ ``` bash
85+ Apply the Terraform plan:
86+
87+ bash
88+ Copy
89+ Edit
90+ terraform apply
91+ Confirm by typing yes when prompted.
92+ ```
93+
94+ Terraform will output the public IP address of the EC2 instance — use this IP to SSH.
95+
96+
97+
98+
You can’t perform that action at this time.
0 commit comments