Last active
December 20, 2019 19:38
-
-
Save windy1/61b0b0ec4e21748cf9dfa1b5f110ee25 to your computer and use it in GitHub Desktop.
Example / Use case for AWS Multicast over Transit Gateways
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
provider "aws" { | |
region = "us-east-1" | |
} | |
resource "aws_vpc" "main" { | |
cidr_block = "10.0.0.0/16" | |
tags = { | |
Name = "Multicast_01" | |
} | |
} | |
resource "aws_security_group" "allow_udp" { | |
name = "allow_udp" | |
description = "Allow UDP inbound traffic" | |
vpc_id = aws_vpc.main.id | |
ingress { | |
from_port = 1234 | |
to_port = 1234 | |
protocol = "udp" | |
cidr_blocks = ["10.0.0.0/16"] | |
} | |
} | |
resource "aws_subnet" "main" { | |
vpc_id = aws_vpc.main.id | |
cidr_block = "10.0.1.0/24" | |
tags = { | |
Name = "Multicast_01" | |
} | |
} | |
resource "aws_instance" "mc01" { | |
ami = "ami-04b9e92b5572fa0d1" | |
instance_type = "t2.micro" | |
subnet_id = aws_subnet.main.id | |
source_dest_check = false | |
vpc_security_group_ids = [aws_security_group.allow_udp.id] | |
tags = { | |
Name = "Multicast_01" | |
} | |
} | |
resource "aws_instance" "mc02" { | |
ami = "ami-04b9e92b5572fa0d1" | |
instance_type = "t2.micro" | |
subnet_id = aws_subnet.main.id | |
source_dest_check = false | |
vpc_security_group_ids = [aws_security_group.allow_udp.id] | |
tags = { | |
Name = "Multicast_02" | |
} | |
} | |
resource "aws_ec2_transit_gateway" "main" { | |
multicast_support = true # TODO | |
tags = { | |
Name = "Multicast_01" | |
} | |
} | |
resource "aws_ec2_transit_gateway_vpc_attachment" "main" { | |
subnet_ids = [aws_subnet.main.id] | |
transit_gateway_id = aws_ec2_transit_gateway.main.id | |
vpc_id = aws_vpc.main.id | |
tags = { | |
Name = "Multicast_01" | |
} | |
} | |
# TODO | |
resource "aws_ec2_transit_gateway_multicast_domain" "main" { | |
transit_gateway_id = aws_ec2_transit_gateway.main.id | |
tags = { | |
Name = "Multicast_01" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment