-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathauto-deploy-aws.sh
More file actions
executable file
·72 lines (61 loc) · 1.69 KB
/
auto-deploy-aws.sh
File metadata and controls
executable file
·72 lines (61 loc) · 1.69 KB
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
######################################################
#This is the script to automatically deploy the sample
#application to your AWS environment.
#
#created by T.Yamada
#last update 27/8/2018
######################################################
#!/bin/bash
CUR=`pwd`
subDomainName=$*
appname=${subDomainName}-app
region="us-west-2"
function cli_check(){
if [ "$?" -ne 0 ];then
echo "Message: Some error occurs."
echo "Abnormal end!"
exit
fi
}
# check if the argument is suitable or not
function args_check(){
if [ "$#" -ne 1 ];then
echo "Usage:"
echo " $0 [sub-domain name]"
exit
fi
}
#initialize EB CLI project
#procedure
#(1) change directory to modules
#(2) initialize EB CLI project.
#@params:
# $1:application name $2:region
function initialize(){
echo "****initialization start!****"
cd $CUR/modules
eb init $1 --platform "arn:aws:elasticbeanstalk:$2::platform/Tomcat 8.5 with Java 8 running on 64bit Amazon Linux/3.0.3" --region $2
cli_check
echo "****initialization done!****"
}
#deploying the sample application to your aws environment
#procedure
#(1) deploy the application
#@params:
# $1:subdomain name $2:region
function deploy(){
echo "****deploying sample application start!****"
eb create $1 --cname $1 --elb-type "application" --region $2
cli_check
echo "****deploying sample application done!****"
}
#show deployed information
function show_results(){
echo -e "\n[Deployed information]"
echo "Auto-deployment to your aws environment is done!"
echo You can access http://${1}.${2}.elasticbeanstalk.com
}
args_check ${subDomainName}
initialize ${appname} ${region}
deploy ${subDomainName} ${region}
show_results ${subDomainName,,} ${region}