forked from sjohnston88/teamspeak-server
-
Notifications
You must be signed in to change notification settings - Fork 0
/
infra.yml
110 lines (100 loc) · 3.07 KB
/
infra.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
AWSTemplateFormatVersion: 2010-09-09
Description: TeamSpeak server
Parameters:
TeamSpeakVersion:
Type: String
Description: Latest TeamSpeak version number
Default: "3.13.3"
Resources:
# Configure instance - use t3.micro to stay within AWS free tier
EC2Instance:
Type: AWS::EC2::Instance
Properties:
InstanceType: t3.micro
KeyName: teamspeak-server
IamInstanceProfile: !Ref InstanceProfile
SecurityGroups:
- Ref: InstanceSecurityGroup
ImageId: ami-0713f98de93617bb4
UserData:
Fn::Base64: !Sub |
#!/bin/bash
$TeamSpeakVersion = "${TeamSpeakVersion}"
wget https://files.teamspeak-services.com/releases/server/${TeamSpeakVersion}/teamspeak3-server_linux_amd64-/${TeamSpeakVersion}.tar.bz2
tar xvfj teamspeak3-server_linux_amd64-${TeamSpeakVersion}.tar.bz2
cd teamspeak3-server_linux_amd64
touch .ts3server_license_accepted
./ts3server_startscript.sh start
Tags:
- Key: Name
Value: TeamSpeak-EC2Instance
# Create security rules for the instance
InstanceSecurityGroup:
Type: AWS::EC2::SecurityGroup
Properties:
GroupDescription: TeamSpeak inbound and outbound security
SecurityGroupIngress:
- Description: TeamSpeak 3 default file transfer port.
IpProtocol: tcp
FromPort: 30033
ToPort: 30033
CidrIp: 0.0.0.0/0
- Description: TeamSpeak 3 default server query port.
IpProtocol: tcp
FromPort: 10011
ToPort: 10011
CidrIp: 0.0.0.0/0
- Description: TeamSpeak 3 server default (voice) port.
IpProtocol: udp
FromPort: 9987
ToPort: 9987
CidrIp: 0.0.0.0/0
- Description: Teamspeak 3 default tsdns port.
IpProtocol: tcp
FromPort: 41144
ToPort: 41144
CidrIp: 0.0.0.0/0
- Description: SSH traffic
IpProtocol: tcp
FromPort: 22
ToPort: 22
CidrIp: 0.0.0.0/0
Tags:
- Key: Name
Value: TeamSpeak-EC2SecurityGroup
# Create and associate an elastic IP to the instance
ElasticIPAddress:
DependsOn: EC2Instance
Type: AWS::EC2::EIP
Properties:
InstanceId: !Ref EC2Instance
Tags:
- Key: Name
Value: TeamSpeak-EC2ElasticIPAddress
# Create a role for the instance
InstanceRole:
Type: AWS::IAM::Role
Properties:
RoleName: TeamSpeak-IAMRole
Path: /
ManagedPolicyArns:
- arn:aws:iam::aws:policy/service-role/AmazonEC2RoleforSSM
AssumeRolePolicyDocument:
Statement:
- Effect: Allow
Principal:
Service:
- ec2.amazonaws.com
Action:
- sts:AssumeRole
Tags:
- Key: Name
Value: TeamSpeak-IAMRole
# Create an IAM profile for the instance
InstanceProfile:
Type: AWS::IAM::InstanceProfile
Properties:
InstanceProfileName: TeamSpeak-IAMInstanceProfile
Path: /
Roles:
- !Ref InstanceRole