0

I am currently writing a number of shell scripts which will run both on an Amazon Workspaces Linux instance and elsewhere on other Linux hosts (e.g. Amazon Linux EC2 instances).

I would like to have certain Bash variable values configured differently depending on whether or not a given script is being run on a WorkSpaces instance.

Given this, I was wondering if there is a way of checking at the OS level whether the host is an Amazon WorkSpace or not?

PicoutputCls
  • 1,392
  • 1
  • 12
  • 24
  • 1
    Maybe there is something relevant in [instance metadata](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instancedata-data-retrieval.html)? – bgdnlp Mar 30 '22 at 16:58
  • I had thought about this but in this case the instance metadata isn't readable due to firewall restrictions. – PicoutputCls Mar 31 '22 at 07:25

1 Answers1

0

Although possibly not fail proof, one method of identifying whether a Linux host is one of the Amazon Linux WorkSpaces hosts is to look for the presence of the /usr/share/icons/amazon-workspaces directory where the icon assets for MATE window manager theme are stored.

PicoutputCls
  • 1,392
  • 1
  • 12
  • 24