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.2k
AWSをGUIで操作するのは中学生までだよねー
2016/10/03
KDLインフラ勉強会 AWS勉強会#2
Shinichi Hama
October 03, 2016
Tweet
Share
Other Decks in Technology
See All in Technology
PaaSの歴史と、 アプリケーションプラットフォームのこれから
jacopen
7
1.5k
Goで実践するBFP
hiroyaterui
1
120
ドメイン駆動設計の実践により事業の成長スピードと保守性を両立するショッピングクーポン
lycorptech_jp
PRO
12
2.1k
Formal Development of Operating Systems in Rust
riru
1
420
Evolving Architecture
rainerhahnekamp
3
250
いま現場PMのあなたが、 経営と向き合うPMになるために 必要なこと、腹をくくること
hiro93n
9
7.7k
20250116_JAWS_Osaka
takuyay0ne
2
200
Copilotの力を実感!3ヶ月間の生成AI研修の試行錯誤&成功事例をご紹介。果たして得たものとは・・?
ktc_shiori
0
350
あなたの人生も変わるかも?AWS認定2つで始まったウソみたいな話
iwamot
3
850
#TRG24 / David Cuartielles / Post Open Source
tarugoconf
0
580
デジタルアイデンティティ人材育成推進ワーキンググループ 翻訳サブワーキンググループ 活動報告 / 20250114-OIDF-J-EduWG-TranslationSWG
oidfj
0
540
テストを書かないためのテスト/ Tests for not writing tests
sinsoku
1
170
Featured
See All Featured
Designing Experiences People Love
moore
139
23k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
49
2.2k
jQuery: Nuts, Bolts and Bling
dougneiner
62
7.6k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
507
140k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
28
9.2k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
3
360
Imperfection Machines: The Place of Print at Facebook
scottboms
267
13k
Measuring & Analyzing Core Web Vitals
bluesmoon
5
210
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
33
2.7k
Building Your Own Lightsaber
phodgson
104
6.2k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
132
33k
GitHub's CSS Performance
jonrohan
1030
460k
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 !!