Google Cloud Shell ssh with customer container image? - google-cloud-shell

Is it possible to use gcloud cloud-shell ssh with a
custom Cloud Shell container image?

This isn't supported with the gcloud surface today.

Related

Can I create and configure a GCP project + Firebase completely from the CLI or a script?

I am using gcloud + firebase cli to explore a reproducible way to create and configure a GCP + Firebase project.
I have created the GCP project using gcloud cli tool. I have then used firebase cli to run the command firebase init firestore.
Ulimately it ended up outputting...
Error: It looks like you haven't used Cloud Firestore in this project before. Go to https://console.firebase.google.com/project/my-project/firestore to create your Cloud Firestore database.
Is there a way I can "create my firestore database" using a cli tool or scripting api, instead of having to navigate to a web GUI tool and manually execute steps?
Unless Firebase do more behind the scenes, creating a Firestore instance could be as simple as this command from the GCloud CLI reference:
gcloud firestore databases create --region=us-central --project=my-project
The documentation for the entire create-provision cycle (from GCP's perspective) is here - including Terraform details (some commands may have been released since the docs were written).

AWS Amplify - No option for container based hosting

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

How can I view firebase cloud function logs older than 1 month

I have found that an error occurred in my app over a month ago. It is most likely due to an issue with a firebase cloud function which I have added logging to.
Unfortunately via the firebase control panel or GCP I can't view logs older than one month.
Is there any way to view these?
If there is not is there any way to export and save these to file?
If you can't see it in the console, then it's not available. You can use the Firebase CLI to view/print logs, but only recent entries.
I did it as follows. Thanks to #Neelavar for pointing me in the right direction.
More information here:
Log retention in Stackdriver GCP
-- Run as admin
VScode on windows
Right click the shortcut or app/exe
Go to properties
Check "Run this program as an administrator"
-- Install gcloud Alpha (as admin)
gcloud components install alpha
-- List all projects (optional)
gcloud projects list
-- Set current project
gcloud config set project my-project
-- Check correct project selected (optional)
gcloud config get-value project
-- Update retention period
gcloud alpha logging buckets update _Default --location=global --retention-days=365

Firebase Storage - How to setup a backup

Can someone please advise how to setup a backup for Files in Firebase storage. I am able to make a backup of Database but not sure how to setup a regular backup for files (I have images) in firebase storage.
How to make local backup of Firebase Storage
There is no built-in method via Firebase. However, since Firebase uses Google Cloud Storage behind the scenes for Firebase Storage it's possible to use the gutils Tool.
Prerequisites
Make sure Python (2.7.9+) is installed on your machine python -V
Go to the Google Cloud SDK page and follow the directions to download and install Google Cloud SKD on your OS.
Steps
At the end of the Google SDK installation you should have run gcloud init. This will ask you to select your project and authenticate you. Since Firebase uses Google Cloud Platform behind the scenes your Firebase project should be available as a choice.
In order for Google Cloud Utils to download the files that were uploaded with Firebase permissions you need to give your account Firebase Privileges. Go to the IAM page and select your email address you signed into cloud init with. In the list of available permissions you need to select Firebase Rules System from the Other category.
Get your Google Storage URL from the Firebase Storage Page in the dashboard (Towards the top) Should look something like this: gs://<bucket_name>
In command line on your local machine navigate to the folder you want to do a local backup to. Make sure you are in the folder you want as the following command will download all files right there in current folder
Run the gutil command gsutil -m cp -R gs://<bucket_name> .
-m enables multithreading for faster downloads if you have many files.
cp is the copy command
-R is recursive. If enabled it will download all files and folders in the specified tree.
You're done! This will run for some time depending on the size of your storage.
This can be used to also make a copy(backup) to another Google Cloud Storage Bucket or AWS etc.
Use Google Cloud Transfer Service.
Select your current project
Create Transfer Job
Select source (storage bucket url)
Select destination (click browse and create new bucket)
Use created bucket URL as destination
Configure transfer settings (This is where you can schedule how often the backup runs.)
Click "Create"
If you follow the wizard in the link it will guide you through pretty easily.
There is no built-in backup feature in Cloud Storage for Firebase.
But since it is built on top of Google Cloud Storage, any backup solution for GCS can work for Firebase too. Typically this will involve creating a separate bucket that is the target of the regular bucket where you store/read files.

openstack first program

I have setup my openstack dev environment. Now i want to write hello world program (for example i want to write a hello world program in a file say test and when i run nova-manage test it should print Hello World). i looked into web for programming guide, all i found was installation and admin manual. I even went through question openstack Hello World , wasn't helpful. I could use some help...
thanks in advance..
So by openstack dev environment I assume you mean something like devstack ( devstack.org ).
And by openstack I assume ( since you referenced nova-manage ) you are using the nova component of openstack.
nova is a cloud compute controller. it effectively acts as an API for managing virtual machines. Usually in linux this means kvm or xen hypervisor enabled virtual machines. But it is not constrained to this.
By default devstack uses kvm as it's hypervisor of choice.
Openstack will allow you to launch 'instances' once you have loaded images into the glance imagestore. These images function like templates for virtual machines. When you launch an instance based off an existing image you will receive a running virtual machine within your project in openstack. You can ssh to that instance and use it just like any other linux box if the image you are using is a linux image.
Ubuntu cloud services have a list of available images that are compatible with glance and can be freely downloaded.
So... at this point in the explanation I have to assume you think that openstack is something like cloud foundry. It is not. Nova provides IaaS solutions. Infrastructure as a Service. Not PaaS / SaaS as something like cloud foundry would.
Does this make sense?

Resources