AWS Amplify - No option for container based hosting - next.js

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).

Related

How to enable CloudFront only on prod environment with aws amplify?

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.

Need CloudFront with lambda#edge to serve S3 bucket while using Amlify

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)

Firebase Remote Config - copy to another project

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.

How to delete AppEngine default service in the existing Google Cloud project with Firestore

I've the existing Google Cloud project that was created by Firebase and use Firestore in this project. Decided to try AppEngine and run Hello World Example in this project.
Now I want to delete this newly deployed AppEngine Service, but there are 2 problems:
1) Hello World Docs suggest to switch off the AppEngine. In this case Firestore is not working
2) Can't delete this service from CLI/UI as this service was deployed as the default one
Issue deleting service: [default]
The default service (module) cannot be deleted.
Is there a way to delete this service from the project and keep Firebase Firestore?
Go to App Engine -> Settings: https://console.cloud.google.com/appengine/settings
Click on "Disable application"
If there's nothing else on your project, you can shut down the project at https://console.cloud.google.com/iam-admin/settings.
2) Can't delete this service from CLI/UI as this service was deployed as the default one
See https://cloud.google.com/nodejs/getting-started/delete-tutorial-resources .
The only way you can delete the default version of your App Engine app is by deleting your project. However, you can stop the default version in the GCP Console. This action shuts down all instances associated with the version. You can restart these instances later if needed.
In the App Engine standard environment, you can stop the default version only if your app has manual or basic scaling.
As it's displayed in the UI on disabled Stop button:
You only can stop versions that are manually scaled, basic scaled or in flexible environment
The solution is to deploy another default service using flexible env, stop it and then delete the app with Standard env:
1) Change app.yaml:
runtime: nodejs
env: flex
2) Run gcloud app deploy
3) Stop new version using UI or CLI
4) Delete old version
tl;dr: Deploy a hello world app on the flexible environment to replace the default service, and then stop it. No need to delete because the default service cannot be deleted.
I assume that:
you wanted to delete the default App Engine service, but
you wanted to continue using Google Cloud Firestore in the same project.
Problems that arise:
you cannot disable Google App Engine without also disabling Firestore
you cannot delete the default service
you cannot stop the default service because it may be deployed to the standard environment using some scaling settings that doesn't allow stopping the instance
Workaround:
Deploy a hello world application to the flexible environment. You can do this in Google Cloud Shell.
git clone https://github.com/GoogleCloudPlatform/nodejs-docs-samples
cd nodejs-docs-samples/appengine/hello-world/flexible
gcloud app deploy
Under Versions, stop the newly-deployed version and delete the old version.
Confirm that the instance count is 0.
So the service is not deleted; it is just stopped and doesn't charge you for instances. You can continue to use Firestore.

Firebase deploy after test to production environment

I have created 2 separate projects in Firebase one for the TEST (development) and one for the actual PROD(unction) environment.
I have create a hosting project and am also using Firebase functions that I have successfully deployed and tested on the Firebase TEST project (using the command line as described in the docs).
What is the best / easiest way to now publish to the Firebase PROD project?
Get familiar with the way the Firebase CLI lets you attach a workspace to multiple projects. You can use firebase use --add on the command line to add a project alias, then firebase use [project] to switch between projects for deployment.
You can find the documentation for managing aliases here.

Resources