0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

EC2インスタンス起動時にCodeDeployエージェントを自動インストール

Last updated at Posted at 2021-10-29

EC2 インスタンスのユーザデータを登録すると、初回起動時に指定したスクリプトを実行できます。
下記を設定すれば、CodeDeploy エージェント codedeploy-agent をインストールできます。
Auto Scaling グループと CodeDeploy を組み合わせることで、
インスタンス起動時から一度もログインせずに、アプリケーションのセットアップを完了できます。

# !/bin/bash

yum update -y
yum install -y curl ruby
curl -s https://aws-codedeploy-ap-northeast-1.s3.amazonaws.com/latest/install | ruby - auto

AWS_REGION はメタデータから取得してくれるので指定しなくても 大丈夫かも(→大丈夫でした)。


[11/1追記]

ユーザデータの実行結果は、以下のファイルで確認できる。

sudo cat /var/log/cloud-init-output.log
0
0
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
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?