awscliをアップグレード(El Capitan)

今から、AWS CLIを使って、なんかしようと思ったので、

バージョンアップしようかなと思ったのが、ことの発端。

 

なんかエラーが出ました。

macbookair:~ userareaz$ aws –version
aws-cli/1.7.40 Python/2.7.10 Darwin/15.3.0
macbookair:~ userareaz$ sudo pip install -U awscli
The directory ‘/Users/userareaz/Library/Caches/pip/http’ or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo’s -H flag.
You are using pip version 7.1.0, however version 8.0.2 is available.
You should consider upgrading via the ‘pip install –upgrade pip’ command.
The directory ‘/Users/userareaz/Library/Caches/pip/http’ or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo’s -H flag.
Collecting awscli
Downloading awscli-1.10.1-py2.py3-none-any.whl (880kB)
100% |████████████████████████████████| 884kB 494kB/s
Collecting botocore==1.3.23 (from awscli)
Downloading botocore-1.3.23-py2.py3-none-any.whl (2.2MB)
100% |████████████████████████████████| 2.2MB 120kB/s
Collecting rsa<=3.3.0,>=3.1.2 (from awscli)
Downloading rsa-3.3-py2.py3-none-any.whl (44kB)
100% |████████████████████████████████| 45kB 5.8MB/s
Requirement already up-to-date: colorama<=0.3.3,>=0.2.5 in /Library/Python/2.7/site-packages (from awscli)
Requirement already up-to-date: docutils>=0.10 in /Library/Python/2.7/site-packages (from awscli)
Collecting jmespath<1.0.0,>=0.7.1 (from botocore==1.3.23->awscli)
Downloading jmespath-0.9.0-py2.py3-none-any.whl
Collecting python-dateutil<3.0.0,>=2.1 (from botocore==1.3.23->awscli)
Downloading python_dateutil-2.4.2-py2.py3-none-any.whl (188kB)
100% |████████████████████████████████| 192kB 2.2MB/s
Collecting pyasn1>=0.1.3 (from rsa<=3.3.0,>=3.1.2->awscli)
Downloading pyasn1-0.1.9-py2.py3-none-any.whl
Collecting six>=1.5 (from python-dateutil<3.0.0,>=2.1->botocore==1.3.23->awscli)
Downloading six-1.10.0-py2.py3-none-any.whl
Installing collected packages: jmespath, six, python-dateutil, botocore, pyasn1, rsa, awscli
Found existing installation: jmespath 0.7.1
Uninstalling jmespath-0.7.1:
Successfully uninstalled jmespath-0.7.1
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:
Exception:
Traceback (most recent call last):
File “/Library/Python/2.7/site-packages/pip-7.1.0-py2.7.egg/pip/basecommand.py”, line 223, in main
status = self.run(options, args)
File “/Library/Python/2.7/site-packages/pip-7.1.0-py2.7.egg/pip/commands/install.py”, line 299, in run
root=options.root_path,
File “/Library/Python/2.7/site-packages/pip-7.1.0-py2.7.egg/pip/req/req_set.py”, line 640, in install
requirement.uninstall(auto_confirm=True)
File “/Library/Python/2.7/site-packages/pip-7.1.0-py2.7.egg/pip/req/req_install.py”, line 726, in uninstall
paths_to_remove.remove(auto_confirm)
File “/Library/Python/2.7/site-packages/pip-7.1.0-py2.7.egg/pip/req/req_uninstall.py”, line 125, in remove
renames(path, new_path)
File “/Library/Python/2.7/site-packages/pip-7.1.0-py2.7.egg/pip/utils/__init__.py”, line 314, in renames
shutil.move(old, new)
File “/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py”, line 302, in move
copy2(src, real_dst)
File “/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py”, line 131, in copy2
copystat(src, dst)
File “/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py”, line 103, in copystat
os.chflags(dst, st.st_flags)
OSError: [Errno 1] Operation not permitted: ‘/tmp/pip-Deg5y5-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/six-1.4.1-py2.7.egg-info’

例のヤツ(six)です。

この際だから、pipもアップグレード

macbookair:~ userareaz$ sudo pip install –upgrade pip
The directory ‘/Users/userareaz/Library/Caches/pip/http’ or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo’s -H flag.
You are using pip version 7.1.0, however version 8.0.2 is available.
You should consider upgrading via the ‘pip install –upgrade pip’ command.
The directory ‘/Users/userareaz/Library/Caches/pip/http’ or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo’s -H flag.
Collecting pip
Downloading pip-8.0.2-py2.py3-none-any.whl (1.2MB)
100% |████████████████████████████████| 1.2MB 352kB/s
Installing collected packages: pip
Found existing installation: pip 7.1.0
Uninstalling pip-7.1.0:
Successfully uninstalled pip-7.1.0
Successfully installed pip-8.0.2

で、この間やった「–ignore-installed six」をやることに。

