Skip to main content

Posts

Google Cloud Storage Command-line Utility [GSUTIL]

GSUTIL Command-line utility for Google Cloud Storage Create Bucket (Including Storage Class, Location) gsutil mb -c [storage class] -l [location] gs://bucket-name Remove Bucket  gsutil rm -r gs://bucket-name Parallel multi-threading copy  gsutil -m cp -r . gs://bucket-name Turn on versioning on bucket (get details of versioning enable or not)  gsutil versioning get gs://bucket-name Set versioning off gsutil versioning set off gs://bucket-name Enable the versioning gsutil versioning set on gs://bucket-name List all version of a file gsutil ls -a gs://bucket-name Long listing format generation and meta-generation gsutil ls -al gs://bucket-name Changes the storage class of a object in a bucket  gsutil rewrite -s NEARLINE gs://bucket-name/* Change the storage class of multiple objects (Multi-Threading Parallel)  gsutil -m rewrite -s NEARLINE gs://bucket-name/* Access Control List (ACL) on objects (Public access to the general public) gsutil acl ch -u AllUsers:R gs:...

How to transfer Google Cloud Storage One account data to Google Cloud another account?

                                                          Image Source: infiflex.com Step 1: Go to the account where storage bucket are resides. Select the Select the Bucket, you want to transfer data and Click on SHOW INFO PANEL on the Top Right. Step 2: Under PERMISSIONS click on Add members. Now type the email id of the another account where you want to transfer all of your files in New Members Box. Select Role Storage > Storage Admin. Step 3: Now, Go to second account, Go to your storage bucket and select and repeat the last steps but this time email id will be the 1st account email id. All Set. Step 4: Finally Go to First account open the Google Cloud Shell and run the following command - gsutil -m cp -r gs://SOURCE-BUCKET-NAME /* gs://DESTINATION-BUCKET-NAME /

Setup and Configure AWS CLI on EC2 Instances

For Linux Systems Prerequisites:  You must ensure that you have at least Python 2 version 2.6.5+ or Python 3 version 3.3+ installed. To verify your current version, run the command: python --version Installation: The recommendation for installing the AWS CLI is to use the bundled installer provided by AWS. The bundled installer includes all dependencies required for the installation.  Step 1. To begin the installation run the following command: sudo curl "https://s3.amazonaws.com/aws-cli/awscli-bundle.zip" -o "awscli-bundle.zip" Step 2. Next, you must unzip the downloaded package from step 1: sudo unzip awscli-bundle.zip Step 3. Once the package in unzipped, you can run the installation: sudo ./awscli-bundle/install -i /usr/local/aws -b /usr/local/bin/aws Using the -b option allows all users to use the AWS CLI from any directory, meaning you will not need to specify the install directory in the user’s $PATH variable.  Step 4. Check the installed version /usr/local/b...

How to create users for your EC2 Instance that can connect securely via ssh

Public and Private Keys for AWS Users Create a normal user in AWS sudo adduser username How to add user in sudo group or wheel group sudo usermod --groups sudo --append username Allow user to run the sudo command without asking the password root ALL=(ALL) ALL username ALL=(ALL) NOPASSWD:ALL Or you can add complete sudo or wheel group. The users under sudo or wheel group run sudo command with asking password to sudo users %wheel ALL=(ALL) NOPASSWD:ALL %sudo ALL=(ALL) NOPASSWD:ALL To switch to the user directory cd /home/username Run the following command inside the user home directory to generate keys ssh-keygen - b 4096 -f username -t rsa To create the .ssh directory under user home directory mkdir .ssh Give permission to the owner to read, write and execute (700)  chmod 700 .ssh To store public key in authorized_keys file (after exit from the username   ) sudo cat username .pub >> .ssh/authorized_keys so that the owner can read and write to the file  chm...

How to remove Let's Encrypt SSL Certificate from CentOS 7 - 8

Please follow the steps to remove the Let's Encrypt SSL Certificate: First take a backup of letsencrypt directory under /etc - sudo cp -r /etc/letsencrypt/ /etc/letsencrypt.backup I deleted the ‘no longer needed domains’ in the three folders… rm -rf /etc/letsencrypt/live/${DOMAIN} rm -rf /etc/letsencrypt/renewal/${DOMAIN}.conf rm -rf /etc/letsencrypt/archive/${DOMAIN}

How to extend AWS EBS volumes with no downtime

This can be applied whenever you need to extend your EBS volume size avoiding to stop the instance and detach the volume.  In order to extend the volume size, follow these simple steps:  Login to your AWS console  Choose “EC2” from the services list  Click on “Volumes” under ELASTIC BLOCK STORE menu (on the left)  Choose the volume that you want to resize, right click on “Modify Volume”  You’ll see an option window like this one: If your filesystem is an ext2, ext3, or ext4, type:  Set the new size for your EBS volume (in this case i extended an 8GB volume to 20GB)  Click on modify.  Now, we need to extend the partition itself.  SSH to the EC2 instance where the EBS we’ve just extended is attached to.  Type the following command to list our block devices:  lsblk You should be able to see a similar output: NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT xvda 202:0 0 20G 0 disk └─xvda1 202:1 0 8G 0 part / As you can see...

How to create Swap partition in CentOS 7? or MySQL frequently stopped

Hello Friends, I am writing this post because one of my friend was facing the issue of MySQL or MariaDB service frequently stop every 2-3 days.  I have also faced this issue several time in the past. Hope this post will help you, if you are also facing the similar issue. First thing first, If you are using AWS and t2-micro free-tier or Digital Ocean smaller droplet or any least configuration machine. You need to upgrade your server also please keep eye on your disk space. As this post is all about to Add SWAP space and increase SWAP memory. Let's understand What is SWAP space or memory Swap space or memory is a space in the Hard Disk of your computer that Operating Systems will use to put the info that is actually on the RAM to free it for another application. This should be done when the system needs memory for a new process. Now come to the point. To Check available SWAP space sudo swapon -s         or sudo swapon --show There are two way to accomplish this - ...