From fcf3fe658853c593f1a8bb44c0245d7e911bff47 Mon Sep 17 00:00:00 2001 From: Michele Cereda Date: Sun, 8 Dec 2024 17:59:11 +0100 Subject: [PATCH] chore(snippets): improve exemplary commands --- snippets/aws/other commands.fish | 37 +++++++++++++++++++++++++++++--- 1 file changed, 34 insertions(+), 3 deletions(-) diff --git a/snippets/aws/other commands.fish b/snippets/aws/other commands.fish index cd4956a..0430dd3 100644 --- a/snippets/aws/other commands.fish +++ b/snippets/aws/other commands.fish @@ -24,6 +24,19 @@ aws autoscaling cancel-instance-refresh --auto-scaling-group-name 'ProductionSer aws autoscaling rollback-instance-refresh --auto-scaling-group-name 'ProductionServers' +### +# Cognito +# ------------------ +### + +# List user pools +# '--max-results' is required (ノಠ益ಠ)ノ彡┻━━┻ +aws cognito-idp list-user-pools --max-results '10' --query 'UserPools' + +# List users in pools +aws cognito-idp list-users --user-pool-id 'eu-west-1_lrDF9T78a' --query "Users[?Username=='john']" + + ### # ECR # ------------------ @@ -61,11 +74,13 @@ aws ecr list-images --registry-id '012345678901' --repository-name 'cache/docker # ------------------ ### -aws ecs list-tasks --cluster 'testCluster' --family 'testService' --output 'text' --query 'taskArns' \ -| xargs -p aws ecs wait tasks-running --cluster 'testCluster' --tasks +aws ecs list-tasks --query 'taskArns' --output 'text' --cluster 'testCluster' --service-name 'testService' + +aws ecs list-tasks --output 'text' --query 'taskArns' --cluster 'testCluster' --family 'testService' \ +| xargs -t aws ecs wait tasks-running --cluster 'testCluster' --tasks while [[ $$(aws ecs list-tasks --query 'taskArns' --output 'text' --cluster 'testCluster' --service-name 'testService') == "" ]]; do sleep 1; done -@aws ecs list-task-definitions --family-prefix 'testService' --output 'text' --query 'taskDefinitionArns' \ +aws ecs list-task-definitions --family-prefix 'testService' --output 'text' --query 'taskDefinitionArns' \ | xargs -pn '1' aws ecs deregister-task-definition --task-definition aws ecs list-tasks --query 'taskArns' --output 'text' --cluster 'testCluster' --service-name 'testService' \ @@ -74,6 +89,16 @@ aws ecs list-tasks --query 'taskArns' --output 'text' --cluster 'testCluster' -- | tee \ | xargs -I{} curl -fs "http://{}:8080" +# Show information about services +aws ecs describe-services --cluster 'stg' --services 'grafana' + +# Wait for services to be up and running +# Shortcut with polling for `aws ecs describe-services … +# --query 'length(services[?!(length(deployments) == "1" && runningCount == desiredCount)]) == 0'`. +# Polls every 15 seconds until a successful state has been reached, or 40 checks failed. +# Exits with return code 255 after 40 failed checks. +aws ecs wait services-stable --cluster 'stg' --services 'grafana' + ### # EKS @@ -140,6 +165,12 @@ aws ec2 describe-network-interfaces --output 'text' \ # ------------------ ### +# Get users' information +aws iam get-user --user-name 'michele' + +# Get information about user's console login capabilities +aws iam get-login-profile --user-name 'john' --query 'LoginProfile' + # Get all users' access keys aws iam list-users --no-cli-pager --query 'Users[].UserName' --output 'text' \ | xargs -n1 aws iam list-access-keys --output 'json' --user