SlideShare a Scribd company logo
CloudFrontのCLI tips
自己紹介
名前:富松 広太(とみまつ こうた)
Blog:https://cloud-aws-gcp.hateblo.jp/
twitter:@kotamemento
所属:株式会社 Turn and Frontier(関西クラウドベンダー)
2020 APN ALL AWS Certifications Engineer
from:滋賀県
cloudfrontを変更する時の話
cloudfrontの設定変更して欲しい
xxxとxxとxxxxxxx
コード管理されていない環境だけど
設定のsnapshot的なものを取りたい
切戻簡単にやりたい
テスト環境との差異確認したい
cloudfrontを変更する時の話
cloudfrontの設定変更して欲しい
xxxとxxとxxxxxxx
コード管理されていない環境だけど
設定のsnapshot的なものを取りたい
切戻簡単にやりたい
テスト環境との差異確認したい
#設定(の断面)を取得する
aws cloudfront get-distribution-config
#configファイルを元にcloudfrontを設定する
aws cloudfront update-distribution
CLI使うと便利かも
設定(の断面)を取得する
aws cloudfront get-distribution-config
変更前
Cloud
Front
json(変更前)
実際のコマンド
cfid="xxxxxxxxxxx"
aws cloudfront get-distribution-config --id ${cfid}| jq ".DistributionConfig" >${cfid}_`date
+%Y%m%d`_before.json
変更を適応
#変更後の設定を取得する
aws cloudfront get-distribution-config --id ${cfid}| jq ".DistributionConfig" >${cfid}_`date
+%Y%m%d`_after.json
#差異を確認(テスト環境と比較時は環境差異あり)
diff ${cfid}_`date +%Y%m%d`_before.json ${cfid}_`date +%Y%m%d`_after.json
変更後
Cloud
Front
json(変更前)
json(変更後)
切り戻し
実際のコマンド
etag=$(aws cloudfront get-distribution-config --id ${cfid} | jq -r '.ETag')
aws cloudfront update-distribution --id ${cfid} --if-match ${etag} --distribution-config
file://./${cfid}_`date +%Y%m%d`_before.json
Cloud
Front
json(変更前)
json(変更後)
#切戻時
configファイルを元にcloudfrontを設定する
aws cloudfront update-distribution
まとめ
#設定のバックアップを取得する
cfid="xxxxxxxxxxx"
aws cloudfront get-distribution-config --id ${cfid}| jq ".DistributionConfig" >${cfid}_`date
+%Y%m%d`_before.json
#変更する
#変更後の設定を取得する
aws cloudfront get-distribution-config --id ${cfid}| jq ".DistributionConfig" >${cfid}_`date
+%Y%m%d`_after.json
#差異を確認
diff ${cfid}_`date +%Y%m%d`_before.json ${cfid}_`date +%Y%m%d`_after.json
#切り戻ししたい時
etag=$(aws cloudfront get-distribution-config --id ${cfid} | jq -r '.ETag')
aws cloudfront update-distribution --id ${cfid} --if-match ${etag} --distribution-config
file://./${cfid}_`date +%Y%m%d`_before.json

More Related Content

PDF
Cloudnative online-2021-stepfunction
PDF
AWS Client VPN
PDF
ElasticCloud
PDF
jaws aws-nuke
PDF
Aws organization multi_accounts
PDF
aws kms poiints
PDF
aws-Organizations-aroud
PDF
jaws securityhub
Cloudnative online-2021-stepfunction
AWS Client VPN
ElasticCloud
jaws aws-nuke
Aws organization multi_accounts
aws kms poiints
aws-Organizations-aroud
jaws securityhub

What's hot (20)

