# Auto Scalingグループの情報を取得し、CSVファイルに直接書き込む
aws autoscaling describe-auto-scaling-groups \
--query "AutoScalingGroups[*].{AutoScalingGroupName:AutoScalingGroupName, LaunchTemplateId:LaunchTemplate.LaunchTemplateId, Version:LaunchTemplate.Version}" \
--output json | \
jq -r '.[] | [.AutoScalingGroupName, .LaunchTemplateId, .Version] | @csv' > autoscaling_groups.csv
aws ec2 describe-launch-template-versions \
--launch-template-id <LaunchTemplateId> \
--versions <Version> \
--query "LaunchTemplateVersions[*].[LaunchTemplateId, Version, LaunchTemplateData.ImageId]" \
--output text | \
awk '{print $1","$2","$3}' > launch_template_ami_info.csv