Closed travisnburton closed 2 years ago
Hi @travisnburton,
Which version of aws cli is installed?
aws --version
Does running the following command manually work?
aws s3 cp s3://arcgisstore-us-east-1/10.9.1/setups/Portal_for_ArcGIS_Linux_1091_180199.tar.gz /opt/software/archives/Portal_for_ArcGIS_Linux_1091_180199.tar.gz --region us-east-1
Also, which OS Platform and version is the EC2 instance, Ubuntu 18.04 LTS, Ubuntu 20.04 LTS, or RHEL?
Thanks, Cameron K.
[root@portal-1 ~]# aws --version
aws-cli/2.7.12 Python/3.9.11 Linux/4.18.0-372.9.1.el8.x86_64 exe/x86_64.rhel.8 prompt/off
[root@portal-1 ~]# aws s3 cp s3://arcgisstore-us-east-1/10.9.1/setups/Portal_for_ArcGIS_Linux_1091_180199.tar.gz /opt/software/archives/Portal_for_ArcGIS_Linux_1091_180199.tar.gz --region us-east-1
Completed 1.4 GiB/3.8 GiB (207.2 MiB/s) with 1 file(s) remaining
System Info:
------------
chef_version=15.17.4
platform=redhat
platform_version=8.6
ruby=ruby 2.6.7p197 (2021-04-05 revision 67941) [x86_64-linux]
program_name=/opt/cinc/bin/cinc-client
executable=/opt/cinc/bin/cinc-client
Thanks @travisnburton for sharing those details. Are you running ciic-client
as root, or as the ec2-user
(or other user) with sudo?
Thanks, Cameron K
Hi @cameronkroeker - cinc-client is being executed from an SSM document:
{
"action": "aws:runShellScript",
"name": "DownloadSoftwareAndLicense",
"inputs": {
"runCommand": [
"aws s3 cp s3://{{ S3Bucket}}/{{ ServerType }}/cinc-s3files.json /opt/cinc/s3files.json",
"aws s3 cp s3://{{ S3Bucket}}/common/license.json /opt/software/licenses/license.json",
"sudo /opt/cinc/bin/cinc-client -z -j /opt/cinc/s3files.json --config-option \"cookbook_path=/opt/cinc/cookbooks\""
]
}
},
So the client is executed by user ssm-agent
with sudo.
I assumed the failure was with the arcgis user, which is defined in the client configuration file "run_as_user" : "arcgis".
However, your comment made me turn to sudo, which is where the problem lies.
sh-4.4$ whoami
ssm-user
sh-4.4$ sudo aws --version
sudo: aws: command not found
sh-4.4$ sudo echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin
sh-4.4$ sudo which aws
which: no aws in (/sbin:/bin:/usr/sbin:/usr/bin)
Symlinking to /usr/bin solved the issue:
sh-4.4$ sudo ln -s /usr/local/bin/aws /usr/bin/aws
sh-4.4$ sudo which aws
/bin/aws
sh-4.4$ sudo /opt/cinc/bin/cinc-client -z -j /opt/cinc/s3files.json --config-option cookbook_path=/opt/cinc/cookbooks
[2022-06-30T21:38:39+00:00] WARN: No config file found or specified on command line. Using command line options instead.
Starting Cinc Client, version 15.17.4
resolving cookbooks for run list: ["arcgis-repository::s3files2"]
Synchronizing Cookbooks:
- arcgis-repository (3.8.0)
- s3_file (2.8.5)
Installing Cookbook Gems:
Compiling Cookbooks...
Converging 3 resources
Recipe: arcgis-repository::s3files2
* directory[/opt/software/archives] action create (up to date)
* execute[Download Portal_for_ArcGIS_Linux_1091_180199.tar.gz] action run
....
Thanks again for all your help!
Ah ha! Great find @travisnburton. Glad to hear the issue is resolved by symlinking /usr/bin, thanks for sharing. Yeah the setups are not downloaded as "run_as_user" because in theory this account may not yet exist (gets created in the system recipe which is not defined in the s3files). But definitely see how that is confusing.
Happy Automating, Cameron K.
Unable to execute awscli commands via recipe arcgis-repository::s3files2
Cinc output below, followed by verification of aws binary and $PATH for arcgis user ("run_as_user" : "arcgis")