Find all running / terminated Azure Container Instances via CLI / API? - azure-container-instances

Having a hard time finding any docs or commands in the CLI to get a list of all running ACI containers I have in a resource group. Is it possible?
My scenario is to spin up about 100 instances to scale-out work, but when the work is finished, the container terminates (no auto restart). When the work is 100% complete, I want to delete all the groups... but I can't figure out how to get a list of all and the different states.
Ideas?

To list the containers' state inside a container group, you can just show the details of the container group, all the information in the output. Then you need to filter the info as you need.
Just output the containers' name and state in the container group via CLI:
az container show -g yourResourceGroup -n yourContainerGroup --query "containers[*].{Name: name, State: instanceView.currentState.state}"
The screenshot of the output:

Related

How to run gitlab pipeline with desired title?

Currently gitlab pipelines which I execute show me the last commit message as it's description. But when I need to search for some specific pipeline it becomes time consuming. Can we pass some title to pipeline before running it? If so can u please share some sample example.

gcloud snapshot all disks attached to an instance

I'm using the gcloud cli api and I'm trying to write a script that creates a snapshot of all disks attached to an instance.
My problem is that the snapshot cli command requires the name of the disk however when I ask gcloud for a list of disks attached to an instance it doesn't (directly) give me the disk name.
If I run:
gcloud compute instances list --format=json
I get a json array of disks which includes the deviceName but not the name.
I do note that the array includes a 'source' attribute which contains a url which does end with the diskname.
However I'm concerned that parsing the diskname from the url won't provide a stable solution.
So what is the correct way to obtain the disk names?
Did you tired:
gcloud compute disks list --format=json ?
I don't know if it can be listed by instance, but it contains information by which instance particular disc is used (reference)
I hope it will help!

How to have multiple users run the same pipeline in snakemake - metadata permissions issue

I have a pipeline that we want to store in a shared space so that all our analysts can access it and use it without having to copy the repo / singularity container. The problem is when one person runs the pipeline the files in .snakemake/metadata belong to that user. When the next user tries to run the pipeline this metadata is accessed and causes an error.
I know I could delete the data in metadata at the end of the process but ideally we want users to be able to run the pipeline in parallel (on different inputs / output). All users are within the same group but this doesn't not help
Any suggestions?

How to see actual HIVE queries that are running behind YARN applications in Ambari

I have some hive jobs executing in YARN, so in Yarn, if I list applications, I see some HIVE application and corresponding Templeton applications. So, in Ambari how do I see the actual HIVE query that those running HIVE applications are executing? Does Ambari provide any option for this?
Not sure if you still need this answered, but if you are running on the TEZ engine, you can find the actual hive query used by taking the following steps:
1) From the Ambari home page, hover over the 3X3 grid icon in the top
right corner, and select "Tez View"
2) Next, you can either search by application ID or the hive query
itself to find your application.
3) Select your application - the entire hive query should be displayed
here, as well as a nice progress and status indicator.

Rename Google Compute Engine VM Instance

