Follow Lambda and CloudWatch logs

Stream a log group like tail -f. Much easier than polling with filter-log-events

aws logs tail /aws/lambda/<name> --follow --since 10m --format short

tool
aws14 commands
tags
awsobservabilitydebug

More aws commands

  • aws iam simulate-principal-policy --policy-source-arn <id> --action-names s3:GetObject --resource-arns <id> --query 'EvaluationResults[].{action:EvalActionName,decision:EvalDecision}' --output table

    Check if a principal can do an action before you grant access. Shows allow or deny

  • aws secretsmanager get-secret-value --secret-id <name> --query SecretString --output text | jq -r '.password'

    Get a JSON secret and extract one field. Note: the password is printed to the terminal

  • aws ec2 describe-spot-price-history --instance-types m6i.large --product-descriptions 'Linux/UNIX' --start-time $(date -u +%Y-%m-%dT%H:%M:%S) --query 'sort_by(SpotPriceHistory,&SpotPrice)[0:5].[AvailabilityZone,SpotPrice]' --output table

    Sort the current spot price history to find the cheapest AZ for an instance type

  • aws cloudformation deploy --template-file stack.yaml --stack-name <name> --capabilities CAPABILITY_NAMED_IAM --parameter-overrides Env=prod --no-fail-on-empty-changeset

    A deploy that is safe to repeat. CAPABILITY_NAMED_IAM is required when the template creates IAM roles

  • aws ec2 describe-volumes --filters Name=status,Values=available --query 'length(Volumes[])' --output text --profile staging --region <id>

    Count unattached EBS volumes in one call with length(). --profile and --region set the scope

all 14 aws commands