LoginSignup
0

More than 5 years have passed since last update.

awspecの実行(ec2 AmazonLinux)

Posted at

環境

amzn-ami-hvm-2017.03.1.20170812-x86_64-gp2 (ami-4af5022c)

事前準備

# rbenvの導入
sudo su -
yum install git -y
git clone https://github.com/sstephenson/rbenv.git ~/.rbenv
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bash_profile
echo 'eval "$(rbenv init -)"' >> ~/.bash_profile
exec $SHELL -l
git clone https://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build
rbenv install --list
yum install -y gcc openssl-devel readline-devel zlib-devel
# ruby 2.2.7 install
rbenv install -v 2.2.7

awspecのinstall(bundle)

mkdir /var/tmp/work
cd /var/tmp/work
rbenv local 2.2.7
gem install bundler

bundle init
cat << '_EOS_' >> ./Gemfile
gem 'awspec'
_EOS_

bundler install --path vendor/bundle

実行

mkdir /var/tmp/work/awspec
bundle exec awspec init
# aws configure等クレデンシャルが見えるようにしておく
bundle exec awspec generate ec2 [vpc-id]
# 問題なければファイルを生成
bundle exec awspec generate ec2 [vpc-id] >> ./spec/ec2_spec.rb
# 生成したファイルにrequire 'awspec'を追記
vim ./spec/ec2_spec.rb
# 実行
bundle exec rake spec

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