How do I rename a Google Compute Engine VM instance?
I created a new LAMP server and I'd like to rename it in the "VM Instances" dashboard.
I've tried renaming the Custom metadata, but that didn't seem to replicate to the dashboard.
I tried the solution provided by #Marius I . It works, but I lost my description, my metas, the tags and the permissions I've set on the old instance. I had to copy my metas, had to make sure the zone for the new instance was the same as the original, and had to check that the pricing was the same.
I think, it's best to just create a clone of your original instance, this way don't have to manually copy/set them on the new instance.
As #Marius said, create a snapshot of your disk ( DO NOT skip this part: you may lose all your files/configuration )
Make sure you completed the step 1.
Clone your instance (“Create similar” button)
Name your cloned instance the way you want.
Make sure to select the snapshop of your disk created at #1 ( make sure you select the same typeof disk as well: if your original disk was SSD for example, you have to select if you want the new disk to be SSD too )
Make sure your IPs are set correctly
You're done :)
Another way to do this is:
snapshot the disk of the existing instance
create a new disk from that snapshot
create a new instance with that disk and give it the name you would like
It sounds time-consuming, but in reality should take 5 minutes.
you can't ...! Once VM is created, you can’t change the Instance Name
There's now a "native" way to do this. The feature is currently in Beta and only available with gcloud and via the API. With gcloud you can run:
$ gcloud beta compute instances set-name CURRENT_NAME -—zone=ZONE -—new-name=NEW_NAME
Some caveats:
You'll need to shut down the VM first
The Developer Console UI won't be aware of the rename until you do a browser refresh
See the official documentation for more details.
Apart from the hacks above, it's not possible.
Yet, it has been requested on uservoice and has received 593 votes. (as of 2018) Currently, it's the topmost "planned" item.
I got lost in the instructions, so I thought I include screenshots because the navigation is confusing. I hope this helps you.
Stop your instance
Click on the stopped instance name
In VM Instance Details, scroll down and click on the disk
Click on Create snapshot
give it a name like snapshot-1 (or your new instance name)
click on Create button
click on newly created snapshot
Click on Create Instance
Give your instance the new name and configure the rest of the VM.
When dealing with a robust system, it's necessary to have a way to bring up a system quickly when it goes down. This could be via custom scripts, salt, ansible, etc.
So, if you want to change your instance name, delete the instance, create a new one with the correct name, and run your script again :)
To answer your question directly. You cannot edit the VM Instance name.
However, you can create New VM instance using your old disk. To meet the VM instance name that you want.
Kindly see below procedure:
Go to Compute Engine Page
Go to Disk Page
Select the disk of your VM instance that you want to create a snapshot
Click the three dot image same line of your disk
Select +Create Snapshot (You will be go to Create Snapshot page). Kindly name your snapshot (backup)
Just Click Create.
Then once you have created a snapshot for your VM instance disk, you may now proceed on creating your new instance from snapshot pointing to other region which you can consider such: us-central1, us-west1 and us-west2. Please see below procedure:
Go to Snapshot Page
Select snapshot "backup" (You should be on Snapshot details Page)
Click Create Instance (Choose best name for your new VM Instance)
Please select the region best fit for you (us-central1, us-west1 and us-west2) except us-east1.
Lastly, Click Create
Machine images are now in pre-GA!
This is currently the easiest way to clone an instance without losing your instance configurations, check this comparison table.
Detailed steps:
Go to Compute Engine > Virtual Machines > Machine Images
Click on create Machine Image
Select your current instance under Source VM instance and click create
Once the image becomes ready go to Machine image details and click on create instance
The form will be populated by your existing instance configuration and you'll be able to change them before creating the instance!
Sorry to resurrect this thread after so long, but when I searched for an answer I kept ending up in this article... :-)
The Cloud SDK now allows renaming an instance directly, provided it's stopped:
The command looks like this:
gcloud beta compute instances set-name INSTANCE_NAME --new-name=NEW_NAME [--zone=ZONE] [GCLOUD_WIDE_FLAG …]
This is not available yet in the UI.
The following worked for me:
gcloud beta compute instances set-name currentname --new-name=newname
Googler checking in. We're rolling out this feature (renaming a VM) to all users in the cloud console. Public documentation.
In the Google Cloud console:
Go to the VM instances page.
Go to VM instances
In the Name column, click the name of the VM.
Click Stop stop.
Click Edit edit.
In Basic information > Rename > VM instance name, enter a new name
for the VM.
Click Save.
Click Start / Resume play_arrow.
Using the gcloud Command Line Interface:
gcloud compute instances stop INSTANCE_NAME
gcloud beta compute instances set-name INSTANCE_NAME --new-name=NEW_INSTANCE_NAME
I also wanted to let you all know that we monitor these forums and use your feedback to influence our roadmap. Thank you for your engagement!
I am trying to do this 03/2019 and I saw a new option on panel
click Instance link
on top menu you will see "Create Similar"
could work if you need same machine without data. (solved my case)
if you need a full copy then you should create a snapshot and clone it.
This is now possible via the web console: