File size: 1,455 Bytes
56d74b6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
---
AWSTemplateFormatVersion: "2010-09-09"
Description: >
  Basic Template
Parameters:
  ApplicationName:
    Type: String
    Description: Application Name
  Environment:
    Type: String
    Default: Test
    Description: Environment
    AllowedValues:
      - Dev
      - Test
  TestEnvironment:
    Type: String
    Default: String
    Description: Another Environment
    AllowedValues:
      - Dev
      - Test
      - Prod
  BillingContact:
    Type: String
    Default: billing@example.com
    AllowedPattern: '^[A-Za-z0-9._%+-]+@example.com$'
  OperationsContact:
    Type: String
    Default: operations@example.com
    AllowedPattern: '^[A-Za-z0-9._%+-]+@example.com$'
Conditions:
  isProd:
    Fn::Equals: [!Ref Environment, 'Prod']
Resources:
  untaggedInstance:
    Type: AWS::EC2::Instance
    Properties:
      ImageId: ami-123456
  myInstance:
    Type: AWS::EC2::Instance
    Properties:
      ImageId: ami-123456
      Tags:
      -
        Key: application
        Value: !Ref ApplicationName
      -
        Key: environment
        Value: !Ref Environment
      -
        Key: environment
        Value: !If [isProd, 'Yes', !Ref Environment]
      -
        Key: environment
        Value: !Ref TestEnvironment
      -
        Key: billing_contact
        Value: !Ref BillingContact
      -
        Key: operations_contact
        Value: !Ref OperationsContact
      -
        Key: security_contact
        Value: security@example.c