-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
62 lines (57 loc) · 1.88 KB
/
Makefile
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
.DEFAULT_GOAL ?= help
.PHONY: help
help:
@echo "${Project}"
@echo "${Description}"
@echo ""
@echo "Deploy using:"
@echo " make deploy - Deploy the stack"
@echo " make tear-down - Destroy the stack"
###################### Parameters ######################
# Environment Name
Env := "dev"
# Website / Project Name
Project := "myprojectname"
# Project Description
Description := "aws-internal-static-web-hosting"
# AWS Region were the stack will be deployed
AWSRegion := "eu-west-1"
# Website Domain Name
DomainName := "internal.zoph.io"
# Route53 Hosted ZoneId
HostedZoneId := "Z1BPJ53MJJG818"
# ACM Certificate Arn
ACMCertificateArn := "arn:aws:acm:eu-west-1:123456789121:certificate/2106036f-0ba9-4d59-bf0d-2ee44725adb1"
# VPC Id
VpcId := "vpc-046bb960"
# VPC Cidr Block
VpcCidrBlock := "172.31.0.0/16"
# Private Subnet 1
PrivateSubnetId1 := "subnet-b3e648c5"
# Private Subnet 2
PrivateSubnetId2 := "subnet-40738a18"
#######################################################
infra:
aws cloudformation deploy \
--template-file ./template.yml \
--region ${AWSRegion} \
--stack-name "${Project}-internal-static-web-hosting-${Env}" \
--capabilities CAPABILITY_IAM \
--parameter-overrides \
pEnv=${Env} \
pProject=${Project} \
pDescription="${Description}" \
pDomainName=${DomainName} \
pACMCertificateArn=${ACMCertificateArn} \
pVpcId=${VpcId} \
pVpcCidrBlock=${VpcCidrBlock} \
pPrivateSubnetId1=${PrivateSubnetId1} \
pPrivateSubnetId2=${PrivateSubnetId2} \
pHostedZoneId=${HostedZoneId} \
--no-fail-on-empty-changeset
deploy: infra
@aws s3 cp ./assets/index.html s3://${DomainName}/
tear-down:
@read -p "Are you sure that you want to destroy stack '${Project}-internal-static-web-hosting-${Env}'? [y/N]: " sure && [ $${sure:-N} = 'y' ]
@aws s3 rm s3://${DomainName}/index.html
aws cloudformation delete-stack --stack-name "${Project}-internal-static-web-hosting-${Env}"