Unable to connect to ec2 instance in Terraform+AWS playground

Hello Team,

I’ve created an EC2 instance using the following terraform directives:

provider “aws” {

  • region = “us-east-1”*
  • profile = “default”*
    }

resource “aws_instance” “ec2” {

  • ami = “ami-0b0dcb5067f052a63”*
  • instance_type = “t2.micro”*
  • key_name = “prd01”*
    }

The keypair with name prd01 was created in the AWS management console before running the terraform configuration mentioned above.
After adding the .ppk file in the ssh->auth section of Putty and specifying the Public DNS name of the EC2 instance (also tried ec2-user@<public_ipv4_address>) I get a connection timeout error.

Any suggestions on how to resolve this and be able to connect ?

Hi @jcakakpo ,

Please verify that the security group authorize ssh

Regard

1 Like

Thank you very much!
The default SG inbound rule did not allow me to ssh into the ec2 instance. I deleted it and created another rule.

Thanks again!

1 Like