
# basic information for generating and executing this definition
SenzaInfo:
  StackName: spilo
  Parameters:
    - EtcdDiscoveryUrl:
        Description: "Discovery URL for the etcd service"
    - ImageVersion:
        Description: "Docker image version of spilo."

# a list of senza components to apply to the definition
SenzaComponents:

# this basic configuration is required for the other components
- Configuration:
    Type: Senza::StupsAutoConfiguration # auto-detect network setup

# will create a launch configuration and auto scaling group with scaling triggers
- AppServer:
    Type: Senza::TaupageAutoScalingGroup
    AutoScaling:
      Minimum: 3
      Maximum: 3
      MetricType: CPU
    InstanceType: t2.micro
    SecurityGroups:
      - app-spilo
    IamRoles:
      - app-spilo
    TaupageConfig:
      runtime: Docker
      source: "{{Arguments.ImageVersion}}"
      ports:
        5432: 5432
      environment:
        SCOPE: "{{Arguments.version}}"
        ETCD_DISCOVERY_URL: "{{Arguments.EtcdDiscoveryUrl}}"
      root: true


# basic information for generating and executing this definition
SenzaInfo:
  StackName: spilo
  Parameters:
    - EtcdDiscoveryUrl:
        Description: "Discovery URL for the etcd service"
    - ImageVersion:
        Description: "Docker image version of spilo."

# a list of senza components to apply to the definition
SenzaComponents:

# this basic configuration is required for the other components
- Configuration:
    Type: Senza::StupsAutoConfiguration # auto-detect network setup

# will create a launch configuration and auto scaling group with scaling triggers
- AppServer:
    Type: Senza::TaupageAutoScalingGroup
    AutoScaling:
      Minimum: 3
      Maximum: 3
      MetricType: CPU
    InstanceType: t2.micro
    SecurityGroups:
      - app-spilo
    IamRoles:
      - Ref: PostgresS3AccessRole
    TaupageConfig:
      runtime: Docker
      source: "{{Arguments.ImageVersion}}"
      ports:
        5432: 5432
      environment:
        SCOPE: "{{Arguments.version}}"
        ETCD_DISCOVERY_URL: "{{Arguments.EtcdDiscoveryUrl}}"
      root: true

Resources:
  PostgresS3AccessRole:
    Type: AWS::IAM::Role
    Properties:
      AssumeRolePolicyDocument:
        Version: "2012-10-17"
        Statement:
        - Effect: Allow
          Principal:
            Service: ec2.amazonaws.com
          Action: sts:AssumeRole
      Path: /
      Policies:
      - PolicyName: AmazonEC2ReadOnlyAccess
        PolicyDocument:
          Version: "2012-10-17"
          Statement:
          - Effect: Allow
            Action: "s3:*"
            Resource: "*"

Configure IAM for S3 full access, unfortunately it doesn't work as is.
Configure IAM for S3 full access, unfortunately it doesn't work as is.
