Skip to content

Commit 5739d55

Browse files
committed
Updated aws cli & sam cli install details in README
1 parent 443c5d7 commit 5739d55

File tree

1 file changed

+12
-58
lines changed

1 file changed

+12
-58
lines changed

README.md

Lines changed: 12 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -54,79 +54,33 @@ lambda functions of <a href="https://purpleteam-labs.com/" title="purpleteam">pu
5454

5555
Clone this repository.
5656

57-
# Install the aws cli
57+
# Install aws cli
5858

59-
It appears that v2 is somewhat different to install, details [here](https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-install.html).
60-
61-
## Legacy v1 install of aws cli below
62-
63-
Read:
64-
65-
* https://docs.aws.amazon.com/cli/latest/userguide/installing.html
66-
* https://docs.aws.amazon.com/cli/latest/userguide/awscli-install-linux.html#awscli-install-linux-path
67-
68-
[Don't install pip the suggested way](https://stackoverflow.com/questions/49881448/importerror-cannot-import-name-main-after-upgrading-to-pip-10-0-0-for-python#answer-49989474)
69-
70-
`python -V`
71-
`python3 -V`
72-
`apt-get update`
73-
`apt-get install python-pip`
74-
`apt install python-pip python3-pip`
75-
76-
[`apt-get install python-setuptools python3-setuptools`](https://stackoverflow.com/questions/14426491/python-3-importerror-no-module-named-setuptools#answer-14426553)
77-
78-
The following command can also be run regularly to update awscli
79-
`pip install awscli --upgrade --user`
80-
If the above command produced `error: invalid command 'bdist_wheel'` then run `pip install wheel`
81-
82-
Needed to then [update my path](https://docs.aws.amazon.com/cli/latest/userguide/install-linux.html#install-linux-pip) so that `~/.local/bin` would be included.
83-
84-
If you get the following error when runing `sam` commands:
85-
```
86-
/home/you/.local/lib/python2.7/site-packages/requests/__init__.py:83: RequestsDependencyWarning: Old version of cryptography ([1, 2, 3]) may cause slowdown.
87-
warnings.warn(warning, RequestsDependencyWarning)
88-
```
89-
Then run: `pip install --upgrade cryptography`
90-
91-
If you get OpenSSL errors like the following:
92-
```
93-
...
94-
File "/home/you/.local/lib/python2.7/site-packages/urllib3/contrib/pyopenssl.py", line 46, in <module>
95-
import OpenSSL.SSL
96-
File "/usr/lib/python2.7/dist-packages/OpenSSL/__init__.py", line 8, in <module>
97-
from OpenSSL import rand, crypto, SSL
98-
File "/usr/lib/python2.7/dist-packages/OpenSSL/SSL.py", line 118, in <module>
99-
SSL_ST_INIT = _lib.SSL_ST_INIT
100-
AttributeError: 'module' object has no attribute 'SSL_ST_INIT'
101-
```
102-
Then run: `pip install --upgrade pyOpenSSL`
59+
If you are running on a Linux based system with apt, you can install `awscli` via the standard repository. This may be a little old, but it may be OK, and of course it's very quick and easy.
10360

61+
Or with a handful of commands you can install the latest, details [here](https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-install.html).
10462

10563
# Install aws-sam-cli
10664

10765
The [install details](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-sam-cli-install.html) for Linux can be found [here](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-sam-cli-install-linux.html).
10866
You will need to install brew first. Once you have done that `which brew` will show you were it is installed.
67+
Contrary to the install instructions, it was installed to: `/home/linuxbrew/.linuxbrew/Homebrew/bin/brew`
10968
For us we use zsh, so adding homebrew to our path was just adding the following line to our ~/.zshrc file:
11069
```shell
111-
export PATH=/home/linuxbrew/.linuxbrew/Homebrew/bin:$PATH
70+
export PATH=/home/linuxbrew/.linuxbrew/Homebrew/bin/brew:$PATH
11271
```
11372
Then just reload with the following command:
11473
```shell
11574
source ~/.zshrc
11675
```
117-
Your terminal should know where brew now is. Carry on with the aws-sam-cli install.
118-
119-
## Legacy Python install of aws-sam-cli below
120-
121-
`pip install --user --upgrade aws-sam-cli`
122-
123-
This kept failing with an error [`regex_3/_regex.c:46:20: fatal error: Python.h: No such file or directory`](https://github.com/awslabs/aws-sam-cli/issues/922#issuecomment-452361161)
124-
125-
So I did as [jfuss suggested](https://github.com/awslabs/aws-sam-cli/issues/922#issuecomment-452363441):
126-
`sudo apt-get install python-dev python3-dev`
127-
Then tried `pip install --user --upgrade aws-sam-cli` again, and could now see `sam` listed in `~/.local/bin/`
76+
Your terminal should know where brew now is. Carry on with the aws-sam-cli install.
77+
For us we had to run the install twice
78+
```shell
79+
brew tap aws/tap
80+
brew install aws-sam-cli
81+
```
12882

129-
# [Validating SAM templates](https://github.com/awslabs/aws-sam-cli/blob/develop/docs/usage.md#validate-sam-templates) (probably still needs doing)
83+
# Configuring aws cli
13084

13185
In order to validate SAM templates, [you'll need](https://github.com/awslabs/aws-sam-cli/issues/394) an AWS user with CLI access and policy `AWSQuickSightListIAM` added to the group of the CLI user, then, usually the easiest way to do this is to run [`aws configure`](https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-started.html) which will create two files ([`~/.aws/credentials`](https://docs.aws.amazon.com/sdk-for-javascript/v2/developer-guide/loading-node-credentials-shared.html) & `~/.aws/config`) if they don't already exist. The `aws_access_key_id` & `aws_secret_access_key` will be created in the `credentials` file if they don't exist, and the `output` & [`region`](https://docs.aws.amazon.com/emr/latest/ManagementGuide/emr-plan-region.html) will be created in the `config` file if they don't exist. If you don't set the region you'll end up with [errors](https://github.com/awslabs/aws-sam-cli/issues/442)
13286
Next it's a good idea to make sure these files are `chmod 600` (by default mine was). I then `chmod 700` on `~/.aws/`, just like the `~/.ssh/` directory is.

0 commit comments

Comments
 (0)