-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
71 lines (61 loc) · 1.93 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
63
64
65
66
67
68
69
70
71
GREEN = \033[0;32m
YELLOW = \x1b[33m
NC = \033[0m
default:help;
appName?=continuous-dev-environment
region?=us-east-1
stack_name?=$(appName)
profile?=$(appName)
baseDomain?=example.com
bucket?=example-template-bucket
role?=arn:aws:iam::ACCOUNTID:role/cloudformation-role
certificateArn?=arn:aws:acm:us-east-1:ACCOUNTID:certificate/CERTIFICATEID
roleSSO?=continuous-team-sso-Role-ABCDEFG
## Display this help dialog
help:
@echo "${YELLOW}Usage:${NC}\n make [command]:\n\n${YELLOW}Available commands:${NC}"
@awk '/^[a-zA-Z\-\_0-9]+:/ { \
helpMessage = match(lastLine, /^## (.*)/); \
if (helpMessage) { \
helpCommand = substr($$1, 0, index($$1, ":")-1); \
helpMessage = substr(lastLine, RSTART + 3, RLENGTH); \
printf " ${GREEN}%-30s${NC} %s\n", helpCommand, helpMessage; \
} \
} \
{ lastLine = $$0 }' $(MAKEFILE_LIST)
## Update aws-cli
cphp-update-aws-cli:
pip install awscli --upgrade --user
## Package Cloud Formation template
package:
aws --profile $(profile) \
--region $(region) \
cloudformation package \
--template-file template.yml \
--s3-bucket $(bucket) \
--output-template-file template-output.yml
## Deploy Cloud Formation stack
deploy:
aws --profile $(profile) \
--region $(region) \
cloudformation deploy \
--template-file template-output.yml \
--capabilities CAPABILITY_NAMED_IAM CAPABILITY_AUTO_EXPAND \
--role-arn $(role) \
--stack-name $(stack_name) \
--parameter-overrides BaseDomain=$(baseDomain) CertificateArn=$(certificateArn) \
User=$(user) RoleSSO=$(roleSSO)
## Describe Cloud Formation stack outputs
describe:
@aws --profile $(profile) \
--region $(region) \
cloudformation describe-stacks \
--stack-name $(stack_name) \
--query 'Stacks[0].Outputs[*].[OutputKey, OutputValue]' --output text
## Delete Cloud Formation stack
delete:
aws --profile $(profile) \
--region $(region) \
cloudformation delete-stack \
--stack-name $(stack_name)