PDF
[AKIBA.AWS] VPCをネットワーク図で理解してみる
PDF
Serverless ArchitectureにおけるNoSQL Services 〜DynamoDBも良いけどSimpleDBも忘れないであげてください!!〜
PPTX
Aws certificate managerを使ってみたよ
PDF
VPC Reachability Analyzer 使って人生が変わった話
PPTX
Amazon EKS への道 ~入門編~
PPTX
アウトプットはスキルアップもするしトクもする
PPTX
AWS認定クラウドプラクティショナー 書くときに意識してたこととか
PDF
re:Growth 2021 コンピュートサービスの進化を語る
PPTX
AWS Premier Night #2 in Osaka『Amazon Elasticsearch Serviceのおもしろい使い方』
PPTX
re:growth2019_transitgateway
PDF
What's new with Serverless
PDF
20200623 Client VPNの使いどころ
PDF
OpsJAWS 20160128
PDF
四国クラウドお遍路20141004
PDF
AWSカルタで楽しくAWSサービスを覚えよう
PPTX
20150901 ops jaws_araya_v2
PPTX
re:Invent 2021のS3アップデート紹介 & Glacier Instant Retrieval試してみた
PPTX
Raspberry Piを利用した顔の表情分析と感情を認識するシステム構築
PDF
JAWSUG札幌-社内環境見える化計画
PDF
Ops jaws meetup#3
[AKIBA.AWS] VPCをネットワーク図で理解してみる
Serverless ArchitectureにおけるNoSQL Services 〜DynamoDBも良いけどSimpleDBも忘れないであげてください!!〜
Aws certificate managerを使ってみたよ
VPC Reachability Analyzer 使って人生が変わった話
Amazon EKS への道 ~入門編~
アウトプットはスキルアップもするしトクもする
AWS認定クラウドプラクティショナー 書くときに意識してたこととか
re:Growth 2021 コンピュートサービスの進化を語る
AWS Premier Night #2 in Osaka『Amazon Elasticsearch Serviceのおもしろい使い方』
re:growth2019_transitgateway
What's new with Serverless
20200623 Client VPNの使いどころ
OpsJAWS 20160128
四国クラウドお遍路20141004
AWSカルタで楽しくAWSサービスを覚えよう
20150901 ops jaws_araya_v2
re:Invent 2021のS3アップデート紹介 & Glacier Instant Retrieval試してみた
Raspberry Piを利用した顔の表情分析と感情を認識するシステム構築
JAWSUG札幌-社内環境見える化計画
Ops jaws meetup#3
Ad

Similar to Cloudfront cli tips (14)

PDF
20201028 AWS Black Belt Online Seminar Amazon CloudFront deep dive
PDF
CloudStack User Inferface
PDF
コンテナ時代にインフラエンジニアは何をするのか
PDF
Openstack+Ceph設定ガイド
PDF
#cross2012 クラウドCROSS ニフティの中の人によるニフティクラウド活用
PDF
AWS Black Belt Techシリーズ AWS Command Line Interface
PDF
ニフティクラウドを使った安定運用のススメ
PDF
Develipers.IO 2016 E-1 「AWS Configを使ったAWS環境の見える化」
PDF
Rancher/Kubernetes入門ハンズオン資料~第2回さくらとコンテナの夕べ #さくらの夕べ 番外編
PPTX
Citrix eco new
PPTX
CloudFront最近の事例と間違った使い方
PDF
Acm2.1 short public
PDF
NCstudy 2.5
PDF
[AWSマイスターシリーズ] Amazon CloudFront / Amazon Elastic Transcoderによるコンテンツ配信
20201028 AWS Black Belt Online Seminar Amazon CloudFront deep dive
CloudStack User Inferface
コンテナ時代にインフラエンジニアは何をするのか
Openstack+Ceph設定ガイド
#cross2012 クラウドCROSS ニフティの中の人によるニフティクラウド活用
AWS Black Belt Techシリーズ AWS Command Line Interface
ニフティクラウドを使った安定運用のススメ
Develipers.IO 2016 E-1 「AWS Configを使ったAWS環境の見える化」
Rancher/Kubernetes入門ハンズオン資料~第2回さくらとコンテナの夕べ #さくらの夕べ 番外編
Citrix eco new
CloudFront最近の事例と間違った使い方
Acm2.1 short public
NCstudy 2.5
[AWSマイスターシリーズ] Amazon CloudFront / Amazon Elastic Transcoderによるコンテンツ配信
Ad

More from kota tomimatsu (7)

PDF
aws-multiaccount-notify
PDF
aws health organizations notifications
PDF
Aws github-actions-with-role
PDF
Jaws controltower
PDF
AWS Client vpn pattern
PDF
Organizations周りの機能
PDF
ClientVPNとPrivateca
aws-multiaccount-notify
aws health organizations notifications
Aws github-actions-with-role
Jaws controltower
AWS Client vpn pattern
Organizations周りの機能
ClientVPNとPrivateca

Cloudfront cli tips