Skip to Content
AWS クックブック
book

AWS クックブック

by John Culkin, Mike Zazon
March 2025
Intermediate to advanced
358 pages
5h 26m
Japanese
O'Reilly Media, Inc.
Book available
Content preview from AWS クックブック

付録 迅速な修正

これらの便利なちょっとしたコードは、、時間を節約し、AWSを最大限に活用するのに役立つだろう。

AWS_ACCOUNT_ID をbash変数にセットする:

export AWS_ACCOUNT_ID=$(aws sts get-caller-identity \
--query Account --output text)

最近作成されたCloudWatchロググループ名を取得する:

aws logs describe-log-groups --output=yaml \
--query 'reverse(sort_by(logGroups,&creationTime))[:1].{Name:logGroupName}'

CloudWatchグループのログを :

aws logs tail <<LOGGROUPNAME>> --follow --since 10s

テキストパターンにマッチするすべてのロググループを削除し、確認のため yes/no を prompt する:

aws logs describe-log-groups | \
jq ".logGroups[].logGroupName" | grep -i <<pattern>> | \
xargs -p -I % aws logs delete-log-group --log-group-name %

現在作業しているリージョンについて、実行中のインスタンスをすべて停止する(H/T: Curtis Rissi):

aws ec2 stop-instances \
--instance-ids $(aws ec2 describe-instances \
--filters "Name=instance-state-name,Values=running" --query "Reservations[].Instances[].[InstanceId]"
--output text | tr '\n' ' ')

CLI呼び出しを行うユーザを決定する:

aws sts get-caller-identity --query UserId --output text

、CLIコマンド、YAML入力を生成して使う:

aws ec2 create-vpc --generate-cli-skeleton yaml-input > input.yaml
#Edit input.yaml - at a minimum modify CidrBlock, DryRun, ResourceType, and Tags
aws ec2 create-vpc --cli-input-yaml file://input.yaml

AWSリージョンの名前 とエンドポイントを表形式でリストアップする:

aws ec2 describe-regions --output table

現在使用している Region のインタフェース VPC エンドポイント を発見する:

aws ec2 describe-vpc-endpoint-services \
--query ServiceDetails[*].ServiceName

のデータを DynamoDB テーブルに投入する:

aws ddb put table_name '[{key1: value1}, {key2: value2}]'

特定のデータベースエンジン(例:aurora-postgresql)で現在サポートされている ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

AWS Lambdaのプログラミング

AWS Lambdaのプログラミング

John Chapin, Mike Roberts
入門 Kubernetes

入門 Kubernetes

Kelsey Hightower, Brendan Burns, Joe Beda, 松浦 隼人
Terraform クックブック

Terraform クックブック

Kerim Satirli, Taylor Dolezal

Publisher Resources

ISBN: 9798341635456Supplemental Content