CloudFormation QuickstartΒΆ

  1. Prepare the project directory. See Repo Structure for more details.

    mkdir my-app
    cd my-app
    git init
    git checkout -b ENV-dev
    
  2. Download/install Runway. Here we are showing the curl option. To see other available install methods, see Installation.

    macOS

    $ curl -L https://oni.ca/runway/latest/osx -o runway
    $ chmod +x runway
    

    Ubuntu

    $ curl -L https://oni.ca/runway/latest/linux -o runway
    $ chmod +x runway
    

    Windows

    > iwr -Uri oni.ca/runway/latest/windows -OutFile runway.exe
    
  3. Use Runway to generate a sample CloudFormation module, edit the values in the environment file, and create a Runway config file to use the module.

    macOS/Linux

    $ runway gen-sample cfn
    $ sed -i -e "s/CUSTOMERNAMEHERE/mydemo/g; s/ENVIRONMENTNAMEHERE/dev/g; s/stacker-/stacker-$(uuidgen|tr "[:upper:]" "[:lower:]")-/g" sampleapp.cfn/dev-us-east-1.env
    $ cat <<EOF >> runway.yml
    ---
    # Full syntax at https://github.com/onicagroup/runway
    deployments:
      - modules:
          - sampleapp.cfn
        regions:
          - us-east-1
    EOF
    

    Windows

    $ runway gen-sample cfn
    $ (Get-Content sampleapp.cfn\dev-us-east-1.env).replace('CUSTOMERNAMEHERE', 'mydemo') | Set-Content sampleapp.cfn\dev-us-east-1.env
    $ (Get-Content sampleapp.cfn\dev-us-east-1.env).replace('ENVIRONMENTNAMEHERE', 'dev') | Set-Content sampleapp.cfn\dev-us-east-1.env
    $ (Get-Content sampleapp.cfn\dev-us-east-1.env).replace('stacker-', 'stacker-' + [guid]::NewGuid() + '-') | Set-Content sampleapp.cfn\dev-us-east-1.env
    $ $RunwayTemplate = @"
    ---
    # Full syntax at https://github.com/onicagroup/runway
    deployments:
      - modules:
          - sampleapp.cfn
        regions:
          - us-east-1
    "@
    $RunwayTemplate | Out-File -FilePath runway.yml -Encoding ASCII
    
  4. Deploy the stack.

    $ runway deploy
    

Now our stack is available at mydemo-dev-sampleapp, e.g.: aws cloudformation describe-stack-resources --region us-east-1 --stack-name mydemo-dev-sampleapp