Skip to content

Instantly share code, notes, and snippets.

jsyi / eb-environment-arn
Created January 5, 2018 09:50
List AWS Elastic Beanstalk Environment ARNs
aws elasticbeanstalk describe-environments | jq ".Environments[].EnvironmentArn"
jsyi /
Last active July 11, 2024 01:12
Use AWS CLI to query AWS CloudWatch Logs and determine the most recent entry into a Log Group
aws logs describe-log-groups | jq ".logGroups[].logGroupName" | grep -E "homeplus|mcdonalds" | xargs -n 1 -t aws logs describe-log-streams --query "logStreams[*].lastEventTimestamp" --log-group | jq "max/1000|floor" | xargs -t -n 1 date -r
# aws logs describe-log-groups | jq ".logGroups[].logGroupName"
# Get LogGroup names
# grep -E "homeplus|mcdonalds"
# (Optional) Filter LogGroup names
# xargs -n 1 -t aws logs describe-log-streams --query "logStreams[*].lastEventTimestamp" --log-group | jq "max/1000|floor"
# Get last event timestamp for each LogGroup.
jsyi /
Created November 27, 2017 07:17
Bamboo build task script for updating Github branch status after build/tests are complete.
cd ${}
[[ $REPO_URL =~\/(.*).git ]]
if ls **/test-reports/*.xml 1> /dev/null 2>&1; then
curl -H "Authorization: token ${bamboo.githubStatusUpdateTokenForMeshkoreaDev}" --request POST --data '{"state": "success", "context": "bamboo/build", "description": "Bamboo build Completed!", "target_url": "${bamboo.buildResultsUrl}"}' $STATUS_UPDATE_URL > /dev/null
jsyi /
Last active November 27, 2017 07:14
See how many application versions each Elastic Beanstalk application is using from the command line. Useful for monitoring how close we are to AWS Service Limits.
# Requires AWS CLI Tools ( and jq (
# AWS CLI must be configured with access key with approperiate role/permissions
aws elasticbeanstalk describe-application-versions --query "ApplicationVersions[*].ApplicationName" | jq '{"total": length, "lists": group_by(.)} | {"Applications": [ (.lists[] | {"Application": .[0], "Versions": length })], "Total Versions": .total }'