Install Amazon EC2 Tools (Linux) by Jeff Hunter, Sr. atabase A!

ministrator

Contents
• • •

Intro!u"tion Install Amazon EC2 Tools (Linux) About t#e Aut#or

Introduction
T#is s#ort $ui!e %resents an exam%le of t#e ste%s on #o& to install t#e Amazon A'I Tools an! t#e Amazon A(I Tools on t#e Linux (Cent)S *) %latform. T#e Amazon A'I Tools an! t#e Amazon A(I Tools are %a"+a$es of "omman!,line s"ri%ts to t#e A-S &eb ser.i"e use! to mana$e an! bun!le instan"es. Alt#ou$# t#ere are many ot#er e.elo%er Tools %ro.i!e! by Amazon an! t#e A-S !e.elo%ment "ommunity to #el% !e.elo%ers "reate an! mana$e a%%li"ations built on A-S, t#ese t&o are t#e most "ommonly use! to mana$e EC2 instan"es.

Amazon EC2 A'I Tools T#e A'I tools ser.e as t#e "lient interfa"e to t#e Amazon EC2 &eb ser.i"e. /se t#ese tools to re$ister an! laun"# instan"es, mani%ulate se"urity $rou%s, an! more.

Amazon EC2 A(I Tools T#e Amazon EC2 A(I Tools are "omman!,line utilities to #el% bun!le an Amazon (a"#ine Ima$e (A(I), "reate an A(I from an existin$ ma"#ine or installe! .olume, an! u%loa! a bun!le! A(I to Amazon S0.

Install Amazon EC2 Tools (Linux)
/se t#e follo&in$ ste%s to install t#e Amazon A'I Tools an! t#e Amazon A(I Tools on t#e Linux %latform. 1. Shell Login Script A!! t#e follo&in$ en.ironment .ariables to your s#ell lo$in s"ri%t (i.e. /root/.bashrc). (a+e any ne"essary "#an$es for your s%e"ifi" en.ironment by re%la"in$ AWS_ACCOUNT_NUMBER, AWS_ACCESS_KEY_ID, an! AWS_SECRET_ACCESS_KEY &it# your

" .A-S a""ount number an! se"urity "re!entials.ey ser.6r' "omman!. an! is t#e one I use base! on my $eo$ra%#i" lo"ation near t#e east "oast.backup # vi /root/.ate +ey file an! EC2 "ertifi"ate file. 9AWS_ACCESS_KEY_ID: .ariable (or t#e .a1o2a3s." . T#is !ire"tory s#oul! be "reate! as a sub. 9EC#_UR/: o 2 A-S a""ount number (sometimes "alle! t#e a""ount i!) &#i"# s#o&s u% &#en you $o to t#e A""ount A"ti. !"ort AWS_ACCOUNT_NUMBER$<444444444444> !"ort AWS_ACCESS_KEY_ID$<5o6r_acc ss_. 9EC#_%OME: 2 Installation !ire"tory for t#e Amazon A'I Tools an! t#e Amazon A(I Tools.) an! "ertifi"ate file ( c#.ity %a$e an! is in t#e form 4444. (a+e "ertain to remo.c rt." .c rt.e is 6s.i!in$ your .5> !"ort (AT%$&(AT%0/6sr/'oca'/b*20/6sr/'oca'/sb*20/6sr/b*20/6sr/sb*20/b*20/sb*20 &EC#_%OME/b*2 !"ort 8A)A_%OME$/6sr # source ~/.5_*7> !"ort AWS_SECRET_ACCESS_KEY$<5o6r_s cr t_acc ss_. tools an! "ertifi"ates).ri$#t of t#e A""ount A"ti.e out t#e #y%#ens an! :ust enter t#e 12 !i$its.line tools in bot# %a"+a$es. an! 9EC#_CERT: 2 EC2 %ri.ironment . ast.ey an! Se"ret .ironment.!ire"tory in EC#_BASE. Amazon uses t#is en.e." . <a.bashrc o 9EC#_BASE: 2 o 3ase !ire"tory for all Amazon EC2 relate! "om%onents (i.bashrc. "li"+ on t#e Access Keys tab un!er Access Credentials to "reate or .line tools.bashrc /root/. !"ort EC#_CERT$&EC#_BASE/c rt*+*cat s/ c#. )n Linux. T#is en. I ty%i"ally rename t#e 4. 9EC#_(RI)ATE_KEY: o o 2 S%e"ifies a 9e$ion en!%oint for your en.e t#e < an! > "#ara"ters &#en %ro.i$ate to Se"urity Cre!entials.ie& your Access Key I an! Secret Access Key."-.line fla$) to "#oose a !efault 9e$ion &#en runnin$ any of t#e "omman!.bashrc !"ort EC#_BASE$/o"t/ c# !"ort EC#_%OME$&EC#_BASE/too's !"ort EC#_(RI)ATE_KEY$&EC#_BASE/c rt*+*cat s/ c#.ironment .4444.alues. T#e !efault 9e$ion for t#e en!%oint use! in t#e exam%le s#ell lo$in s"ri%t abo.e t#e %ur%ose of I an! 'ass&or! to a""ess Amazon S0.567 "ertifi"ate files as follo&s8 %ri.a. -#en you use t#e a""ount number in t#e "ontext of t#e A'Is.ate +ey file ( c#."-. 9AWS_ACCOUNT_NUMBER: o an! 9AWS_SECRET_ACCESS_KEY: 2 T#e A-S A""ess . T#e a""ount number is a 12 !i$it number t#at a%%ears in t#e to%. you s#oul! lea.. # cp /root/. !"ort EC#_UR/$htt"s0// c#.4444.co.ity area of t#e A-S &eb site. I "ommonly use /o"t/ c#.)..ariable &ill be use! by all of t#e "omman!.

. $%&'!"#$% ?. '?_#..b. E2=*ro2.ate +ey file an! "ertifi"ate file) to a%%ro%riate !ire"tory.bashrc) &#i"# &as #an!le! in t#e %re.AE.#/G/HYRTNEACAKIHM((HWAOHAKYCTCAA.?." . !E?_?AD O" 28DK ?A..e a .ama(ona+s. to c#.@. #/G/HYRTNEACAKIHM((HWAOHAKYCTCAA..ironment .e.a installe!.ariable is set for t#e "urrent s#ell an! "onfirm t#at Ja. # mkdir -p $%&'!"#$% # curl -o /tmp/ec'-api-tools..(ip -d /tmp # cp -r..ariable s#oul! be set to t#e a%%ro%riate #ome !ire"tory in your s#ell lo$in s"ri%t (i..(ip http)//s*.ironment . EC2 #ri"ate Key $ile and EC2 Certi%icate $ile Co%y your 4."-. # echo $JA A!"#$% /6sr # java -version <a=a = rs*o2 >.@_#A> O" 28DK R62t*.a base!.(ip http)//s*././tmp/ec'-ami-tools-.(ip # un(ip /tmp/ec'-ami-tools.ersion of Ja. >erify t#e 8A)A_%OME en.0-openjdk T#e 8A)A_%OME en./. If you !on=t alrea!y #a. /root/.. to c#." .com/ec'do+nloads/ec'-ami-tools.CD Brh '.2.C." . # yum -y install java-1. I &ill be renamin$ my %ri.ama(ona+s.(ip -d /tmp # cp -r /tmp/ec'-api-tools-. Install !a"a T#e EC2 A'I Tools an! Amazon EC2 A(I Tools are Ja.B*t S r= r )M Bb6*'7 #@. an! my "ertifi"ate file from c rt.o7 D 0.. .(ip # un(ip /tmp/ec'-api-tools... # curl -o /tmp/ec'-ami-tools..com/ec'do+nloads/ec'-api-tools.a is installe! "orre"tly.567 Certifi"ate (%ri.#F . 2t BIc 7T a? . Install the Amazon EC2 Tools o&nloa! t#e Amazon EC2 A'I Tools..ate +ey file from "-.*! 7 .6. $%&'!"#$% o&nloa! t#e Amazon EC2 A(I Tools to t#e EC2 ima$e. @or t#e %ur%ose of t#is exam%le." . !o so no&.c rt.ious ste%.

co.pem 5.co.. REIION sa.a.. c#.a1o2a3s.pem $%&'!..so6th ast.e been installe! "orre"tly. ast. # ec'-describe-re<ions C'* 2t.r J*o2s s"ri%t &#i"# is foun! in t#e EC2 A'I Tools to list t#e re$ions you #a.A/%/certi-icates/ec'-cert..A#2783&5&A7.7 scr*b .a. ast. REIION 6s. c#..#.pem $%&'!.co.a1o2a3s..a.6s.3 st.co.I2=a'*7S c6r*t50 R K6 st has # date Th6 862 /M Th G @#0LC0#G EDT #@.G 7a5s o++ M/ !"*r 7 # date -s >'7 J?6 '01' 1*)*6)00> S62 862 #A . ast. REIION 6s..co.2orth ast. REIION 6s.# c#.e t#e follo&in$ error messa$e runnin$ any of t#e EC2 tools.a1o2a3s.. c#.a".A/%/certi-icates/ec'pk.... # ec'-describe-re<ions = sort REIION a".so6th ast.A#2783&5&A7..6s.3 st.a.# ..a". Test t#e c#. If you re"ei. c#.a1o2a3s. c#. REIION 6.. REIION a"..3 st.a.a. c#...2orth ast.. ma+e "ertain t#at t#e !ate an! time are set "orre"tly. &eri%y Amazon EC2 Tools >erify t#at t#e Amazon EC2 Tools #a.co.a.a1o2a3s.3 st.co.sa.a1o2a3s. ast.# mkdir -p $%&'!.a1o2a3s.A/%/certi-icates # cp pk-'01023456%A&7892$::2.3 st.6s.pem # cp cert-'01023456%A&7892$::2.C0C?0@@ EDT #@.3 st. 6.e a""ess to.# abo= 7at *s .

Sign up to vote on this title
UsefulNot useful