Search code examples
aws-cloudformationaws-clieip

Cloudformation AWS EIP fails with invalid domain vpc


I am trying to set up and elastic IP for a network load balancer but every time I create the stack it fails specifying that the domain vpc is an invalid parameter value although the specified vpc physical id exists and it is created before.


Solution

  • Have you got Domain: vpc set in your CloudFormation template?

    This should work:

    ElasticIP:
      Type: AWS::EC2::EIP
      Properties:
        Domain: vpc      # NOT vpc-1234abcd !!
    

    If you don't specify Domain: vpc you won't be able to attach the EIP to resources inside the VPC, e.g. to the load balancer.