Skip to content

Instantly share code, notes, and snippets.

@afcastano
Created August 19, 2019 11:04
Show Gist options
  • Save afcastano/6cf5936236efa48b4e0a7686b53f048c to your computer and use it in GitHub Desktop.
Save afcastano/6cf5936236efa48b4e0a7686b53f048c to your computer and use it in GitHub Desktop.
AWS Public Instances
#### EC2 INSTANCES #################
# bastion ############################
resource "aws_instance" "bastion" {
ami = "${data.aws_ami.ubuntu.id}"
vpc_security_group_ids = [
"${aws_security_group.bastion.id}"
]
instance_type = "${var.aws_instance_type}"
subnet_id = "${aws_subnet.pub_subnet_1.id}"
key_name = "${aws_key_pair.demo_keys.key_name}"
tags {
Name = "WordPress Bastion"
SELECTOR = "bastion"
}
}
resource "aws_eip" "bastion_eip" {
depends_on = ["aws_internet_gateway.app_igw", "aws_vpc_dhcp_options_association.dns_resolver"]
}
resource "aws_eip_association" "bastion_eip_assoc" {
instance_id = "${aws_instance.bastion.id}"
allocation_id = "${aws_eip.bastion_eip.id}"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment