# Documentation: https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/customize-containers-ec2.html # packages: # name of package manager: # package name: version # ... # name of package manager: # package name: version # ... # ... packages: yum: libmemcached: [] ruby-devel: [] gcc: [] rpm: epel: http://download.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm rubygems: chef: '0.10.2' # groups: # name of group: {} # name of group: # gid: "group id" groups: groupOne: {} groupTwo: gid: "45" # users: # name of user: # groups: # - name of group # uid: "id of the user" # homeDir: "user's home directory" users: myuser: groups: - group1 - group2 uid: "50" homeDir: "/tmp" # sources: # target directory: location of archive file sources: /opt/cloudwatch: https://aws-cloudwatch.s3.amazonaws.com/downloads/CloudWatchMonitoringScripts-1.2.1.zip # files: # "target file location on disk": # mode: "six-digit octal value" # owner: name of owning user for file # group: name of owning group for file # source: URL # authentication: authentication name: # "target file location on disk": # mode: "six-digit octal value" # owner: name of owning user for file # group: name of owning group for file # content: | # # this is my # # file content # encoding: encoding format # authentication: authentication name: files: "/home/ec2-user/myfile" : mode: "000755" owner: root group: root source: http://foo.bar/myfile "/home/ec2-user/myfile2" : mode: "000755" owner: root group: root content: | this is my file content "/tmp/myfile2.txt" : mode: "120400" content: "/home/ec2-user/myfile2" # commands: # command name: # command: command to run # cwd: working directory # env: # variable name: variable value # test: conditions for command # ignoreErrors: true commands: command1: command: git commit -m "This is a comment." command2: command: "git commit -m \"This is a comment.\"" command3: command: 'git commit -m "This is a comment."' command4: command: - git - commit - -m - This is a comment. command block: command: | git commit -m "This is a comment." git push python_install: command: myscript.py cwd: /home/ec2-user env: myvarname: myvarvalue test: "[ -x /usr/bin/python ]" # services: # sysvinit: # name of service: # enabled: "true" # ensureRunning: "true" # files: # - "file name" # sources: # - "directory" # packages: # name of package manager: # "package name[: version]" # commands: # - "name of command" services: sysvinit: myservice: enabled: true ensureRunning: true # container_commands: # name of container_command: # command: "command to run" # leader_only: true # name of container_command: # command: "command to run" container_commands: 01-setupcron: command: | echo '*/5 * * * * root perl /opt/cloudwatch/aws-scripts-mon/mon-put-instance-data.pl `{"Fn::GetOptionSetting" : { "OptionName" : "CloudWatchMetrics", "DefaultValue" : "--mem-util --disk-space-util --disk-path=/" }}` >> /var/log/cwpump.log 2>&1' > /etc/cron.d/cwpump 02-changeperm: command: chmod 644 /etc/cron.d/cwpump 03-changeperm: command: chmod u+x /opt/cloudwatch/aws-scripts-mon/mon-put-instance-data.pl