(pythonは入っているのでスクリプトやってもいいのだけれど…。)
curl -o jq https://github.com/stedolan/jq/releases/download/jq-1.6/jq-linux64
chmod 755 jq
jq_path=./jq
resource_type="AWS::EC2::Instance"
instances=$(aws configservice list-discovered-resources --resource-type ${resource_type} | ${jq_path} -r '.resourceIdentifiers[].resourceId')
for i in $instances
do
aws configservice get-resource-config-history --resource-type ${resource_type} --limit 1 --resource-id $i | ${jq_path} -r '.configurationItems[].configuration'
done > result-${resource_type}.json
Cloud9のWebUI Terminalがどうも手になじまないので外部からSSHして動かしているからかもだが、こんなエラーにちょくちょく遭遇する。
An error occurred (ExpiredTokenException) when calling the ListDiscoveredResources operation: The security token included in the request is expired
こういう場合は、マネジメントコンソールからCloud9 IDEにアクセスしてOpen IDEする。