-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserver-stack.yaml
61 lines (55 loc) · 1.65 KB
/
server-stack.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
AWSTemplateFormatVersion: '2010-09-09'
Description: CloudFormation template to deploy Go microservice on EC2.
Resources:
EC2Instance:
Type: "AWS::EC2::Instance"
Properties:
# AvailabilityZone: us-east-1a
ImageId: "{{resolve:ssm:/mcp/amis/aml2}}"
InstanceType: t2.micro
IamInstanceProfile: IPAC_MCP_SSM_Cloudwatch_Plus_Full_S3_Access
SubnetId: subnet-00c65c8f8f0ca0f0a
SecurityGroupIds:
- sg-0218cac30933a8b5f
KeyName: ejoliet
Monitoring: true
UserData:
Fn::Base64: !Sub |
#!/bin/bash
sudo yum update -y
sudo amazon-linux-extras install golang1.11 -y
git clone https://github.com/ejoliet/go-s3-presigner go-app
cd go-app
touch webserver-app.log
go build main.go
nohup ./main > webserver-app.log 2>&1 &
Tags:
- Key: "Name"
Value: "ejoliet-s3-presigned-url"
- Key: "env"
Value: "dev"
- Key: "team"
Value: "cm"
- Key: "contact"
Value: "Emmanuel Joliet"
EC2InstanceElasticIp:
Type: AWS::EC2::EIP
Properties:
Tags:
- Key: Name
Value: ejoliet-dev
EIPAssociation:
Type: "AWS::EC2::EIPAssociation"
Properties:
InstanceId: !Ref EC2Instance
EIP: !Ref EC2InstanceElasticIp
Outputs:
InstanceId:
Description: The Instance ID
Value: !Ref EC2Instance
ElasticIP:
Description: The Elastic IP of the Instance
Value: !Ref EC2InstanceElasticIp
# PublicIP:
# Description: The Public IP of the Instance
# Value: !GetAtt EC2Instance.PublicIp