完了確認
Cloud9環境のオーナーのARNを取得します。
コマンド:
cloud9_environment_owner_arn=$( \
  aws sts get-caller-identity \
    --query 'Arn' \
    --output text \
) \
  && echo ${cloud9_environment_owner_arn}
結果(例):
arn:aws:iam::XXXXXXXXXXXX:user/handson-cloud9-user
「Cloud9環境名"handson-cli-env"が存在する。」ことを確認します。
コマンド:
for i in \
  $(
    aws cloud9 list-environments \
      --query "environmentIds" \
      --output text
  )
do
    aws cloud9 describe-environments \
      --environment-ids ${i} \
      --query "environments[? \
          name == \`${CLOUD9_ENVIRONMENT_NAME}\` \
            && ownerArn == \`${cloud9_environment_owner_arn}\` \
        ].name" \
      --output text
done
結果(例):
Cloud9環境IDを取得します。
コマンド:
cloud9_environment_id=$(
  for i in \
    $(
      aws cloud9 list-environments \
        --query "environmentIds" \
        --output text
    )
  do
      aws cloud9 describe-environments \
        --environment-ids ${i} \
        --query "environments[? \
            name == \`${CLOUD9_ENVIRONMENT_NAME}\` \
              && ownerArn == \`${cloud9_environment_owner_arn}\` \
          ].id" \
        --output text
  done
) \
  && echo ${cloud9_environment_id}
結果(例):
「Cloud9環境名"handson-cli-env"のステータスが"Ready"である。」ことを確認します。
コマンド:
aws cloud9 describe-environment-status \
  --environment-id ${cloud9_environment_id} \
  --query 'status' \
  --output text
結果(例):