-
Notifications
You must be signed in to change notification settings - Fork 12
/
ec2-instance.yaml
92 lines (78 loc) · 2.21 KB
/
ec2-instance.yaml
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
---
AWSTemplateFormatVersion: '2010-09-09'
Description: 'AWS CloudFormation Template to create EC2 instances'
Parameters:
ServerName:
Description: The Server's Name
Type: String
EnvironmentName:
Description: An environment name that will be prefixed to resource names
Type: String
InstanceType:
Description: Which instance type should we use to build our server
Type: String
Default: t2.micro
AmiName:
Description: The Logical AMI Name
Type: String
AllowedValues:
- homeless
- housing
- transportation
- budget
- emergencyresponse
- bastion
EnvironmentName:
Description: Name of our environment
Type: String
VPC:
Description: Choose which VPC this server should be deployed to
Type: AWS::EC2::VPC::Id
AvailabilityZone:
Description: Avalaibility Zone to deploy in to
Type: String
Subnet:
Description: Avalaibility Zone to deploy in to
Type: String
SecurityGroupId:
Description: The Security Groups to use for the EC2 hosts
Type: String
KeyPairName:
Description: The Key Pair name to use for access to ecs and bastion
Type: String
InstanceType:
Description: The instance type we want to use
Type: String
Mappings:
HackoImageMap:
homeless:
"AMI": "ami-2e0e834e"
transportation:
"AMI": "ami-fb0d809b"
housing:
"AMI": "ami-370c8157"
emergencyresponse:
"AMI": "ami-4b0a872b"
bastion:
"AMI": "ami-f173cc91"
Resources:
EC2Instance:
Type: AWS::EC2::Instance
Properties:
SecurityGroupIds:
-
!Ref SecurityGroupId
InstanceType: !Ref InstanceType
KeyName: !Ref KeyPairName
AvailabilityZone: !Ref AvailabilityZone
SubnetId: !Ref Subnet
ImageId: !FindInMap [HackoImageMap, !Ref AmiName, AMI]
Tags:
- Key: Name
Value: !Sub ${EnvironmentName} !Sub ${ServerName}
- Key: Environment
Value: !Ref EnvironmentName
- Key: Account
Value: HackOregon
- Key: Project
Value: Admin