Unable to install AWS SAM Cli on Mac - amazon-web-services

I am trying to install AWS SAM Cli on my Mac because I am trying to learn the AWS services. But I have installed the AWS cli successful using bundle. But when I tried to install the AWS SAM Cli as well. But it is not working. This is what I have done so far.
Run this command
pip install --user aws-sam-cli
Everything went fine.
Then I opened and edited the ~/.bash_profile. This is the content of the .bash_profile
export PATH=/Applications/MAMP/bin/php/php7.2.7/bin:$PATH
# Find your Python User Base path (where Python --user will install packages/scripts)
$ USER_BASE_PATH=$(python -m site --user-base)
# Update your preferred shell configuration
-- Standard bash --> ~/.bash_profile
-- ZSH --> ~/.zshrc
export PATH=$PATH:$USER_BASE_PATH/bin
Then I closed the terminal and run sam --version.
It is saying command not found. What is wrong with my installation?

The now recommended way to install SAM CLI is to use brew and honestly it's way better, saves you a lot of headaches, like the one you're facing now. See these instructions for details.

Related

AWS CLI VERSION UPGRADE

I have installed AWS CLI latest version using "sudo pip install --upgrade awscli " .
this has successfully updated my aws cli version but for only root users, but for all remaining users , it is showing version as previous one only, If I run the command without sudo then its saying permission denied.
If my server has multiple linux users and want to update my aws cli version from 1.16.3 to 1.18.223 for all users, how can I do it ?
Please help me .
Thank in advance
You can adjust the path where you want to install, the binary.
Install the AWS CLI version 1 using the bundled installer with sudo
curl "https://s3.amazonaws.com/aws-cli/awscli-bundle-1.18.223.zip" -o "awscli-bundle.zip"
unzip awscli-bundle.zip
sudo ./awscli-bundle/install -i /usr/local/aws -b /usr/local/bin/aws
Just curious when you are upgrading the AWS Cli why not the latest which is backward compatible and probaly more options
Try not to install pip packages with sudo. Better use a Creating virtual environments

Missing AWS Dependency

i had a case where i need to configure an AWS structure similar to the architecture that is described in this article, is but this article is old, when i followed the steps i couldn't pass the step at which i run the script "vip_monitor.sh".
so be specific, at the step 5 by running the script i got the following error
Can't open /etc/profile.d/aws-apitools-common.sh
that shell script doesn't exist in the whole machine, how to solve this issue?
Thanks in advance
You will have to set api tools manually.
Ubuntu makes their own AMI's for Amazon, and they don't build the apitools into the images.
You can use official ubuntu documentation to fix these:
Install ec2 api tools
sudo apt-add-repository ppa:awstools-dev/awstools
sudo apt-get update
sudo apt-get install ec2-api-tools
actually i installed the ec2-api-tools J.Parashar instructed, and when i ran the script vip_monitor.sh it gave me the same error so i just took the missing script aws-apitools-common.sh file from an Amazon Linux instance and paste it at the path /etc/profile.d/ and then changed the mode to the script to executable chmod +x aws-apitools-common.sh and ran the script 'vip_monitor.sh'.
if you had the error :Unexpected operator run the script with bash ./vip_monitor.sh

AWS cli installation on Mac with anaconda python

