Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Gen 2] Support cross-region functions #431

Open
2 tasks
ykethan opened this issue Nov 27, 2024 · 6 comments
Open
2 tasks

[Gen 2] Support cross-region functions #431

ykethan opened this issue Nov 27, 2024 · 6 comments
Labels

Comments

@ykethan
Copy link
Member

ykethan commented Nov 27, 2024

Describe the feature you'd like to request

similar to gen 1: https://docs.amplify.aws/gen1/react/build-a-backend/graphqlapi/custom-business-logic/#calling-functions-in-different-regions
reference a existing function in gen 2 can be done using a.handler.function('<function-name>')
but cross region isnt supported

Describe the solution you'd like

a.handler.function('<function-name>', '<region>')

Describe alternatives you've considered

override backend.ts to addLambdaDataSource

Additional context

No response

Is this something that you'd be interested in working on?

  • 👋 I may be able to implement this feature request

Would this feature include a breaking change?

  • ⚠️ This feature might incur a breaking change
@palpatim palpatim changed the title pass region as a 2nd property on a.handler.function [Gen 2] Support cross-region functions Nov 29, 2024
@JGamboa
Copy link

JGamboa commented Dec 12, 2024

Basically the idea is to have some of the functions on another regions because of latency.

On my case we have to connect to apis on different countries, this countries have low bandwitch to US, so creating the function on for example SA give us better performance, even when the appsync is on the US.

APP SYNC US -> LAMBDA US ->>> SA COUNTRY -->> LOW RESPONSE
APP SYNC US -> LAMBDA SA ->>> SA COUTRY ---> FAST RESPONSE

@stocaaro stocaaro transferred this issue from aws-amplify/amplify-category-api Jan 8, 2025
@JGamboa
Copy link

JGamboa commented Jan 20, 2025

Any update on this?

@JGamboa
Copy link

JGamboa commented Feb 11, 2025

Any update on this @stocaaro

@stocaaro
Copy link
Member

stocaaro commented Feb 12, 2025

Hello @JGamboa,

This is an interesting feature request. Do you have a Gen 1 example app you can share that demonstrates the performance improvement you have diagrammed above? I'm not sure where supporting this behavior fits into our feature backlog and I'll check.

Thanks,
Aaron

@JGamboa
Copy link

JGamboa commented Feb 12, 2025

@stocaaro I modified the arn of the used function on the UI. I created the function on the other region manually, after i copied the arn, and in the appsync where you have the resolver i choose and put manually the arn of the function of the other region.

I tested a lot of times with multiple request, using the lambda on us (original) response time was arround 4 seconds on lambda + the response to go back to the appsync, and when using it on the sa country, response time of lambda was arround 1.5 seconds + resposne back (this was really faster as you seeing)

Nop i started using gen 2 of amplify so i dont have a gen1 example, i just tested manually changing the arns

@JGamboa
Copy link

JGamboa commented Feb 12, 2025

I think that maybe adding sometihng like "put your arn of lambda function here" could be easy, beacuse that way you dont need the lambd function that is in the other region to be part of the stack, and can be created manually.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants