Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

LambdaでBilling Alertを拡張してみた

1,128 views

Published on

JAWS-UG アーキテクチャ支部 クラウドネイティブ分科会#10
LT枠発表内容です。

Published in: Technology
  • DOWNLOAD THIS BOOKS INTO AVAILABLE FORMAT (Unlimited) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { https://tinyurl.com/yyxo9sk7 } ......................................................................................................................... Download Full EPUB Ebook here { https://tinyurl.com/yyxo9sk7 } ......................................................................................................................... ACCESS WEBSITE for All Ebooks ......................................................................................................................... Download Full PDF EBOOK here { https://tinyurl.com/yyxo9sk7 } ......................................................................................................................... Download EPUB Ebook here { https://tinyurl.com/yyxo9sk7 } ......................................................................................................................... Download doc Ebook here { https://tinyurl.com/yyxo9sk7 } ......................................................................................................................... ......................................................................................................................... ......................................................................................................................... .............. Browse by Genre Available eBooks ......................................................................................................................... Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult,
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • DOWNLOAD THIS BOOKS INTO AVAILABLE FORMAT (Unlimited) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { https://tinyurl.com/yyxo9sk7 } ......................................................................................................................... Download Full EPUB Ebook here { https://tinyurl.com/yyxo9sk7 } ......................................................................................................................... ACCESS WEBSITE for All Ebooks ......................................................................................................................... Download Full PDF EBOOK here { https://tinyurl.com/yyxo9sk7 } ......................................................................................................................... Download EPUB Ebook here { https://tinyurl.com/yyxo9sk7 } ......................................................................................................................... Download doc Ebook here { https://tinyurl.com/yyxo9sk7 } ......................................................................................................................... ......................................................................................................................... ......................................................................................................................... .............. Browse by Genre Available eBooks ......................................................................................................................... Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult,
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • DOWNLOAD THIS BOOKS INTO AVAILABLE FORMAT (Unlimited) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { https://tinyurl.com/yyxo9sk7 } ......................................................................................................................... Download Full EPUB Ebook here { https://tinyurl.com/yyxo9sk7 } ......................................................................................................................... ACCESS WEBSITE for All Ebooks ......................................................................................................................... Download Full PDF EBOOK here { https://tinyurl.com/yyxo9sk7 } ......................................................................................................................... Download EPUB Ebook here { https://tinyurl.com/yyxo9sk7 } ......................................................................................................................... Download doc Ebook here { https://tinyurl.com/yyxo9sk7 } ......................................................................................................................... ......................................................................................................................... ......................................................................................................................... .............. Browse by Genre Available eBooks ......................................................................................................................... Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult,
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • DOWNLOAD THIS BOOKS INTO AVAILABLE FORMAT (Unlimited) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { https://tinyurl.com/yyxo9sk7 } ......................................................................................................................... Download Full EPUB Ebook here { https://tinyurl.com/yyxo9sk7 } ......................................................................................................................... ACCESS WEBSITE for All Ebooks ......................................................................................................................... Download Full PDF EBOOK here { https://tinyurl.com/yyxo9sk7 } ......................................................................................................................... Download EPUB Ebook here { https://tinyurl.com/yyxo9sk7 } ......................................................................................................................... Download doc Ebook here { https://tinyurl.com/yyxo9sk7 } ......................................................................................................................... ......................................................................................................................... ......................................................................................................................... .............. Browse by Genre Available eBooks ......................................................................................................................... Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult,
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • DOWNLOAD THIS BOOKS INTO AVAILABLE FORMAT (Unlimited) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { https://tinyurl.com/yyxo9sk7 } ......................................................................................................................... Download Full EPUB Ebook here { https://tinyurl.com/yyxo9sk7 } ......................................................................................................................... ACCESS WEBSITE for All Ebooks ......................................................................................................................... Download Full PDF EBOOK here { https://tinyurl.com/yyxo9sk7 } ......................................................................................................................... Download EPUB Ebook here { https://tinyurl.com/yyxo9sk7 } ......................................................................................................................... Download doc Ebook here { https://tinyurl.com/yyxo9sk7 } ......................................................................................................................... ......................................................................................................................... ......................................................................................................................... .............. Browse by Genre Available eBooks ......................................................................................................................... Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult,
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here

LambdaでBilling Alertを拡張してみた

  1. 1. Mamoru Ohashi @mamohacy @mamohacy#20160714 LambdaでBilling Alertを 拡張してみた ~ 非マネコン/日別31段階/無期限繰返通知 ~ 2016.07.14
  2. 2. 1 大橋 衛(オオハシマモル) 1974/10/01(41歳) AWS Solution Architect(associate) アプリエンジニア12年 インフラエンジニア4年 クラウドエンジニア3年(=AWS歴) 2016/07現在、現在大手通信会社にて AWSコンサル/セキュリティ監査業務 家族:妻、娘2人 趣味:スノーボード、読書、DIY 絶賛本名プレイ中 @mamohacy http://blog.mamohacy.com/ 自己紹介 @mamohacy#20160714
  3. 3. 2 AWS Summit Tokyo 2016 に登壇しました @mamohacy#20160714 http://cloudblog.kddi.com/iaaspaas/4279/
  4. 4. 使ってますか? Lambda
  5. 5. 使ってますよ! Lambda
  6. 6. 5 使ってますよ!Lambda うちでは主に「運用管理ツール」として使ってます ・Slackに投げた勤怠連絡をメールに転送 ・billing情報をSlackに通知 ・IAM管理統制とセキュリティ統制自動化 ・侵入テスト申請自動化 ・などなど @mamohacy#20160714 その中から今回は「拡張版 Billing Alert」をご紹介!
  7. 7. 開発部門Y開発部門X 支払アカウント @mamohacy#20160714 弊社のAWS利用費支払い管理 システムA 開発 商用 検証 システムB 開発 システムC 開発/検 証 商用 AWS チーム 開発 部門 :AWSアカウント
  8. 8. 7 Billingの課題 「予算策定は開発部門」 「支払とBilling Alert設定はAWSチーム」  各部門から予算情報を取得  予算情報/過去実績から閾値を算出・予測  アカウントAにBilling Alertを設定  アカウントBにBilling Alertを設定  アカウントCに・・・・  あ、Alert飛んだ。確認しなきゃ。  え?負荷試験中だから大丈夫?そうですか・・・  は?来週に緊急リリース?マジっすか? @mamohacy#20160714
  9. 9. @mamohacy#20160714 やってられるかァ!
  10. 10. @mamohacy#20160714 ってことで Billing Alert を Lambda で 拡張してみました
  11. 11. 10 純正Billing Alert機能の特徴  親の介在が必須  子側が簡単に扱えない @mamohacy#20160714 純正Billing Alertの特徴 要マネコン 予算管理機能使えるのは親側だけ 期間指定による閾値設定は出来ない アラーム通知は閾値超過後の1回のみ
  12. 12. 11 純正Billing Alert機能の特徴  親の介在は初期セットアップ時のみ  子側が簡単に扱える @mamohacy#20160714 拡張版Billing Alertの特徴 マネコン不要 子側で設定ファイルを作りS3アップロードすればOK 月初からの経過日数毎に閾値を設定可能(Max31段階) 閾値超過時は設定直すまで1時間おきにアラーム通知
  13. 13. 12 アーキテクチャ @mamohacy#20160714 S3 bucket User confi g set billing alarm reset alarm status Billing Alert CloudWatch email notification SNS upload invoke notify create 0:00/daily 0:00/hourly invoke invoke alarm アラーム状態の リセット Billing Alertの セット
  14. 14. 13 config • 日毎に段階的に予算設定が可能 (最大31段階) • 実証実験中、負荷試験中、S-in、 キャンペーンなどのイベントに 合わせて予算を決め、ユーザー が自分自身でテキストファイル をS3に保存する • configファイルを置かなければ Alert処理は無効になる @mamohacy#20160714 #day, threshold(USD) 10, 200 20, 400 ・・・・ 31, 600 aws_budget.txt
  15. 15. reset-alarm-status.py set-billing-alarm.py @mamohacy#20160714 コア・プログラム 43 steps(*include comments) 183 steps(*include comments)
  16. 16. 15 ポイント その1 @mamohacy#20160714 cw_alarm_description = cw_alarm_description.replace("%THRESHOLD%", threshold) cw_alarm_action = cw_alarm_action.replace("%ACCOUNT_ID%", account_id) #Alarmの設定 response = cloud_watch.put_metric_alarm(AlarmName=cw_alarm_name, AlarmDescription=cw_alarm_description, ActionsEnabled=True, AlarmActions=[cw_alarm_action], Namespace=cw_metric_namespace, MetricName=cw_metric_name, Statistic='Maximum', Dimensions=[ {'Name': 'Currency’, 'Value': 'USD’}, {'Name': 'LinkedAccount’, 'Value': account_id } ], Period=21600, EvaluationPeriods=1, Threshold=int(threshold), ComparisonOperator='GreaterThanThreshold' ) set-billing-alarm.py configから読ん だ閾値をalarmに セット
  17. 17. 16 ポイント その2 @mamohacy#20160714 alarm_name="Estimated Charges” # 実施要否判定() response = cloud_watch.describe_alarms(AlarmNames=[alarm_name], StateValue='ALARM’) if len(response['MetricAlarms']) <= 0: return 0 # アラームステータスをリセット(強制的にアラームじゃない状態に戻す) response = cloud_watch.set_alarm_state(AlarmName=alarm_name, StateValue='INSUFFICIENT_DATA', StateReason='’,StateReasonData='{}’) return 0 reset-alarm-status.py 閾値超えてれば 即座にアラームが 発生!
  18. 18. 17 拡張版 Billng Alertの導入効果 親による一括予算管理が不要に 有効化/無効化の設定も子側で Alert通知後の判断も子側からスタート (設定修正漏れ/恣意的/バグ/障害 etc...) 親アカウント側の予算管理&BillingBurst対応工数が 「実質ゼロ」に! @mamohacy#20160714
  19. 19. @mamohacy#20160714

×