〇構築方法
以下のVagrantfileを使用して、localstackをインストールした仮想マシン(CentOS7.5)を構築する事ができます。
Vagrantfile
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "bento/centos-7.5"
config.vm.hostname = "co75localstack"
config.vm.provider :virtualbox do |vbox|
vbox.name = "co75localstack"
vbox.cpus = 2
vbox.memory = 4096
vbox.customize ["modifyvm", :id, "--nicpromisc2","allow-all"]
end
config.vm.network "private_network", ip: "192.168.55.104", :netmask => "255.255.255.0"
config.vm.network "public_network", ip:"192.168.1.104", :netmask => "255.255.255.0"
config.vm.provision "shell", inline: <<-SHELL
localectl set-locale LANG=ja_JP.UTF-8
yum -y install epel-release
yum -y install python-pip python-devel npm java-1.8.0-openjdk
pip install pip --upgrade
pip install --upgrade setuptools
sudo -u vagrant pip install awscli-local --user
sudo -u vagrant pip install localstack --user
cat << EOF > /etc/systemd/system/localstack.service
[Unit]
Description=localstack
[Service]
Type=simple
ExecStart=/home/vagrant/.local/bin/localstack start
User=vagrant
Group=vagrant
WorkingDirectory=/home/vagrant/.local
TimeoutStartSec=180
[Install]
WantedBy=multi-user.target
EOF
sudo systemctl enable localstack
sudo systemctl start localstack
# wait until s3 is listening.
while netstat -lnt | awk '$4 ~ /:4572$/ {exit 1}'; do sleep 10; done
sleep 10
# test s3
sudo su - vagrant -c "/home/vagrant/.local/bin/awslocal s3 mb s3://test-bucket"
sudo su - vagrant -c "/home/vagrant/.local/bin/awslocal s3 cp /vagrant/Vagrantfile s3://test-bucket/"
sudo su - vagrant -c "/home/vagrant/.local/bin/awslocal s3 ls s3://test-bucket"
SHELL
end
○関連情報
・localstackに関する他の記事はこちらを参照してください。
0 件のコメント:
コメントを投稿