Tail Lambda/CloudWatch logs

Live-stream a log group like tail -f. modern: replaces clunky filter-log-events polling

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

    Test if a principal can do an action before granting; explains allow/deny

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

    Fetch a JSON secret and extract one field. note: value appears in process args

  • 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 current spot 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

    Idempotent deploy; CAPABILITY_NAMED_IAM required when 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 using length(); --profile/--region scope it

all 14 aws commands