amazon-web-servicesaws-cloudformationaws-regions

Is it possible for cloudformation to throw an error if it's built in the wrong region


Lamda@Edge needs to be built in the us-east-1. Is there a way to get CloudFormation to send out an error message when someone attempts to build the stack in the wrong region? Currently, I use conditions to only create the resources if they are in us-east-1, and not create the resources in any other region. Since no resources get created, the Output section fails. This has the desired effect, but it doesn't explain to the user that they are being forced into failure because they are in the wrong region. Any ideas?


Solution

  • the Output section fails.

    You can put conditions in the Outputs as well to conditionally create the outputs you only want.

    But, back to your question. No, CFN will not automatically throw exceptions in your users use wrong regions, unless its not possible to create. You could use custom resources to error out and check your regions.

    Other than that you could probably craft IAM policies allowing your users to lunch CFN only in regions you want.