I am installing aws cli on Mac. Previously I installed anaconda to control my python versions. So I installed python using conda. Now I want to install aws cli.
By using pip:
pip3 install awscli --upgrade --user
The installation was successful. However, when I run
aws --version
It told me that aws command was not found.
I again tried to add it to the command line path. But I could not find where it was installed.
When I run
which python
It gave me
/anaconda/bin/python
People say this might not be the real folder and it is true I could not find aws cli under it either.
I then run
ls -al /anaconda/bin/python
It gives
lrwxr-xr-x 1 mac staff 9 Aug 15 20:14 /anaconda/bin/python -> python3.6
I dont understand the path at all.
How could I find where my aws cli installed?
I ran into the same issue and eventually found the awscli command in ~/.local/bin. Just add /Users/<username>/.local/bin to your $PATH.
You can do this by editing ~/.bash_profile, which probably already has these lines in it:
# added by Anaconda3 4.4.0 installer
export PATH="/Users/<username>/anaconda/bin:$PATH"
You could make another copy of this line but replace the anaconda path with the new one, but I just updated the existing path since the two are related:
# added by Anaconda3 4.4.0 installer
export PATH="/Users/<username>/.local/bin:/Users/<username>/anaconda/bin:$PATH"
I solved the problem by using conda to install awscli.
conda install -c conda-forge awscli
worked so far. It seems that pip install does not work for conda installed python... Is this conclusion true?
If it's installing and then saying "command not found" it probably just means that the executable it has installed is not referenced in the operating systems PATH environment variable.
Here is how to add the downloaded executable to PATH: https://docs.aws.amazon.com/cli/latest/userguide/cli-install-macos.html#awscli-install-osx-path
Here is the AWS docs to troubleshoot the issue: https://docs.aws.amazon.com/cli/latest/userguide/troubleshooting.html
I encountered an identical situation.
I solved this by adding the location of the awscli command to the file...
/etc/paths
The location to my awscli command was where others had found it...
~/.local/bin
From my home directory in Mac OS X Terminal, I entered a quick nano command to edit the /etc/paths file...
sudo nano /etc/paths
#For those who don't know...
#sudo is to get admin access
#nano is quick and dirty file editor.
# /etc/paths is the file you want to edit.
I entered my password, then I just added the awscli command location at the end of the file...
/Users/UpAndAtThem/.local/bin
Yours might be be...
/Users/your_username_here/.local/bin
Still in Nano editor to exit and save: Hit control+X > Hit Y > Hit Enter.
Here's a quick video...
https://youtu.be/htb_HTwtgmk
Good luck!

error in running `pip install aws cli`: "could not find a version that satisfies the requirement cli"

I'm on a Windows based machine using GitBash for my shell. When I run, pip install aws cli, I get the following message:
Could not find a version that satisfies the requirement cli (from versions: ) No matching distribution found for cli
I Googled the error, and many responses indicate that it's can be the result of a package that's not contained in pypi, etc. (Pip install-couldn't find a version that satisfies the requirement).
However, since I'm following the video here: http://course.fast.ai/lessons/aws.html at 4:13, and it worked for the instructor, I'm not sure what I'm missing - can someone help me understand this (including any helpful troubleshooting commands to identify the source of the issue?)
I'm new to AWS and also bash so I apologize if this is a relatively elementary question.
Thanks in advance!
-Ryan
The command should be:
pip install awscli
You need to remove the space between 'aws' and 'cli'.
Try these commands
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python get-pip.py
then
pip install awscli

AWS CLI tools on Circle CI: configure: unknown command

I'm trying to deploy a docker application onto Elastic Beanstalk from Circle CI.
The deployment section of my circle.yml is
deployment:
hub:
branch: [internal, production]
commands:
- pip install awscli
- docker push company/web:$CIRCLE_SHA1
- sudo bash deploy.sh $CIRCLE_SHA1 $CIRCLE_BRANCH $CIRCLE_BUILD_NUM
and my deploy.sh calls aws cli as follows
aws --version
aws configure set aws_access_key_id $AWSKEY
aws configure set aws_secret_access_key $AWSSECRETKEY
aws configure set default.region us-west-2
aws configure set default.output json
echo "SAVING NEW DOCKERRUNFILE: $DOCKERRUN_FILE"
aws s3 cp $DOCKERRUN_FILE s3://$EB_BUCKET/$DOCKERRUN_FILE
But I get the error
--version: mispelled meta parameter?
sanity-check: "/root/.awssecret": file is missing. (Format: AccessKeyID\nSecretAccessKey\n)
configure: unknown command Usage: aws ACTION [--help]
The script works completely fine locally on mac os using the exact same key and secret.
Both versions (on circle and my mac) of awscli are 1.7.14
I'm Kevin from CircleCI. It looks like the issue here is related to the fact that when you install Python dependencies CircleCI installs them into a virtualenv. This is usually a great thing, as it isolates your python environment from the default system Python and supports our dependency cacheing. The problem here is that you're running your deploy.sh script with sudo, which clobbers the virtualenv environment and runs the default system version (which in this case is actually an older alternative AWS CLI). Dropping the sudo should fix things for you. (You would also be better off running pip install awscli==x.x.x in the "dependencies" phase, as it would be cached then.)
PS: Please contact sayhi#circleci.com for a timely response to questions in general.