Thursday, July 15, 2021

What does 'total' mean in "ls" command output ?

What does 'total' mean in "ls" command output ?

https://lists.fedoraproject.org/pipermail/users/2006-November/317250.html

> ls -la

> total 8

> drwxr-xr-x 2 fajar users 4096 2006-11-06 11:12 .

> drwxr-xr-x 3 fajar users 4096 2006-11-06 11:12 ..

> What 'total 8' stands for?

> Thank you very much.


That is the total number of file system blocks, including indirect

blocks, used by the listed files. 

How to see Sizes in MB/GB for Linux 'ls' command

https://net2.com/how-to-display-files-sizes-in-mb-in-linux-ubuntu/

Want to read Size in MB/GB for ls ?

ls -lh

Difference between "ls -1" and "ls -l" ?

 Difference between  "ls -1" and "ls -l" ?

ls -1
ls -l

AWS : EC2 Key Pairs : How to connect if I lose my Private Key : Replace Your SSH Keys: Login : AWS Key Lost


https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-key-pairs.html


A key pair, consisting of a public key and a private key, is a set of security credentials that you use to prove your identity when connecting to an EC2 instance. Amazon EC2 stores the public key on your instance, and you store the private key. 


Create a key pair using Amazon EC2

Create a key pair using a third-party tool and import the public key to Amazon EC2

Tag a public key

Retrieve the public key from the private key

Retrieve the public key through instance metadata

Locate the public key on an instance

Identify the key pair that was specified at launch

Verify your key pair's fingerprint

Add or replace a key pair for your instance

Delete your key pair

Delete a public key from an instance


--------------------------------------------------------------------------------------------------------

::Connect to your Linux instance if you lose your private key::

Lost Private key --> Detach from orig- Attach to Temp - Modify authorized_keys - Detach from Temp - Attach Again to orig


https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/replacing-lost-key-pair.html


Step 1: Create a new key pair

Step 2: Get information about the original instance and its root volume

Step 3: Stop the original instance

Step 4: Launch a temporary instance

Step 5: Detach the root volume from the original instance and attach it to the temporary instance

Step 6: Add the new public key to authorized_keys on the original volume mounted to the temporary instance

Step 7: Unmount and detach the original volume from the temporary instance, and reattach it to the original instance

Step 8: Connect to the original instance using the new key pair

Step 9: Clean up

--------------------------------------------------------------------------------------------------------

To add or replace a key pair


Connect to Instance using old mechanism=>  Public Keys => add new Key => authorized-keys


https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-key-pairs.html#replacing-key-pair


Linux Variables: Shell Variables: Local Variables : Environment Variables

 https://www.tutorialspoint.com/unix/unix-using-variables.htm

https://www.serverlab.ca/tutorials/linux/administration-linux/how-to-set-environment-variables-in-linux/

export NAME=VALUE

export JAVA_HOME=/opt/openjdk11


unset VARIABLE_NAME

unset JAVA_HOME


::Listing All Set Environment Variables::

set


variable_name=variable_value

NAME="John Doe"

echo $NAME


readonly NAME


export NAME


Linux Variable Types

When a shell is running, three main types of variables are present −

Local Variables

Environment Variables 

Shell Variables 

AWS : Capacity Reservation: AWS Calculator : Savings Plan: Reserved Instances :Compute Savings Plans : EC2 Instance Savings Plans

Capacity Reservation

 When you create a Capacity Reservation, we reserve the specified capacity for your use. The reserved capacity is charged at the selected instance type’s On-Demand rate whether an instance is running in it or not. You can also use your regional reserved instances with your Capacity Reservations to benefit from billing discounts.


https://calculator.aws/#/

AWS Calculator


Reserved Instances

 Platform[Linux, Windows], Tenancy[Default/Dedicated], Offering class[Convertible,Standard] 

 Instance type[c2.medium], Term[1 year/3 Years], Payment option[Partial, Upfront, None]


 

Savings Plan

Savings Plans also offer significant savings on your Amazon EC2 costs compared to On-Demand Instance pricing. With Savings Plans, you make a commitment to a consistent usage amount, measured in USD per hour. This provides you with the flexibility to use the instance configurations that best meet your needs and continue to save money, instead of making a commitment to a specific instance configuration

---------------------------------------

SageMaker Savings Plans

Compute Savings Plans

EC2 Instance Savings Plans

---------------------------------------

Compute Savings Plans [Better than EC2 Instance Savings Plan]

Applies to EC2 instance usage, AWS Fargate, and AWS Lambda service usage, regardless of region, instance family, size, tenancy, and operating system.

Term, Payment option, Purchase commitment [Hourly commitment]

---------------------------------------

EC2 Instance Savings Plans

Applies to instance usage within the committed EC2 family and region, regardless of size, tenancy, and operating system.

Region,Instance family, Term, Payment option, Purchase commitment [Hourly commitment]

Tuesday, July 13, 2021

Docker Compose

  • docker-compose logs --follow elasticsearch
  • docker-compose -f docker-compose.elastic.yml up -d
  • docker-compose ps 
  • docker-compose down 
  • docker-compose up 
  • docker-compose -f filename up
  • docker-compose images
  • docker-compose down -v                                                [Removes all volumes created by docker]

Commands:
  build              Build or rebuild services
  bundle             Generate a Docker bundle from the Compose file
  config             Validate and view the Compose file
  create             Create services
  down               Stop and remove containers, networks, images, and volumes
  events             Receive real time events from containers
  exec               Execute a command in a running container
  help               Get help on a command
  images             List images
  kill               Kill containers
  logs               View output from containers
  pause              Pause services
  port               Print the public port for a port binding
  ps                 List containers
  pull               Pull service images
  push               Push service images
  restart            Restart services
  rm                 Remove stopped containers
  run                Run a one-off command
  scale              Set number of containers for a service
  start              Start services
  stop               Stop services
  top                Display the running processes
  unpause            Unpause services
  up                 Create and start containers
  version            Show the Docker-Compose version information


Azure - Pipeline - Add Approver for Stage

https://learn.microsoft.com/en-us/azure/devops/pipelines/process/approvals?view=azure-devops&tabs=check-pass