spencerbeggs/aws-cdk-domain-redirect

The function must be in region 'us-east-1'

nicokruger opened this issue · 3 comments

Just want to say thanks a lot for this, it looks really promising. Really not looking forward to wiring all this AWS crap myself :-)

However, our stack is in eu-west-1, any ideas how I can get the lambda@edge function in your project to deploy? I get the following error:

The function must be in region 'us-east-1'. ARN: arn:aws:lambda:eu-west-1:xx:1 (Service: AmazonCloudFront; Status Code: 400; Error Code: InvalidLambdaFunctionAssociation; Request ID: xxx)

Hi, @nicokruger, I appreciate the enthusiasm. So, yeah, Lambda@Edge versions must be in the us-east-1 region. I am unclear if versions and functions can be in different regions. Let me try to spin up a stack in another region and see what I can see.

@spencerbeggs I got it to work for now by just splitting the redirect into a completely different stack. Would be interesting if there is a way to have it in our "main" CDK stack, but for now I'm good.

Just want to let you know, great job! It worked first time in us-east-1 and saved me tons of time.

Thanks!

@nicokruger I did a little investigation and it seems that CloudFormation itself does not allow you to create a stack in one region and a Lambda function in another. So, I think what I will do is cause this examine the stack context this construct is created in and throw an error if it is not us-east-1 with an error message. I will also make a note in the documentation.

Thank you for brining this to my attention.