I switched from Transmit4 to AWS CLI, so here’s a memo from that time.
Before installing AWS CLI, you need to have Python and pip installed.
First, check if Python is already installed:
$ which python
If nothing is displayed, Python is not installed. Install Python:
$ brew install python3
Next, install pip, which is like the Homebrew version for Python:
$ sudo easy_install pip
$ Enter your password when prompted
This completes the preparation.
Follow the official instructions:
$ pip install awscli --upgrade --user
Normally, this should complete the installation, but I encountered an error. This is one of the reasons I used Transmit before, but now I can’t avoid dealing with errors.
Found existing installation: six 1.4.1
DEPRECATION: Uninstalling a distutils installed project (six) has been deprecated and will be removed in a future version. This is due to the fact that uninstalling a distutils project will only partially uninstall the project.
Uninstalling six-1.4.1:
It said Uninstalling six-1.4.1:
, but I couldn’t uninstall it. After searching online, I found a workaround:
$ sudo -H pip install awscli --upgrade --ignore-installed six
It worked.
Next, complete the detailed configuration:
$ aws configure
AWS Access Key ID : Check on the AWS website
AWS Secret Access Key : If you forgot the secret key, you'll need to create a new one
Default region name : ap-northeast-1 => This is Tokyo
Default output format [None]: text => Since I'm only using it for Hugo, I'll set it to text for now
First, check if you can access S3:
$ aws s3 ls
2017-07-22 16:56:44 shou2017.com
I was able to access it and confirm the bucket.
Move to the public folder:
$ cd public
To upload everything in the local public folder, do this:
public$ aws s3 sync . s3://shou2017.com <= Enter your bucket name here
If moving to the public folder every time is inconvenient, you can do it like this:
$ aws s3 sync --delete ./public s3://shou2017.com <= Enter your bucket name here
That’s it. It was faster than using Transmit, but working with the terminal can still be tedious. Even when following the official instructions, errors often occur.