• Skip to main content

Uly.me

cloud engineer

  • Home
  • About
  • Archives

id

GCP Display Device Names on OS

August 18, 2021

In GCP console you can see the VM’s Device Names. In this case, it’s boot and persistent-disk-1.

Name		          Device name
server-boot               boot	
server-data               persistent-disk-1

Name Device name server-boot boot server-data persistent-disk-1

To display the volume names on the OS, run this command.

$ ls -l /dev/disk/by-id
total 0
lrwxrwxrwx. 1 root root  9 Aug  2 01:12 google-boot -> ../../sda
lrwxrwxrwx. 1 root root 10 Aug  2 01:12 google-boot-part1 -> ../../sda1
lrwxrwxrwx. 1 root root  9 Aug 18 18:48 google-persistent-disk-1 -> ../../sdb
lrwxrwxrwx. 1 root root  9 Aug  2 01:12 scsi-0Google_PersistentDisk_boot -> ../../sda
lrwxrwxrwx. 1 root root 10 Aug  2 01:12 scsi-0Google_PersistentDisk_boot-part1 -> ../../sda1
lrwxrwxrwx. 1 root root  9 Aug 18 18:48 scsi-0Google_PersistentDisk_persistent-disk-1 -> ../../sdb

$ ls -l /dev/disk/by-id total 0 lrwxrwxrwx. 1 root root 9 Aug 2 01:12 google-boot -> ../../sda lrwxrwxrwx. 1 root root 10 Aug 2 01:12 google-boot-part1 -> ../../sda1 lrwxrwxrwx. 1 root root 9 Aug 18 18:48 google-persistent-disk-1 -> ../../sdb lrwxrwxrwx. 1 root root 9 Aug 2 01:12 scsi-0Google_PersistentDisk_boot -> ../../sda lrwxrwxrwx. 1 root root 10 Aug 2 01:12 scsi-0Google_PersistentDisk_boot-part1 -> ../../sda1 lrwxrwxrwx. 1 root root 9 Aug 18 18:48 scsi-0Google_PersistentDisk_persistent-disk-1 -> ../../sdb

As you can see, boot and persistent-disk-1 are displayed along with its device names /dev/sda and /dev/sdb.

Filed Under: Cloud, Linux Tagged With: disks, display, gcp, id, names, volumes

AWS Get Account ID

March 6, 2021

Here’s a quick way to find the AWS Account ID via AWS CLI.

aws sts get-caller-identity --query Account --output text

aws sts get-caller-identity --query Account --output text

Output is a 12 digit number (redacted)

xxxxxxxxxxxx

xxxxxxxxxxxx

AWS Account ID is a 12 digit number unique to each AWS account. Occasionally, there are scripts and policies that need the ID of the account. The command above is one way of querying the account ID so they can be used for policies that need them.

Filed Under: Cloud Tagged With: account, aws, cli, get, id

GCP Projects List

March 26, 2020

Here’s how to get a list of GCP projects.

gcloud projects list

gcloud projects list

Result:

PROJECT_ID            NAME     PROJECT_NUMBER
your-project-id-xxxx  servers  xxxxxxxxxxxx

PROJECT_ID NAME PROJECT_NUMBER your-project-id-xxxx servers xxxxxxxxxxxx

Use awk to display the project id only.

gcloud projects list | awk '{print $1}'

gcloud projects list | awk '{print $1}'

Result

PROJECT ID
your-project-id-xxxx

PROJECT ID your-project-id-xxxx

Filed Under: Cloud Tagged With: awk, gcp, id, list, projects

WP_Query Reverse Sort

March 25, 2019

Here’s how to reverse sort WP_Query. Order by ID. Reverse sort by ASC intead of DESC.

  $args = array (
    'cat' => 8, 
    'year' => $year, 
    'orderby' => 'ID',
    'order' => 'ASC', 
    'posts_per_page' => -1, 
    'paged' => $paged, 
    's' => $searchterm 
  );
  $category_posts = new WP_Query($args);

$args = array ( 'cat' => 8, 'year' => $year, 'orderby' => 'ID', 'order' => 'ASC', 'posts_per_page' => -1, 'paged' => $paged, 's' => $searchterm ); $category_posts = new WP_Query($args);

Filed Under: WP Tagged With: id, post, reverse, sort, wp_query

Create Group With ID

March 22, 2019

Here’s how to create a Linux group with a specific ID. Group name is nginx in this example. ID is 1000.

groupadd nginx -g 1000

groupadd nginx -g 1000

Filed Under: Linux Tagged With: create, group, id

  • Home
  • About
  • Archives

Copyright © 2023