LoginSignup
0
1

More than 5 years have passed since last update.

RHEL7でのCloudFormation

Posted at

はじめに

Amazon LinuxだとCloudFormationのヘルパースクリプトのパッケージaws-cfn-bootstrapが初めからインストール済みだけど、RHEL7のAMIを使うと入っていないので、どうやってインストールしようかって話。

rpmによるインストール

公式サイトではrpmでインストール可能と記載されているのでそれに倣ってみる
https://docs.aws.amazon.com/ja_jp/AWSCloudFormation/latest/UserGuide/cfn-helper-scripts-reference.html

sudo yum install -y https://s3.amazonaws.com/cloudformation-examples/aws-cfn-bootstrap-latest.amzn1.noarch.rpm

だけどこれでテンプレートを実行しても期待どおりに動作しない。
試しに sudo /opt/aws/bin/cfn-initを実行してみると以下URL冒頭のようなエラーが出力される
http://huliad.blogspot.com/2015/12/solved-cent-os-7-importerror-no-module.html

対策としては上記URLに記載されているとおり、シンボリックリンクを作成したらとりあえず動いた。(パスは若干違ったけど)

easy_installによるインストール

rpmを使わない方法もある。AWSがgithubで公開しているテンプレートとして以下URLのものがある。
https://github.com/awslabs/aws-cloudformation-templates/blob/master/aws/solutions/HelperNonAmaznAmi/RHEL7_cfn-hup.template
このファイル内では以下のように導入している

         "#!/bin/bash -xe\n",
         "yum update -y\n",
         "yum install -y python-setuptools\n",
         "yum install -y wget\n",
         "mkdir -p /opt/aws/bin\n",
         "wget https://s3.amazonaws.com/cloudformation-examples/aws-cfn-bootstrap-latest.tar.gz\n",
         "easy_install --script-dir /opt/aws/bin aws-cfn-bootstrap-latest.tar.gz\n",

wgetでダウンロードしてeasy-installする流れか。

まとめ

どちらのインストール方法でもURLべた書きするのってどうなの?って気が若干してしまうがまぁ仕方ないのかな。
とりあえずインストール・実行はどちらの方法でもできたので後はまぁ運用性で違いがあるかどうか考えて決めればいいのかな。

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1