AWS cli - check if user is logged in in shell script

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
veera
Posts: 1
Joined: Fri Oct 28, 2022 6:45 am

AWS cli - check if user is logged in in shell script

Post by veera » Fri Oct 28, 2022 7:01 am

Trying to build a simple shell script - but in order to run AWS cli commands like aws ssm start-session I first need to check if the user is logged in. How can I do this in a shell script with the aws cli?

Code: Select all

#!/usr/bin/env bash

# if no sso access token, do login
if [!aws sts get-caller-identity]
    aws sso login


# my script
aws ssm start-session ......

Klaus
Posts: 14191
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: AWS cli - check if user is logged in in shell script

Post by Klaus » Fri Oct 28, 2022 11:27 am

This is a forum for users of LIVECODE: https://livecode.com
If you do not use Livecode for programming, then you are at the wrong place.

Post Reply