macbookair:~ userareaz$ sudo pip install awscli –upgrade –ignore-installed six
The directory ‘/Users/userareaz/Library/Caches/pip/http’ or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo’s -H flag.
The directory ‘/Users/userareaz/Library/Caches/pip’ or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo’s -H flag.
Collecting awscli
Downloading awscli-1.10.1-py2.py3-none-any.whl (880kB)
100% |████████████████████████████████| 884kB 572kB/s
Collecting six
Downloading six-1.10.0-py2.py3-none-any.whl
Collecting botocore==1.3.23 (from awscli)
Downloading botocore-1.3.23-py2.py3-none-any.whl (2.2MB)
100% |████████████████████████████████| 2.2MB 200kB/s
Collecting rsa<=3.3.0,>=3.1.2 (from awscli)
Downloading rsa-3.3-py2.py3-none-any.whl (44kB)
100% |████████████████████████████████| 45kB 4.8MB/s
Collecting colorama<=0.3.3,>=0.2.5 (from awscli)
Downloading colorama-0.3.3.tar.gz
Collecting docutils>=0.10 (from awscli)
Downloading docutils-0.12.tar.gz (1.6MB)
100% |████████████████████████████████| 1.6MB 266kB/s
Collecting jmespath<1.0.0,>=0.7.1 (from botocore==1.3.23->awscli)
Downloading jmespath-0.9.0-py2.py3-none-any.whl
Collecting python-dateutil<3.0.0,>=2.1 (from botocore==1.3.23->awscli)
Downloading python_dateutil-2.4.2-py2.py3-none-any.whl (188kB)
100% |████████████████████████████████| 192kB 1.8MB/s
Collecting pyasn1>=0.1.3 (from rsa<=3.3.0,>=3.1.2->awscli)
Downloading pyasn1-0.1.9-py2.py3-none-any.whl
Installing collected packages: jmespath, six, python-dateutil, docutils, botocore, pyasn1, rsa, colorama, awscli
Running setup.py install for docutils … done
Running setup.py install for colorama … done
Successfully installed awscli-1.10.1 botocore-1.1.3 colorama-0.3.3 docutils-0.12 jmespath-0.9.0 pyasn1-0.1.8 python-dateutil-1.5 rsa-3.1.4 six-1.4.1

よかった。

でも、El Capitan+six…。

いい相性ですT_T。

広告

ELBとPrivateSubnetのインスタンスをつなぐ

なんかやってみたい構成があったので、作ってみようと思ってたのですが、

なかなかうまく行かなかったので、なんとも・・・。

でも、なんかできたので、残しておこうかなと。

 

まずはやりたかった構成。

スクリーンショット 2016-01-24 16.23.03

PublicSubnetにELBを置いて、PrivateSubnetにWebServer。

で、ELBをつくってみました。

スクリーンショット 2016-01-24 17.16.17

HTTPで通信させることとして、インスタンスのあるPrivateSubnetを指定してみました。

しばらくすると「InService」になったので、HTTPアクセスするとタイムアウト・・・。

なんぼ待ってもなんぼ待ってもなんぼ待ってもサイトが表示されることはなく・・・。

 

いや、まさしく同じことですでに情報を公開されている方が。元記事

 

ということで、ELBを作り直しました。

elb002

サブネットをPublicSubnetに指定。

そしたら、見事開通〜。

 

なんでだろ。

インスタンスがPrivateSubnetにあるからPrivateSubnetを指定してたのに、

PublicSubnetを指定しないといけないとは・・・。

Sphinxをインストール(Mac)

Innovation Egg 第5回 「クラウド運用の本音」で、

運用設計ラボの波田野さんから紹介して頂いた

Sphinxをやっとインストールしました。

 

結構やるやる詐欺してしまいました・・・。

 

インストール〜プロジェクト作成までをQiitaに纏めました。

 

次は、ドキュメントを作っていくぞ〜。

 

Lambda Pythonでインスタンス起動停止

前々からやりたかった、Lambdaのスケジュール機能を使って、

インスタンスを自動的に起動 / 停止させたいと思ってました。

落とし忘れるのが怖いからが根元・・・。

 

ということで、作って見ました。

 

とりあえず、Qiitaにあげました。

おひまな時にチェックしてください。

 

インストールしてみた〜AWS SDK for Python (Boto3)〜

年も明けたので、Pythonに手を出してみようかと思い、

コマンドを実行してみました。

 

$ sudo pip install boto3

 

すると

 

The directory ‘/Users/userareaz.wordpress.com/Library/Caches/pip/http’ or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo’s -H flag.

You are using pip version 7.1.0, however version 7.1.2 is available.

You should consider upgrading via the ‘pip install –upgrade pip’ command.

The directory ‘/Users/userareaz.wordpress.com/Library/Caches/pip/http’ or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo’s -H flag.

Collecting boto3

  Downloading boto3-1.2.3-py2.py3-none-any.whl (108kB)

    100% |████████████████████████████████| 110kB 1.7MB/s

Requirement already satisfied (use –upgrade to upgrade): jmespath<1.0.0,>=0.7.1 in /Library/Python/2.7/site-packages (from boto3)

Collecting futures<4.0.0,>=2.2.0 (from boto3)

  Downloading futures-3.0.3-py2-none-any.whl

Collecting botocore<1.4.0,>=1.3.0 (from boto3)

  Downloading botocore-1.3.15-py2.py3-none-any.whl (2.1MB)

    100% |████████████████████████████████| 2.1MB 227kB/s

Collecting python-dateutil<3.0.0,>=2.1 (from botocore<1.4.0,>=1.3.0->boto3)

  Downloading python_dateutil-2.4.2-py2.py3-none-any.whl (188kB)

    100% |████████████████████████████████| 192kB 2.1MB/s

Requirement already satisfied (use –upgrade to upgrade): docutils>=0.10 in /Library/Python/2.7/site-packages (from botocore<1.4.0,>=1.3.0->boto3)

Collecting six>=1.5 (from python-dateutil<3.0.0,>=2.1->botocore<1.4.0,>=1.3.0->boto3)

  Downloading six-1.10.0-py2.py3-none-any.whl

Installing collected packages: futures, six, python-dateutil, botocore, boto3

  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:

Exception:

Traceback (most recent call last):

  File “/Library/Python/2.7/site-packages/pip-7.1.0-py2.7.egg/pip/basecommand.py”, line 223, in main

    status = self.run(options, args)

  File “/Library/Python/2.7/site-packages/pip-7.1.0-py2.7.egg/pip/commands/install.py”, line 299, in run

    root=options.root_path,

  File “/Library/Python/2.7/site-packages/pip-7.1.0-py2.7.egg/pip/req/req_set.py”, line 640, in install

    requirement.uninstall(auto_confirm=True)

  File “/Library/Python/2.7/site-packages/pip-7.1.0-py2.7.egg/pip/req/req_install.py”, line 726, in uninstall

    paths_to_remove.remove(auto_confirm)

  File “/Library/Python/2.7/site-packages/pip-7.1.0-py2.7.egg/pip/req/req_uninstall.py”, line 125, in remove

    renames(path, new_path)

  File “/Library/Python/2.7/site-packages/pip-7.1.0-py2.7.egg/pip/utils/__init__.py”, line 314, in renames

    shutil.move(old, new)

  File “/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py”, line 302, in move

    copy2(src, real_dst)

  File “/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py”, line 131, in copy2

    copystat(src, dst)

  File “/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py”, line 103, in copystat

    os.chflags(dst, st.st_flags)

OSError: [Errno 1] Operation not permitted: ‘/tmp/pip-nHWFG7-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/six-1.4.1-py2.7.egg-info’

年始早々、エラーに悩まされるとは・・・。

でも、エラーの内容を見てると「six」ってのが悪そうです。

理由はわかりまへん。

とりあえず、Google先生に確認してみると

ココを見ろ」と言われたので、チェックしてみると同じことになってる人が。

ということで、書かれてる通りのことをやってました。

$ sudo pip install –ignore-install six boto3

The directory ‘/Users/userareaz.wordpress.com/Library/Caches/pip/http’ or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo’s -H flag.

You are using pip version 7.1.0, however version 7.1.2 is available.

You should consider upgrading via the ‘pip install –upgrade pip’ command.

The directory ‘/Users/userareaz.wordpress.com/Library/Caches/pip/http’ or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo’s -H flag.

Collecting six

  Downloading six-1.10.0-py2.py3-none-any.whl

Collecting boto3

  Downloading boto3-1.2.3-py2.py3-none-any.whl (108kB)

    100% |████████████████████████████████| 110kB 3.0MB/s

Collecting jmespath<1.0.0,>=0.7.1 (from boto3)

  Downloading jmespath-0.9.0-py2.py3-none-any.whl

Collecting futures<4.0.0,>=2.2.0 (from boto3)

  Downloading futures-3.0.3-py2-none-any.whl

Collecting botocore<1.4.0,>=1.3.0 (from boto3)

  Downloading botocore-1.3.15-py2.py3-none-any.whl (2.1MB)

    100% |████████████████████████████████| 2.1MB 190kB/s

Collecting python-dateutil<3.0.0,>=2.1 (from botocore<1.4.0,>=1.3.0->boto3)

  Downloading python_dateutil-2.4.2-py2.py3-none-any.whl (188kB)

    100% |████████████████████████████████| 192kB 1.6MB/s

Collecting docutils>=0.10 (from botocore<1.4.0,>=1.3.0->boto3)

  Downloading docutils-0.12.tar.gz (1.6MB)

    100% |████████████████████████████████| 1.6MB 248kB/s

Installing collected packages: six, jmespath, futures, python-dateutil, docutils, botocore, boto3

  Running setup.py install for docutils

Successfully installed boto3-1.2.3 botocore-1.1.3 docutils-0.12 futures-3.0.3 jmespath-0.7.1 python-dateutil-1.5 six-1.4.1

 

いけました!

 

原因は、El Capitanにしたことにあるようです。

よくわかってないですが・・・。

 

ということで、これができたので、Python でSDKを叩いてみようかと。