forked from awslabs/rds-snapshot-tool
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
50 lines (40 loc) · 1.62 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
STACK_NAME?=rds-snapshot-tool-demo
REGION?=ap-southeast-2
LOG_LEVEL=INFO
CODE_BUCKET_NAME?=change-me
SOURCE_PROFILE?=change-me
SOURCE_ACCOUNT_ID?=change-me
DST_PROFILE?=change-me-too
DST_ACCOUNT_ID?=change-me
clean:
aws s3 rb s3://$(CODE_BUCKET_NAME)-$(SOURCE_ACCOUNT_ID) --profile $(SOURCE_PROFILE) --force
aws s3 rb s3://$(CODE_BUCKET_NAME)-$(DST_ACCOUNT_ID) --profile $(DST_PROFILE) --force
upload:
aws s3 mb s3://$(CODE_BUCKET_NAME)-$(SOURCE_ACCOUNT_ID) --profile $(SOURCE_PROFILE)
aws s3 mb s3://$(CODE_BUCKET_NAME)-$(DST_ACCOUNT_ID) --profile $(DST_PROFILE)
make -C lambda all AWSARGS="--profile $(SOURCE_PROFILE)" S3DEST=$(CODE_BUCKET_NAME)-$(SOURCE_ACCOUNT_ID)
rm lambda/._*
make -C lambda all AWSARGS="--profile $(DST_PROFILE)" S3DEST=$(CODE_BUCKET_NAME)-$(DST_ACCOUNT_ID)
deploy-source:
aws cloudformation deploy \
--region $(REGION) \
--template-file cftemplates/snapshots_tool_rds_source.json \
--stack-name $(STACK_NAME)-source \
--profile $(SOURCE_PROFILE) \
--capabilities CAPABILITY_IAM CAPABILITY_NAMED_IAM \
--parameter-overrides \
CodeBucket=$(CODE_BUCKET_NAME)-$(SOURCE_ACCOUNT_ID) \
DestinationAccount=$(DST_ACCOUNT_ID) \
LogLevel=$(LOG_LEVEL)
deploy-destination:
aws cloudformation deploy \
--region $(REGION) \
--template-file cftemplates/snapshots_tool_rds_dest.json \
--stack-name $(STACK_NAME)-dest \
--profile $(DST_PROFILE) \
--capabilities CAPABILITY_IAM CAPABILITY_NAMED_IAM \
--parameter-overrides \
CodeBucket=$(CODE_BUCKET_NAME)-$(DST_ACCOUNT_ID) \
DestinationAccount=$(DST_ACCOUNT_ID) \
DestinationRegion=$(REGION)
all: upload deploy-source deploy-destination clean