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
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
amarelo_n24
October 28, 2021
Education
1.7k
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
Transcript
21 slides
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
More Decks by amarelo_n24
See All by amarelo_n24
AWS Client VPNの設定でハマったポイントとその過程での気づき
amarelo_n24
1
400
Systems Manager AgentがインストールされたPCを紛失した時の対策を考えてみた
amarelo_n24
1
130
オンプレミス環境にCloudWatch Agentを導入するならばSystemsManager Agentも一緒に導入しよう
amarelo_n24
1
170
40代になっても悩み続ける!楽しいと思えるキャリアを目指して
amarelo_n24
0
90
AWS Security Agent といっしょに脅威モデリングをやってみよう
amarelo_n24
1
430
バケットポリシーの記述を誤りマネコンからS3バケットを操作できなくなりそうになり、ルートアクセス管理を有効にしたおひとり様Organizationsの話
amarelo_n24
0
68
AWS Certified Generative AI Developer - Professional Beta 不合格体験記
amarelo_n24
1
600
マルチパートアップロードをする時にS3はどのような挙動をしているのか?
amarelo_n24
0
120
ひとりAWS BuilderCards 会を開催した話_SecurityExpansion
amarelo_n24
1
140
Other Decks in Education
See All in Education
【ainiチャット】2段階認証設定方法
ainischool
0
170
Liburd and Stoll Farrell "Copyright Essentials From A to AI: A 2026 NISO Training Series, Session One: Foundations & Frameworks of Copyright"
baltimoreniso
0
210
Web Architectures - Lecture 2 - Web Technologies (1019888BNR)
signer
PRO
0
3.8k
[2026後期火5] 論理学(京都大学文学部 後期 第4回)「∃ の規則と存在具体性」
yatabe
0
120
HCI Research Methods - Lecture 7 - Human-Computer Interaction (1023841ANR)
signer
PRO
0
1.8k
【ainiチャット操作ガイド】
ainischool
0
210
North Carolina Task Force on Child Care and Early Education
rashwhitman
0
1.5k
Longitudinal research
aisw77
0
440
Liburd and Stoll Farrell "Copyright Essentials From A to AI: A 2026 NISO Training Series, Session Four: Copyright in Pop Culture and Digital Media"
baltimoreniso
0
200
Session 1 & 2 - Mass Communication
adeputra13
0
640
自己紹介 / who-am-i
yasulab
6
7.5k
Liburd and Stoll Farrell "Copyright Essentials From A to AI: A 2026 Training Series, Session Six: Licensing & Market Power"
baltimoreniso
0
100
Featured
See All Featured
Art, The Web, and Tiny UX
lynnandtonic
304
22k
SEO Brein meetup: CTRL+C is not how to scale international SEO
lindahogenes
2
3k
How to Grow Your eCommerce with AI & Automation
katarinadahlin
PRO
2
350
Between Models and Reality
mayunak
4
590
Stop Working from a Prison Cell
hatefulcrawdad
274
21k
Into the Great Unknown - MozCon
thekraken
41
2.8k
Bridging the Design Gap: How Collaborative Modelling removes blockers to flow between stakeholders and teams @FastFlow conf
baasie
0
770
Embracing the Ebb and Flow
colly
88
5.2k
Winning Ecommerce Organic Search in an AI Era - #searchnstuff2025
aleyda
2
2.2k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
46
3.1k
The Mindset for Success: Future Career Progression
greggifford
PRO
0
560
Beyond borders and beyond the search box: How to win the global "messy middle" with AI-driven SEO
davidcarrasco
3
300