Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
AWSをGUIで操作するのは中学生までだよねー
Search
Shinichi Hama
October 03, 2016
Technology
11
4.1k
AWSをGUIで操作するのは中学生までだよねー
2016/10/03
KDLインフラ勉強会 AWS勉強会#2
Shinichi Hama
October 03, 2016
Tweet
Share
Other Decks in Technology
See All in Technology
Qiita埋め込み用スライド
naoki_0531
0
5.1k
継続的にアウトカムを生み出し ビジネスにつなげる、 戦略と運営に対するタイミーのQUEST(探求)
zigorou
0
540
ガバメントクラウドのセキュリティ対策事例について
fujisawaryohei
0
530
Storage Browser for Amazon S3
miu_crescent
1
140
開発生産性向上! 育成を「改善」と捉えるエンジニア育成戦略
shoota
2
350
マルチプロダクト開発の現場でAWS Security Hubを1年以上運用して得た教訓
muziyoshiz
3
2.3k
祝!Iceberg祭開幕!re:Invent 2024データレイク関連アップデート10分総ざらい
kniino
3
260
Fanstaの1年を大解剖! 一人SREはどこまでできるのか!?
syossan27
2
170
NW-JAWS #14 re:Invent 2024(予選落ち含)で 発表された推しアップデートについて
nagisa53
0
260
プロダクト開発を加速させるためのQA文化の築き方 / How to build QA culture to accelerate product development
mii3king
1
260
【re:Invent 2024 アプデ】 Prompt Routing の紹介
champ
0
140
DevOps視点でAWS re:invent2024の新サービス・アプデを振り返ってみた
oshanqq
0
180
Featured
See All Featured
Writing Fast Ruby
sferik
628
61k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
665
120k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
28
2.1k
Producing Creativity
orderedlist
PRO
341
39k
Bootstrapping a Software Product
garrettdimon
PRO
305
110k
Building Better People: How to give real-time feedback that sticks.
wjessup
365
19k
The Cost Of JavaScript in 2023
addyosmani
45
7k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
29
2.3k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
247
1.3M
How GitHub (no longer) Works
holman
311
140k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
33
1.9k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
PRO
10
810
Transcript
AWSΛGUIͰૢ࡞͢Δͷ தֶੜ·ͰͩΑͶʙʂ ਆށσδλϧɾϥϘ ᖛɹਅҰ ਆށσδλϧɾϥϘ Πϯϑϥษڧձ AWSษڧձ #2
ͯ͞ɾɾɾ ·ͣॳΊʹͰ͕͢ɺ
օ͞ΜɺAWSϦιʔεΛ ίʔυͰཧͰ͖ͯ·͔͢ʁ
͑ʁ·ͩϚωʔδϝϯτίϯ ιʔϧʂʁ
Ϛ ω ʛ δ ϝ ϯ τ ί ϯ ι
ʛ ϧ ⁉︎ G U I த
ܾͯ͠ɺࠓ·ͰͷൃදΛ disΓ͍ͨΘ͚Ͱ͍͟͝·ͤΜ (ʀ´Дʆ)
ͱ͍͏Θ͚Ͱɺࠓ AWSΛίʔυͰૢ࡞ɾཧ͢Δ
ͻ͍ͯࠓ CLI (Command Line Interface) ʹ͍͓͍ͭͯͨ͠͠Ͱ͢ɻ
୭Ͱ͔͢ʁ { ɹɹ“Myself”:{ ɹɹɹɹ“Name”: “Shinichi Hama (ᖛɹਅҰ)”, ɹɹɹɹ“BelongTo”: “Kobe Digital
Labo Inc. WEB Section (גࣜձࣾਆށσδλϧϥϘ ιϦϡʔγϣϯຊ෦ WEBηΫγϣϯ)”, ɹɹɹɹ“Role”: “Infrastructure Engineer (ΠϯϑϥΤϯδχΞ)”, ɹɹɹɹ“LikeAWSService”:[ ɹɹɹɹɹɹ{ ɹɹɹɹɹɹɹɹ“AWS Service”: “Amazon S3”, ɹɹɹɹɹɹɹɹ“AWS Service”: “AWS IAM” ɹɹɹɹɹɹ} ɹɹɹɹ], ɹɹɹɹ“Histrory”: [ ɹɹɹɹɹɹ{ ɹɹɹɹɹɹɹɹ"TheNumberOfYearsWorked": 3(৽ଔೖࣾࡾͰ͢ɻ), ɹɹɹɹɹɹɹɹ”RoutineWork”: "E-Commerce Site developments and SysOps work (ECαΠτͷ։ൃɺӡ༻อकΛͯ͠·͢)" ɹɹɹɹɹɹ} ɹɹɹɹ], ɹɹ} } [hama@Macbbok] ~ % aws-shell aws> kdl describe-presenter
ͬͱຊͰ͢ɻ
։ൃݱͷΠϯϑϥ୲ͷΈ ͦͦΠϯϑϥͰ͖Δਓ͕ؒগͳ͍ɻ
։ൃݱͷΠϯϑϥ୲ͷΈ ͍͍ͩͨಉ͡࡞ۀͷ܁Γฦ͠ ৽ָͯͦ͘͠͠͏ͳҊ݅ͱ͔֎͞ΕΔ orz • ͖Δɻ • ϛεΔɻ • ౖΒΕΔɻ
• ධՁ͕Լ͕Δɻ ͍͔ͯɺͦͦ͏·͘Ͱ͖ͯධՁ͞Εͳ͍… ΠϯϑϥՔಇͯͯͨ͠Γલɺࢭ·ΔͱධՁ͕͕͞Δɻ
ཧෆਚͩʂʂʂʂʢٽʣ
։ൃݱͷΠϯϑϥ୲ͷΈ • AWSΛͬͯͯҰॹɻGUIͰѻͬͯΔݶΓɺखॱͱ͍ ͏ྨΛ͠ʹ͘͘ɺޙͰ͖ͣɺͣͬͱਓґଘͷ··ɻ • ಉ͡࡞ۀʹ͔͚࣌ؒͨ͘ͳ͍ɻϛεΓͨ͘ͳ͍ɻ • Πϯϑϥ୲ͩͬͯɺશʹ٬؍Խ͠ɺཧղͯ͠Δ࡞ۀ ͘Β͍ࣗಈԽ͍ͨ͠ʂʂʂʂ
ࣗಈԽʹΑΔ ҆ఆԽɾܧଓԽΛࢦ͢ʂ
ίʔυͰAWSΛѻ͏͜ͱͰ શͯղܾʂʂʂ
ࠓ͢͜ͱɾ͞ͳ͍͜ͱ •͢͜ͱʢΞδΣϯμʣ 1.AWSͷྑ͍ͳʔͬͯࢥ͏ͱ͜Ζ 2.AWS-CLIʹ͍ͭͯ 3.Infrastructure as code 4.CLIҎ֎ʹ(CloudFormation,CatalogService) •͞ͳ͍͜ͱ •CloudFormationͷৄࡉͳ͍ํͱ͔ɺ
ࡉ͔͍αʔϏεͷઆ໌
AWSͷྑ͍͍ͳʔͬͯࢥ͏ͱ͜Ζ ৭ʑ͋Δ͚Ͳɺ ͣΓɺ “ɹɹɹɹɹɹɹɹɹɹɹɹɹɹɹɹɹɹɹɹɹ ɹɹɹɹɹɹɹɹɹɹɹɹɹɹɹɹɹɹɹɹɹɹ ɹɹɹɹɹɹɹ ” ͩͱࢥ͍·͢ɻ ϚωʔδϝϯτίϯιʔϧͰͰ͖Δ͜ͱͷ΄΅શͯͷૢ࡞͕API Ͱఏڙ͞Ε͓ͯΓɺCLIɺSDKʹΑΔ֤ݴޠͰAWSϦιʔεΛ
ѻ͏͜ͱ͕Ͱ͖Δ͜ͱ
AWS-CLI ͍·͠ΐ͏ʂ
CLI͕ͳ͍ͱ͖ʂ ͜Μͳͷͷखॱॻ͕͍Δͬͯͳͬͨʹ͏ʂʂ ͑ɺͪΖΜઃܭॻ͍Γ·͢Αʁ
CLI͕͋Δͱ͖ʂ [hama@Macbbok] ~ % aws ec2 run-instances --image-id ami-374db956 --count
1 --instance-type t2.micro --key-name hama_test_id_rsa --security-group-ids sg-××××××× --subnet-id subnet-××××××× --associate-public-ip- address | jq . { "OwnerId": "××××××××××", "ReservationId": "r-××××××××××××", "Groups": [], "Instances": [ { "Monitoring": { "State": "disabled" }, "PublicDnsName": "", "RootDeviceType": "ebs", "State": { "Code": 0, "Name": "pending" }, "EbsOptimized": false, "LaunchTime": "2016-10-02T17:16:34.000Z", "PrivateIpAddress": "10.0.4.101", "ProductCodes": [], "VpcId": "vpc-××××××××", "StateTransitionReason": "", "InstanceId": "i-×××××××××××××××××", "ImageId": "ami-374db956", "PrivateDnsName": "ip-10-0-4-101.ap-northeast-1.compute.internal", "KeyName": "hama_test_id_rsa", ɾ ɾ ɾ ʙҎԼলུʙ ͜Μ͚ͩͰ͢ɻ ͦͯ͠CLIJSONΛಡΈࠐΜͰ࣮ߦͰ͖ΔͷͰɺ ͦͷjsonΛ͓͚ͯ͠ɺͦΕ͕ઃܭॻʹͳΓ·͢ɻ จࣈ௨ΓɺίʔυͰཧͰ͖Δɻ
AWS-CLIΛ͓͏
AWS-CLIΛ͓͏ •for MAC(or for Linux) •PIPͷΠϯετʔϧ $ sudo easy_install pip
(MACͷ࣌) •aws-cliͷΠϯετʔϧ $ sudo pip install awscli •for Windows ϒϥβ͔Βμϯϩʔυͨ͠Β ↓Έ͍ͨͳΠϯετʔϥʔ͕μϯϩʔυ͞ΕΔͷͰ ɹ͋ͱྲྀΕʹΛ͍ͤͯͩ͘͞ʢgg͍ͬͯͩ͘͞ɻʣ
$ aws configure AWS access key ID [**ABCD]: AWS secret
access key [****************EFGH]: Default region name [ap-northeast-1]: Default output format [None]:
σϞ
aws-cliΛ͏্Ͱͷิɾҙ •CLIʹݶΒͣͰ͕͢ɺඞཁҎ্ʹIAMϢʔβʹݖݶΛ ༩͑ͳ͍Α͏ʹ͠·͠ΐ͏ɻ •ϩʔΧϧ͔Β࣮ߦ͢Δࡍɺaws-configureͰೝূใΛ อ࣋ͤ͟͞ΔΛಘ·ͤΜ͕ɺEC2ͷαʔό্͔ΒCLIͰ awsϦιʔεΛૢ࡞͢ΔࡍɺIAMϩʔϧΛEC2ʹ༩͢Δɻ • جຊ̍linerͰͷCLIͷར༻ආ͚·͠ΐ͏ɻΉ͠ΖjsonΛಡ·ͤΔ Α͏ͳCLIͷ͍ํΛ͍ͯͩ͘͠͞ɻ
aws-shellΛͬͯΈΑ͏ • aws-cliศར͚ͩͲɺͦͷ໘ɺଟػೳա͗ͯαϒίϚϯυ໊ Φϓγϣϯ໊ɺΦϓγϣϯͷ͍ํΛ֮͑Δͷ͕େมɻ • ͦΕͳΒGUIͰ͍͍͔ͳʔ • ͦΕ͡Ό͍ͭ·Ͱͨͬͯதֶੜͷ··Ͱ͢ʂ • ࿅श͠·͠ΐ͏ʂ
ͦΜͳ͋ͳͨʹɺaws-shellʂʂ
aws-shellΛͬͯΈΑ͏ •αδΣετʗΦʔτίϯϓϦʔτ •αϒίϚϯυ •Φϓγϣϯ •ΦϓγϣϯʹԠͨ͡ •AWSϦιʔε •ϑΝδʔݕࡧ •ϔϧϓදࣔ •γΣϧίϚϯυ •ϓϩϑΝΠϧαϙʔτ
•ཤྺཧ ҎԼͷػೳʹରԠ
aws-shellΛͬͯΈΑ͏ Πϯετʔϧ $ pip install aws-shell ͷΈʂ
σϞ̎
jqͷεεϝ • ࠷ऴతʹCLI୯ମͰ͏ͷͰͳ͘ɺCLIͷ݁ՌΛ͞Βʹͬͯɺॲཧ Λߦ͏Α͏ͳεΫϦϓτʹΑΔ࡞ۀͷࣗಈԽ͕ਐΉ͜ͱʹͳΔɻ • jqίϚϯυͱJSON͔Β؆୯ʹΛൈ͖ग़ͨ͠Γɺूܭͨ͠Γɺܗ͠ ͯදࣔͨ͠ΓͰ͖ΔJSON༻ͷgrepͱ͔awkΈ͍ͨͳίϚϯυɻ • awsίϚϯυͷϨεϙϯεΛjsonܗࣜʹ͓ͯ͘͠ͱɺ͜ͷjqͱ૬ੑ͕ඇৗ ʹΑ͘ɺجຊతʹηοτͰΘΕͯ·͢ɻ
jqͷεεϝ •୯७ͳ͍ํάά͍ͬͯͨͩ͘ͱͯ͠ɺҎԼͷΑ͏ͳ͍ํͰͬͨΓ͠·͢ɻ 1.Value͚ͩදࣔ $ aws ec2 describe-instances | jq '.Reservations[].Instances[].Tags[].Value'
"app.example.com" "db.example.com" "elasticsearch.example.com" "example.com" 2.ϓϥΠϕʔτIPΞυϨεͱTagʢName)Λλϒ۠ΓͰදࣔ $ aws ec2 describe-instances | jq -r '.Reservations[].Instances[] | .PrivateIpAddress + "\t" + .Tags[].Value' 192.168.1.125 app.example.com 192.168.1.14 db.example.com 192.168.1.250 elasticsearch.example.com 192.168.1.230 example.com
CLIҎ֎ͷαʔϏε •CloudFormation •͕ࣗ࡞Γ͍ͨڥΛఆٛͨ͠ϑΝΠϧ(template)Λ࡞ͬͯɺͦ ͷఆٛॻΛಡΈࠐΜͰࣗಈͰڥΛ࡞ͬͯ͘ΕΔαʔϏεɻ •AWSͷϦιʔε୯ҐͰͳ͘ɺVPCͷωοτϫʔΫͱؚ͔Ί ͨશͯͷڥ୯ҐͰͷΠϯϑϥߏஙͷࣗಈԽΛߦ͏ɻ CLIͰͷཧʹ͑͞׳Ε͖ͯͨΒૣʑͱͬͪ͜ʹҠΓ·͠ΐ͏ɻ
cloudFormationΠϝʔδ
Infrastructure as code •AWSͱ͍͏ΫϥυαʔϏεΛϑϧʹ׆༻͢Δ͜ͱͰɺ Infrastructure as codeΛ࣮ݱ͢Δɻ •Πϯϑϥͦͷଞͷιʔείʔυͱִ͚ͯͳ͘ɺཧɾӡ༻Ͱ ͖Δ͕࣌དྷͨɻ •ΠϯϑϥΤϯδχΞͷઐੑԼ͕Δͱࢥ͏ɻ
•ϑϧελοΫͳΤϯδχΞΛࢦ͢ͷ͔ɺΫϥυαʔϏεΛ ᘳʹ͍͜ͳ͢ʰεʔύʔΠϯϑϥΤϯδχΞʱʹͳΔͷ͔ͷબ ͷ͍ۙͱײ͡Δɻ
·ͱΊ •AWS-CLIΛͱΓ͋͑ͣͬͯΈΔͱ͜Ζ͔Β࢝Ί·͠ΐ͏ɻ ɹ→͑Θ͔Δ͜ͱͷํ͕ଟ͍ ɹˠ͋ͱ৭ʑۀతʹศརɻ •infrastructure as codeʹΑΔࣗಈԽखஈͰ͋ͬͯɺతͰͳ͍ɻ →ࣗͨͪͷ͍ͬͯΔ͜ͱͷ҆ఆԽɾܧଓԽΛతͱͯ͠ ɹࣗಈԽͱ͍͏खஈͰɺߏԽ͞ΕͨۀͷҰ෦ΛࣗಈԽ͢Δɻ •
શͯͷਓ͕AWSΛCLIͰҙຯΒͣʹѻ͏ͷɺ۪ࡦɻ • ͰɺΠϯϑϥΛAWSΛઐతʹΖ͏ͱ͍ͯ͠Δզʑ͘Β͍ͤΊͯCLI Ͱѻ͑ΔΑ͏ʹͳ͓ͬͯ͘͜ͱ͕ɺॾʑ͍ΖΜͳ໘Ͱʹͨͪ·͢ɻ
ALL You Need Is Code !!