Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
EC2の起動テンプレートをAWSCLIで作ってみた
Search
amarelo_n24
October 28, 2021
Education
1.6k
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
EC2の起動テンプレートをAWSCLIで作ってみた
2021/10/28 JAWS-UG朝会 #26 登壇資料
amarelo_n24
October 28, 2021
More Decks by amarelo_n24
See All by amarelo_n24
40代になっても悩み続ける!楽しいと思えるキャリアを目指して
amarelo_n24
0
64
AWS Security Agent といっしょに脅威モデリングをやってみよう
amarelo_n24
1
340
バケットポリシーの記述を誤りマネコンからS3バケットを操作できなくなりそうになり、ルートアクセス管理を有効にしたおひとり様Organizationsの話
amarelo_n24
0
58
AWS Certified Generative AI Developer - Professional Beta 不合格体験記
amarelo_n24
1
540
マルチパートアップロードをする時にS3はどのような挙動をしているのか?
amarelo_n24
0
94
ひとりAWS BuilderCards 会を開催した話_SecurityExpansion
amarelo_n24
1
110
ひとりAWS BuilderCards 会を開催した話
amarelo_n24
1
58
re:Invent初参加者が感じたre:Invent を楽しむために必要なこと
amarelo_n24
0
81
おひとり様Organizations管理者もルートアクセス管理を有効にしよう!
amarelo_n24
2
170
Other Decks in Education
See All in Education
響け!ユーフォニアムと考える「決め方」/Thinking About Decision-Making with Sound! Euphonium
3l4l5
1
190
Geografía y Fútbol: Chattanooga Geografía del Búnker de La Roja.
juanmartin2026
1
12k
sepm-training-sample
levii
0
250
Plano urbano de Madrid desde el Ensanche al s. XXI (2ª parte).
juanmartin2026
1
89k
チームの鏡になるー自分の癖を知ると、チームのパターンが見えてくる@スクフェス仙台
saorimurooka
0
200
One Year of Learning English with AI @エンジニア英語キャリア Meetup #3
kekekenta
0
230
Examen de Selectividad. Geografía julio 2026 (Convocatoria Extraordinaria). UCLM
juanmartin2026
1
13k
新入社員を「あの子」と呼ばない運動 -PBL その前に- / Stop Calling New Hires "Kids"
aokiplayer
2
870
Soluciones al examen de Geografía 2026. JUNIO (Convocatoria Ordinaria)
juanmartin2026
1
11k
2026年度春学期 統計学 第15回 分布についての仮説を検証する ― 仮説検定(2) (2026. 7. 9)
akiraasano
PRO
0
140
輻射安全管理系統2.0暨輻防e++學園平台說明會
aecrp
0
2.1k
Center for Entrepreneurship Education | Science Tokyo (Institute of Science Tokyo)
sciencetokyo
PRO
0
420
Featured
See All Featured
Done Done
chrislema
186
17k
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
Design in an AI World
tapps
1
330
How to train your dragon (web standard)
notwaldorf
97
6.8k
Testing 201, or: Great Expectations
jmmastey
46
8.3k
How to Think Like a Performance Engineer
csswizardry
28
2.8k
Navigating the Design Leadership Dip - Product Design Week Design Leaders+ Conference 2024
apolaine
2
440
Darren the Foodie - Storyboard
khoart
PRO
4
3.9k
So, you think you're a good person
axbom
PRO
2
2.2k
WENDY [Excerpt]
tessaabrams
14
39k
Lightning talk: Run Django tests with GitHub Actions
sabderemane
0
260
How to Talk to Developers About Accessibility
jct
2
550
Transcript
EC2の起動テンプレートをAWS CLIで作ってみた 2021/10/28 JAWS-UG 朝会
自己紹介 名前 :藤田 直幸 Twitter :@amarelo_n24(コーヒー焙煎人兼エンジニア) Facebook:https://www.facebook.com/naoyuki.fujita.37 取得済AWS認定 :CLF、SAA、DVA 今後の受験予定
:SOA、SCS 好きなAWSサービス:AWS CLI、AWS CloudShell、Cloud9
2021/10/13 に開催されたJAWS-UG金沢支部×初心者支部 コラボ イベントAmazon EC2 Auto Scalingスケーリング基礎編ハンズオン の復習をAWS CLIでやってみました。 イベントページ
https://jawsug-kanazawa.doorkeeper.jp/events/128283 AWS Hands-on for Beginners Amazon EC2 Auto Scalingスケーリング基礎編ハンズオン手順書 https://zenn.dev/jawsug_kanazawa/books/auto-scaling-2021-confirmation
Auto Scalingの話をしようと思っていましたが、 起動テンプレートの作成で気づきがありましたので、 その話をしようと思います。
1.起動テンプレートとは 2.起動テンプレートの作成 3.まとめ 話すこと
1. 起動テンプレートとは
・EC2インスタンスを起動するための設定情報。 - AMI、インスタンスタイプ、セキュリティグループ等 ・Auto Scalingグループ作成時にEC2インスタンス設定に使える。 ・1つ以上のバージョンを作成できる。 - 既存の起動テンプレートを再利用して、別バージョンを作成できる。 - 不要になったバージョンは削除できる。
起動テンプレートとは(簡単に)
2.起動テンプレートの作成
ユーザーデータのテキストファイルを作成 起動テンプレートに登録するユーザーデータの作成
CLIでユーザーデータを読み込ませる場合、base64エンコードが必要。 ユーザーデータのbase64エンコード 普通にエンコードすると改行が入るため、 sed –z ‘s/¥n//g’ で 改行を取り除く必要がある。 やらないとエラーになるため、ここで少しハマった。
そもそもなぜGUIではユーザーデータ入力できるのに、 CLIではbase64エンコードが必要?? ユーザーデータのbase64エンコード ここにユーザーデータbase64エンコード値を 入力できるということは、 エンコードしていないデータを入れた場合は、 base64エンコードされてテンプレート作成さ れている?
起動テンプレート設定JSONファイルの作成 SecurityGroupIdsの値は、Stringでは なくリスト。[](角カッコ)で囲う必要がある。 これを見落としていてハマった。
EC2コマンドのサブコマンド[create-launch-template]で作成。 JSON形式で結果が表示されれば成功。 起動テンプレート作成
GUIで起動テンプレートとユーザーデータ設定確認 やはり裏ではbase64エンコード 情報を持っていて、画面表示時に デコードしている?
起動テンプレートの詳細は、サブコマンド[describe-launch-templates]で確認。 CLIで起動テンプレートの詳細を確認
サブコマンド[describe-launch-template-versions]で確認する。 CLIで起動テンプレートのバージョンの確認
ユーザーデータは、base64エンコードされたテキストデータで保存されていた。 やはりGUI画面表示時にデコード表示している(と思われる)。 CLIで起動テンプレートのバージョンの確認
3.まとめ
・起動テンプレートの作成をAWS CLIでやってみました。 ・ユーザーデータをbase64エンコードして作成することに 疑問だったけど、GUIとCLI両方で確認して納得! ・ハンズオンの復習はGUIとCLI両方でやった方が、仕組みが 良くわかる! ・Auto Scalingそのもののこと、今回のハンズオンをCLIで実行 した手順については、LT登壇かブログ執筆したい! まとめ
AWS Hands-on for Beginners Amazon EC2 Auto Scalingスケーリング基礎編ハンズオン手順書 https://zenn.dev/jawsug_kanazawa/books/auto-scaling-2021-confirmation AWS
Hands-on for Beginners Amazon EC2 Auto Scaling スケーリング基礎編 https://pages.awscloud.com/JAPAN-event-OE-Hands-on-for-Beginners-Auto_Scaling-2021-reg- event.html?trk=aws_introduction_page Amazon EC2 Auto Scaling (ユーザーガイド) https://docs.aws.amazon.com/ja_jp/autoscaling/ec2/userguide/what-is-amazon-ec2-auto- scaling.html 起動テンプレート(ユーザーガイド) https://docs.aws.amazon.com/ja_jp/autoscaling/ec2/userguide/LaunchTemplates.html AWS CLI Command Reference https://docs.aws.amazon.com/cli/latest/reference/autoscaling/index.html 参考文献
None