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

How to give serverless container access to non-amplify-managed resources #6918

Closed
amirhajimirsadeghi opened this issue Mar 19, 2021 · 6 comments
Labels
containers Issues related to the non-serverless container based functionality feature-request Request a new feature

Comments

@amirhajimirsadeghi
Copy link

Which Category is your question related to?
Serverless Containers

Amplify CLI Version
4.45.2

What AWS Services are you utilizing?

  • DynamoDB
  • Cognito
  • API Gateway
  • Secrets Manager

Provide additional details e.g. code snippets
I have two issues

  1. I want to give my container the ability to know which env it is in and when I try to add the env to the environments attribute of the task definition the cloudformation gets overwritten when I run amplify push
  2. I want to give my container permission to access non-amplify managed resources but my cloudformation gets overwritten everytime I run amplify push

How can I modify my cloudformaiton without it being overwritten for this resource? Or is there another approach I need to be taking that I'm unaware of

@amirhajimirsadeghi amirhajimirsadeghi added the question General question label Mar 19, 2021
@kaustavghosh06 kaustavghosh06 added feature-request Request a new feature containers Issues related to the non-serverless container based functionality and removed question General question labels Mar 22, 2021
@mattfysh
Copy link

mattfysh commented May 7, 2021

As a workaround, can you create an amplify lambda function and invoke it from inside your container, to act as somewhat of a proxy between your container and other non-amplify resources?

@amirhajimirsadeghi
Copy link
Author

@mattfysh any prospect of adding this capability. I want to move away from lambdas to containers to avoid cold start times for my website, and the workaround doesn't solve that problem for me.

@mattfysh
Copy link

mattfysh commented May 7, 2021

@amirhajimirsadeghi I don't work on this project sorry, just an idea I had for a workaround.

To solve the cold start times, you could create the lambda function then edit the CF template file to set a "provisioned concurrency", if I've understood these docs correctly: https://docs.aws.amazon.com/lambda/latest/dg/configuration-concurrency.html

@mattfysh
Copy link

mattfysh commented May 7, 2021

Another cheap workaround is to create a storage (dynamodb) resource, call it TestEnv.

Then give your container permission, once running you can inspect process.env.STORAGE_TESTENV_NAME ... it will contain the environment name in it, e.g. "TestEnv-dev"

@renebrandel
Copy link
Contributor

Just to follow-up on this thread. We've just published an RFC on this. Would love to get your feedback: #7792

@ykethan
Copy link
Member

ykethan commented Nov 10, 2022

Hey, we can now add polices to a Lambda function using custom-polices.json file. Closing the issue. Please refer to #7792 for additional information.

@ykethan ykethan closed this as not planned Won't fix, can't repro, duplicate, stale Nov 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
containers Issues related to the non-serverless container based functionality feature-request Request a new feature
Projects
None yet
Development

No branches or pull requests

5 participants