I was wondering how I can use Amplify to create Cloudfront to serve dynamic images (for users) in S3 bucket. Amplify hosting does not work since it is for static content. Also, I will need to have couple Lambda#edge.
Is this something that can be done with Amplify CLI.
Is there another way to do this while keeping my Amplify project.
Thanks in advance.
It's not supported by amplify cli (yet).
See here: https://github.com/aws-amplify/amplify-cli/issues/1910
But you can setup cloudfront from AWS Web Console and then "connect" to your amplify cli added S3 bucket (amplify storage category) and lambdas (created with amplify add funcion)
Related
I added cloudfront to hosting with
amplify configure hosting
but once this is pushed to the cloud all environments are updated so that dev and prod now have it.
If I remove it from dev and push the changes then it will be removed from the prod.
How can I have cloudfront only on the prod evnironment?
I'm not sure how you'd do this. You may be able to add conditionals in the CloudFormation.
It's generally a best practice to have your dev & test environments mirror your prod environment. In Amplify, all environments are identical - obviously excluding the data and load on resources from using the service.
Also - without CloudFront, I'm not sure how you'd access the (deployed) front-end pages.
Can you elaborate on why you want to eliminate it?
EDIT
Amplify does not expose the S3 bucket or CloudFront distribution when hosting your front-end; so you won't be able to alter this behavior.
I'm trying to set up an Next.js app on Amplify with container-based hosting on Fargate, but when I run amplify add hosting, the only two options I get are Amplify Console and CloudFront + S3.
I've already configured the project to enable container-based deployments, but I'm just not presented with the option to do so
Amplify CLI version is v4.41.2 and the container-hosting plugin is correctly listed in the active plugins
Region is eu-west-1, the CLI is configured and I've gone through all the steps more than once.
amplify init
amplify configure project
amplify add hosting
Are there any prerequisites, something I missed or don't know of? I can't find anything about it.
According to this video it's only available in US East 1 currently.
https://youtu.be/rA5l82vypXc
Here's the limitation they have mentioned in their docs: https://docs.amplify.aws/cli/usage/containers/#:~:text=Hosting%20with%20Fargate%20in%20Amplify%20is%20only%20available%20in%20US%2DEast%2D1%20at%20this%20time
Hosting with Fargate in Amplify is only available in US-East-1 at this
time
So the best solution would be to change the region of your project itself, if possible. Otherwise, use ECS and build your CI/CD pipeline manually (CodePipeline).
I have two projects for dev and prod. I want to be able to run a script to copy dev config to prod.
Firebase Remote Config has an API for programatically updating Remote Config. But as far as I can tell, you need to init admin with a project-specific service account. It seems like I would need two admin instances, but I'm not sure that's possible?
I'm wondering if someone has done this before and has an example script. Thanks!
See docs:
https://firebase.google.com/docs/remote-config/automate-rc
There is no Firebase Admin SDK for Flutter, so you'll have to implement this on a different platform that is supported. For a list of these platforms and instructions on setting it up, see the documentation on adding Firebase to a server.
For these platforms that the Firebase Admin SDK targets, you can create multiple instances of the FirebaseApp class, and initialize each of them with different credentials and project configuration. For examples of how to do this, see the documentation on initializing multiple apps.
What's the best way to work with multiple environments/projects on firebase?
I can switch between firebase projects using the the CLI.
I see here how to add environment variables to a firebase project and access them through firebase-functions's .config() method.
Is there a way to do something similar on the client-side when using firebase hosting.
For example: I'm using Algolia to run searches. I have firebase-functions to keep the indexes up to date, and run the searches from the client. Both functions and the hosted content need to point to the right Algolia project depending on the environment. I'd like to tie both configs to the same switch; firebase use staging vs firebase use production, for example. What's the best way to go about that?
Is there a way to delete an app via Firebase CLI?
Our CI creates a temporary Firebase app for a feature branch (based on the CI build number), and then runs tests on it. At the end it needs to delete the app. I'm not entirely sure how this is done. firebase disable:hosting just disables hosting and does not delete the app. This is similar to how we would have used Heroku review apps or Heroku forked apps. A similar CI workflow can also be achieved on Google App engine via versions.
Any pointers would be much appreciated.
The correct command is firebase hosting:disable, which make your site offline. You can not remove your project, instead you can overwrite it by creating a new one with firebase init.
More info here https://firebase.google.com/docs/cli/.
There is currently no public API to delete a Firebase backend.
The recommended practice is to use the same database for testing and (if needed) put each run in its own node under the root. So instead of creating/deleting a new database, you're just create/deleting a node in a single database.
Using the command firebase use <alias> --unaliasand then delete the project from the console https://console.firebase.google.com/
Check before the list of commands with the command -h