amplify-cli icon indicating copy to clipboard operation
amplify-cli copied to clipboard

How to integrate a python lambda using aws-amplify

Open artista7 opened this issue 7 years ago • 10 comments

Im currently using cra with amplify-cli for aws backend services like cognito, appsync, lambda and storage. I have a requirement to integrate a flask app (maybe using lambda) to my existing application.

Can you guide me on how to process using already existing cloudformation script initialized by amplify, so that it could be used in CI/CD using amplify service also.

Thanks Shubham Gupta

artista7 avatar Mar 20 '19 11:03 artista7

@artista7 You could use the Amplify Console for your CI/CD needs. Please take a look at https://aws.amazon.com/amplify/console/

cc @swaminator

kaustavghosh06 avatar Mar 22 '19 20:03 kaustavghosh06

I am using amplify console for CI/CD. My main issue is is it possible to configure lambda written in python using existing amplify project? As of now i am able write lambdas in js only

artista7 avatar Mar 28 '19 09:03 artista7

No, we do not support. But I'll add this as a feature request.

kaustavghosh06 avatar Mar 29 '19 20:03 kaustavghosh06

Hey @kaustavghosh06, that would be awesome if you do!

artista7 avatar Apr 05 '19 20:04 artista7

Hi @kaustavghosh06, how soon can we expect this functionality?

artista7 avatar Apr 15 '19 11:04 artista7

@kaustavghosh06, Any updates?

artista7 avatar Apr 24 '19 10:04 artista7

@artista7: what you can do now is the following.

Enable @http directive which is not yet available in release version of amplify-cli. https://github.com/aws-amplify/amplify-cli/issues/84#issuecomment-483737268

Then if you have an available flask endpoint you can hit it via a following declaration in you graphql schema:

Type Query {
    myFlaskAPI(route: String!): [ExpectedResponse] @http(url:"https://yourflaskawesomeapp/:route")
}

My main issue is is it possible to configure lambda written in python using existing amplify project?

For flask app in lambda one reasonable option to go with https://github.com/Miserlou/Zappa for deployment, it can smoothly integrate with your CI as you can use a single command to update your deployment based on your configuration defined in zappa_settings.json. In you CI it can look just like:

zappa update prod 
./node_modules/.bin/amplify publish --yes

ambientlight avatar Apr 24 '19 10:04 ambientlight

@ambientlight I will have a look at Zappa. Thanks

artista7 avatar Apr 29 '19 17:04 artista7

Closing, since this is a duplicate of #156

kaustavghosh06 avatar Oct 11 '19 04:10 kaustavghosh06

This issue has been automatically locked since there hasn't been any recent activity after it was closed. Please open a new issue for related bugs.

Looking for a help forum? We recommend joining the Amplify Community Discord server *-help channels for those types of questions.

github-actions[bot] avatar May 26 '21 23:05 github-actions[bot]