Skip to content

Commit

Permalink
Se agrega el proyecto ec2-with-keypair-rsa-public
Browse files Browse the repository at this point in the history
  • Loading branch information
gilbarsan01 committed Oct 15, 2019
1 parent 4487f89 commit cc8ecd3
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 0 deletions.
10 changes: 10 additions & 0 deletions ec2-with-keypair-rsa-public/instancia.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
resource "aws_instance" "web" {

ami = "ami-082b5a644766e0e6f"
instance_type = "t2.micro"
key_name = "${aws_key_pair.keypair.key_name}"

vpc_security_group_ids = [ "${aws_security_group.allow_ssh_anywhere.id}" ]

}

8 changes: 8 additions & 0 deletions ec2-with-keypair-rsa-public/keypair-public.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#Se declara el keypair para la conexión a la instancia.

resource "aws_key_pair" "keypair" {
key_name = "terrafor-test-keypair"

public_key = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDyy3ZmliPL87q47i9/Gjp1QXYt6NaeumfZOG5N0yKm7vmLM1rfR6V5c6vGX16kpf6bk7DgD6BY4yoMitJuMI3caLtG9ETH1RtLxpr9hsq8GtmcVihBVc6mMScC+e0eSC0544ZT/fCnRc9zGoYQV1qyhwoiljStBX4EziAc2k1POHVe7hGQZocCeA8nqdy3QJb6R7qcEMwLgyWvCPJV3pHNHP61OTOu0I6jiHII1buhFNcbzCJzWN5CHknF+QtoDIONmlIFvKQVKDLX5IhUX6Q3F+HnosrLpS6laRaKcMqgkqB3C+jdeJpobkVCwZfrVcXp3lSlhaUK2bLGABardtwv gilbarsan@HP-Pavilion-17-Notebook"
}

3 changes: 3 additions & 0 deletions ec2-with-keypair-rsa-public/provider.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
provider "aws" {
region = "us-west-2"
}
24 changes: 24 additions & 0 deletions ec2-with-keypair-rsa-public/sg.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#Generar security group en VPC por default.
# el valor vpc_id = "vpc-f8ba509c" - Es el ID de la VPC por default.

resource "aws_security_group" "allow_ssh_anywhere" {
name = "allow_ssh_anywhere"
description = "Allow all inbound traffic ssh"
vpc_id = "vpc-f8ba509c"

ingress {
# TLS (change to whatever ports you need)
from_port = 22
to_port = 22
protocol = "tcp"
cidr_blocks = [ "0.0.0.0/0" ]
}

egress {
from_port = 0
to_port = 0
protocol = "-1"
cidr_blocks = ["0.0.0.0/0"]
}
}

0 comments on commit cc8ecd3

Please sign in to comment.