-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathArbiterNode.yaml
114 lines (110 loc) · 3.14 KB
/
ArbiterNode.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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
---
AWSTemplateFormatVersion: 2010-09-09
Metadata:
Author: Anton Umnikov
Last Updated: August 12, 2020
Description: IRIS Arbiter Node
Parameters:
#VpcIdParameter:
# Description: Launch EC2 instances in this VPC
# Default: vpc-029aba04d6dbcfae4
# Type: AWS::EC2::VPC::Id
InstanceSubnetIdParameter:
Description: Launch EC2 instances in this subnet
Default: subnet-024ee9bc8ba573050
Type: AWS::EC2::Subnet::Id
InstanceSecurityGroupParameter:
Description: Security group for the instance
Type: AWS::EC2::SecurityGroup::Id
SshKeyParameter:
Description: SSH Keypair to login to the instance
Default: anton-isc
Type: AWS::EC2::KeyPair::KeyName
IamInstanceProfileParameter:
Description: IAM instance role for EC2 instances
Default: S3FullAccessForEC2
Type: String
S3BucketNameParameter:
Description: S3 Bucket with IRIS binaries
Type: String
Default: asia-pac-training-2019
InstanceTypeParameter:
Description: Cluster node instance type
Type: String
Default: t3.small
AllowedValues:
- t3.small
- t3.large
LatestAmiId:
Type: 'AWS::SSM::Parameter::Value<AWS::EC2::Image::Id>'
Default: '/aws/service/ami-amazon-linux-latest/amzn2-ami-hvm-x86_64-gp2'
MirrorInstanceRole:
Description: Cluster node instance role
Type: String
Default: ARBITER
AllowedValues:
- NONE
- PRIMARY
- FAILOVER
- ASYNC
- ARBITER
Resources:
##Node Start##
NodeInstance:
Type: AWS::EC2::Instance
Properties:
Tags:
-
Key: Name
Value: !Sub "${AWS::StackName}-IRIS"
ImageId: !Ref LatestAmiId
#Fn::FindInMap:
#- RegionMap
#- Ref: AWS::Region
#- AMIx64
InstanceType: !Ref InstanceTypeParameter
KeyName: !Ref SshKeyParameter
IamInstanceProfile: !Ref IamInstanceProfileParameter
SecurityGroupIds:
- !Ref InstanceSecurityGroupParameter
SubnetId: !Ref InstanceSubnetIdParameter
UserData:
Fn::Base64:
Fn::Sub:
- |
#!/usr/bin/env bash
DISTR=ISCAgent-2020.1.0.215.0-lnxrhx64
#DISTR=ISCAgent-2020.1.0.197.0-lnxrhx64
BUCKET=${ConfigS3BucketName}
INSTANCEROLE=${MirrorInstanceRole}
set -o errexit
yum update -y
mkdir /tmp/irisdistr
cd /tmp/irisdistr
aws s3 cp s3://$BUCKET/$DISTR.tar.gz .
tar -xvf $DISTR.tar.gz
cd $DISTR
./agentinstall << END
1
yes
END
cd ..
sudo systemctl daemon-reload
sudo systemctl enable ISCAgent.service
sudo systemctl start ISCAgent.service
- {
ConfigS3BucketName: !Ref S3BucketNameParameter,
MirrorInstanceRole: !Ref MirrorInstanceRole
}
##Node End##
Outputs:
#NodePublicIP:
# Description: Node PublicIP
# Value: !Join
# - ''
# - ['', !GetAtt NodeInstance.PublicIp, '']
NodePrivateIP:
Description: Node PrivateIP
Value: !Join
- ''
- ['', !GetAtt NodeInstance.PrivateIp, '']