zalando-stups / senza

Deploy immutable application stacks and create and execute AWS CloudFormation templates in a sane way
https://pypi.python.org/pypi/stups-senza
Other
96 stars 72 forks source link

Error "No Taupage AMI found" when running Senza in region eu-central-1 #230

Open kenden opened 8 years ago

kenden commented 8 years ago

I am running Senza to create a stack in the region eu-west-1, it is working fine. I am not using Taupage (we already have our own system to manage the AMIs). Instead, I create my own Autoscalling group, Launch Configuration and ELB in the Senza template. This looks like this:

LaunchConfig:
    Type: "AWS::AutoScaling::LaunchConfiguration"
    Properties:
        ImageId: "{{Arguments.AMIImage}}"
        ....
ASG:
    Type: "AWS::AutoScaling::AutoScalingGroup"
    Properties:
    ...
ELB:
    Type: AWS::ElasticLoadBalancing::LoadBalancer
    Properties:
        ....

When running this in the region eu-central-1, this fails:

senza create --region eu-central-1 my-template.yml stack1 Environment="production" DockerImgVer="v747" AMIImage="ami-28fb711b"  #passing the ami as param.
Generating Cloud Formation template.. EXCEPTION OCCURRED: No Taupage AMI found

This seems to be throw from here

There are indeed no AMIs with those properties in eu-central-1:

name: '*Taupage-AMI-*'
is-public: 'false'
state:  'available'
root-device-type: ''ebs'

The workaround is then to create one, but this feels clumsy.

hjacobs commented 8 years ago

@kenden probably your account (or region) was freshly set up and we need to share the Taupage AMI with you.

kenden commented 8 years ago

Thanks @hjacobs. I don't use Taupage (yet?), that's why it's not in the region, I suppose.

I found a better workaround though.

I removed

SenzaComponents:
  - Configuration:
      Type: Senza::StupsAutoConfiguration

from the Senza template. Without this, find_taupage_image() is not called at all and doesn't fail.

I was only using SenzaComponents to get Subnets with:

Fn::FindInMap: [LoadBalancerSubnets, {"Ref": "AWS::Region"}, Subnets]

I replaced that by adding a mapping and referring to it.

Mappings:
  production:
    Subnets:
      value:
        - subnet-b91e59b1
        - subnet-e338181e
  test:
    Subnets:
      value:
        - subnet-e315ec95
        - subnet-849d6cdc

Fn::FindInMap: ["{{Arguments.Environment}}", Subnets, value]

It would be nice to be able to get this mapping (LoadBalancerSubnets) automatically but I understand if Taupage is required if one decides to use SenzaComponents. (Extra documentation could be good here).