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
Incident Response Practices: Waroom's Features and Future Challenges
rrreeeyyy
0
150
安心してください、日本語使えますよ―Ubuntu日本語Remix提供休止に寄せて― 2024-11-17
nobutomurata
0
150
Terraform CI/CD パイプラインにおける AWS CodeCommit の代替手段
hiyanger
1
190
Going down the RAT hole: Deep dive into the Vuln-derland of APT-class RAT Tools
nttcom
0
310
社内で最大の技術的負債のリファクタリングに取り組んだお話し
kidooonn
1
500
信頼性に挑む中で拡張できる・得られる1人のスキルセットとは?
ken5scal
2
460
メールサーバ管理者のみ知る話
hinono
1
110
Terraform未経験の御様に対してどの ように導⼊を進めていったか
tkikuchi
2
370
Terraform Stacks入門 #HashiTalks
msato
0
320
Team Dynamicsを目指すウイングアーク1stのQAチーム
sadonosake
1
290
ExaDB-D dbaascli で出来ること
oracle4engineer
PRO
0
3.8k
Lambdaと地方とコミュニティ
miu_crescent
2
320
Featured
See All Featured
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
29
2.3k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
33
1.8k
Building Better People: How to give real-time feedback that sticks.
wjessup
364
19k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
356
29k
GraphQLの誤解/rethinking-graphql
sonatard
67
10k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
191
16k
We Have a Design System, Now What?
morganepeng
50
7.2k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
31
2.7k
Embracing the Ebb and Flow
colly
84
4.5k
A better future with KSS
kneath
238
17k
Java REST API Framework Comparison - PWX 2021
mraible
PRO
28
8.2k
Testing 201, or: Great Expectations
jmmastey
38
7.1k
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 !!