Skip to content

Instantly share code, notes, and snippets.

@ollinmagno
Last active March 21, 2022 01:24
Show Gist options
  • Save ollinmagno/a9d31c029b9e9dc8ecc7bc9b4fa2adba to your computer and use it in GitHub Desktop.
Save ollinmagno/a9d31c029b9e9dc8ecc7bc9b4fa2adba to your computer and use it in GitHub Desktop.
Configure the AWS provider
# Configure the AWS Provider
provider "aws" {
version = "~> 2.0"
region = "us-east-2"
}
resource "aws_instance" "telemetria" {
count = 3
ami = "ami-013de1b045799b282"
instance_type = "t2.micro"
key_name = "bootcamp"
tags = {
Name = "telemetria${count.index}"
}
#vpc_security_group_ids = ["sg-0d6a55fd885ce12fb","sg-0f1d3b4ab1b25ccc0"]
}
#região Ohio (us-east-2), criando uma instância EC2 "aws_instance" e definindo o nome "telemetria";
#ami - ubuntu server 20.04;
#key_name criando pares de chaves com o nome "bootcamp";
#tags - criando 3 instâncias definidos em count, e percorrido em: Name = "telemetria${count.index}"
resource "aws_security_group" "acesso_ssh" {
name = "acesso_ssh"
description = "Liberando acessos aos servidores via SSH"
ingress {
from_port = 22
to_port = 443
protocol = "tcp"
cidr_blocks = ["0.0.0.0/0"]
}
tags = {
Name = "Acesso SSH"
}
}
resource "aws_security_group" "acesso_http" {
name = "acesso_http"
description = "Liberando acessos aos servidores via SSH"
ingress {
from_port = 8080
to_port = 8080
protocol = "tcp"
cidr_blocks = ["0.0.0.0/0"]
}
tags = {
Name = "Acesso Http"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment