Top Banner
を実装してみた (似非) 2015, 12/25(Thu) Qiita, Twitter: @hassaku_63
30

Cloud automator的なものを実装してみる

Jan 22, 2018

Download

Engineering

saku hatsu
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Cloud automator的なものを実装してみる

を実装してみた(似非)

2015, 12/25(Thu)

Qiita, Twitter:  @hassaku_63

Page 2: Cloud automator的なものを実装してみる

背景

2

Page 3: Cloud automator的なものを実装してみる

• 「サーバーレスアーキテクチャ」

•Cloud Automator いいよね

3

Page 4: Cloud automator的なものを実装してみる

• 「サーバーレスアーキテクチャ」

•Cloud Automator いいよね

4

Page 5: Cloud automator的なものを実装してみる

• 「サーバーレスアーキテクチャ」

•Cloud Automator いいよね

5

GUIで誰でも操作

Page 6: Cloud automator的なものを実装してみる

• 「サーバーレスアーキテクチャ」

•Cloud Automator いいよね

6

サーバー要らずのオペレーション

GUIで誰でも操作

Page 7: Cloud automator的なものを実装してみる

サーバーレスアーキテクチャ…

7

Page 8: Cloud automator的なものを実装してみる

サーバーレスアーキテクチャ!

8

Page 9: Cloud automator的なものを実装してみる

本日のテーマ

9

Page 10: Cloud automator的なものを実装してみる

10

Page 11: Cloud automator的なものを実装してみる

11

EC2のStart/Stop自動化を Lambdaを使って実装してみる

Page 12: Cloud automator的なものを実装してみる

やること・やらないこと

12

Page 13: Cloud automator的なものを実装してみる

やらないこと

• プログラミング (Python) の勉強

• AWS SDK (boto3) の使い方

13

Page 14: Cloud automator的なものを実装してみる

やること

• Lambda(とSNS)を組み合わせたサーバーレスな自動化の仕組みの実装方法について勉強する

• Lambda + scheduled event のざっくりした使い方

• Lambda + SNS event の使い方

14

Page 15: Cloud automator的なものを実装してみる

構成図

15

Page 16: Cloud automator的なものを実装してみる

16

Page 17: Cloud automator的なものを実装してみる

?17

Page 18: Cloud automator的なものを実装してみる

おさらい

18

Page 19: Cloud automator的なものを実装してみる

Amazon SNS

Publish/Subscribe 型のメッセージ配送

http://docs.aws.amazon.com/ja_jp/sns/latest/dg/welcome.html19

Page 20: Cloud automator的なものを実装してみる

AWS Lambda

20 http://docs.aws.amazon.com/ja_jp/sns/latest/dg/welcome.html

• HTTP • S3 • SNS • AWS IoT • DynamoDB • Kinesis • Schedule • …

Event Source

Eventを受けてFunctionを実行

Page 21: Cloud automator的なものを実装してみる

構成図

21

Page 22: Cloud automator的なものを実装してみる

22

Page 23: Cloud automator的なものを実装してみる

23

Trigger(timer) 部分

Page 24: Cloud automator的なものを実装してみる

24

Action の部分

Page 25: Cloud automator的なものを実装してみる

25

動作確認・デバッグ用のNotification

Page 26: Cloud automator的なものを実装してみる

構成図 - IAM-

26

Page 27: Cloud automator的なものを実装してみる

27

SNSにpublishする権限

Page 28: Cloud automator的なものを実装してみる

28

EC2 start/stop, SNS publishの権限

Page 29: Cloud automator的なものを実装してみる

手順

29

Page 30: Cloud automator的なものを実装してみる

手順1. IAM Role の作成

2. SNS Topic と Lambda Function の雛形を作成

3. SNS Topic にメール通知を実装

4. Lambda Function を実装、テスト

5. Lambda の Event Source にタイマーを設定

30