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
1等無人航空機操縦士一発試験 合格までの道のり ドローンミートアップ@大阪 2024/12/18
excdinc
0
150
Amazon VPC Lattice 最新アップデート紹介 - PrivateLink も似たようなアップデートあったけど違いとは
bigmuramura
0
190
非機能品質を作り込むための実践アーキテクチャ
knih
3
700
Oracle Cloud Infrastructure:2024年12月度サービス・アップデート
oracle4engineer
PRO
0
160
Snowflake女子会#3 Snowpipeの良さを5分で語るよ
lana2548
0
220
OpenAIの蒸留機能(Model Distillation)を使用して運用中のLLMのコストを削減する取り組み
pharma_x_tech
4
540
ブラックフライデーで購入したPixel9で、Gemini Nanoを動かしてみた
marchin1989
1
520
AWS re:Invent 2024 ふりかえり
kongmingstrap
0
130
AIのコンプラは何故しんどい?
shujisado
1
190
日本版とグローバル版のモバイルアプリ統合の開発の裏側と今後の展望
miichan
1
120
アップデート紹介:AWS Data Transfer Terminal
stknohg
PRO
0
170
ハイテク休憩
sat
PRO
2
120
Featured
See All Featured
Rails Girls Zürich Keynote
gr2m
94
13k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
132
33k
How to Think Like a Performance Engineer
csswizardry
22
1.2k
Speed Design
sergeychernyshev
25
670
Embracing the Ebb and Flow
colly
84
4.5k
Adopting Sorbet at Scale
ufuk
73
9.1k
Building a Scalable Design System with Sketch
lauravandoore
460
33k
Facilitating Awesome Meetings
lara
50
6.1k
[RailsConf 2023] Rails as a piece of cake
palkan
53
5k
Building Flexible Design Systems
yeseniaperezcruz
327
38k
Agile that works and the tools we love
rasmusluckow
328
21k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
28
900
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 !!