Waves allows you create configuration files and passes them to AWS so you can modify your server before run application runs.

You must create each configuration file in .ebextensions/myfile.config . Files must be written in YAML.

Packages

You can use the packages key to download and install prepackaged applications and components.

Syntax

packages: 
  name of package manager:
    package name: version
    ...
  name of package manager:
    package name: version
    ...
  ...

AWS currently supports the following package managers: yum, rubygems, python, and rpm.

Example Snippet:

The following snippet specifies a version URL for rpm, requests the latest version from yum, and version 0.10.2 of chef from rubygems.

packages: 
  yum:
    ImageMagick: []
    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'

Commands

You can use the commands key to execute commands on the instance. The commands run before the application and web server are set up and the application version file is extracted.

The specified commands run as the root user, and are processed in alphabetical order by name. By default, commands run in the root directory. To run commands from another directory, use the cwd option.

Syntax

commands:
  command name:
    command: command to run
    cwd: working directory
    env:
      variable name: variable value
    test: conditions for command
    ignoreErrors: true

Options

command

Either an array (block sequence collection in YAML syntax) or a string specifying the command to run. 

To specify multiple commands, use a literal block scalar, as shown in the following example.

commands:
  command block:
    command: |
      git commit -m "This is a comment."
      git push

env

(Optional) Sets environment variables for the command. This property overwrites, rather than appends, the existing environment.

cwd

(Optional) The working directory. If not specified, commands run from the root directory (/).

test

(Optional) A command that must return the value true (exit code 0) in order to process the command, such as a shell script, contained in the command key.

ignoreErrors

(Optional) A boolean value that determines if other commands should run if the command contained in the command key fails (returns a nonzero value). Set this value to true if you want to continue running commands even if the command fails. Set it to false if you want to stop running commands if the command fails. The default value is false.

Example

The following example snippet runs a python script.

commands:
  python_install:
    command: myscript.py
    cwd: /home/ec2-user
    env:
      myvarname: myvarvalue
    test: "[ -x /usr/bin/python ]"

The following example snippets installs chrome in your instance

commands:
  installchrome:
    command: echo "installing chrome" && curl https://intoli.com/install-google-chrome.sh | bash

------

AWS provides more options on how to configure your instance, if you need more information check this article.

Did this answer your question?