EC2-classic: クラシックネットワークの廃止


ec2-classic-resource-finder: ec2-classicのリソースを探し、CSV出力する

インストール:

git clone https://github.com/aws-samples/ec2-classic-resource-finder.git
cd ec2-classic-resource-finder/
chmod +x *.sh

1 アカウントのみ:

export AWS_PROFILE=user1-readonly
./Classic-Resource-Finder.sh

# 出力CSV
Classic_Auto_Scaling_Groups.csv
Classic_ClassicLink_VPCs.csv
Classic_CLBs.csv
Classic_EC2_Instances.csv
Classic_EIPs.csv
Classic_ElastiCache_Clusters.csv
Classic_OpsWorks_Stacks.csv
Classic_Platform_Status.csv
Classic_RDS_Instances.csv
Classic_Redshift_Clusters.csv
Classic_SGs.csv

organization account:

export AWS_PROFILE=org-user1
./multi-account-wrapper.sh -r my-assume-role-readonly -f "Classic-Resource-Finder.sh"

未使用EIPの列挙と削除

profile=example
region=ap-northeast-1

# EC2-Classicかつ、ec2で使ってないEIPを列挙
aws ec2 describe-addresses --filters "Name=domain,Values=standard" "Name=instance-id,Values=" --profile $profile --region $region > ${profile}.${region}.eip.json

# EIP削除
jq -r '.Addresses[].PublicIp' ${profile}.${region}.eip.json | xargs -i aws ec2 release-address --public-ip {} --profile $profile --region $region

トップ   編集 凍結 差分 バックアップ 添付 複製 名前変更 リロード   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS
Last-modified: 2022-08-10 (水) 12:17:40