Uly.me

cloud engineer

  • Home
  • About
  • Archives
Home/Archives for Cloud

January 6, 2021

AWS Create Backup Vault

Here’s how to create a backup vault in AWS Backup.

aws backup create-backup-vault --backup-vault-name my-efs-vault --profile default --region us-east-1

aws backup create-backup-vault --backup-vault-name my-efs-vault --profile default --region us-east-1

To delete a vault, run this command.

aws backup delete-backup-vault --backup-vault-name my-efs-vault --profile default --region us-east-1

aws backup delete-backup-vault --backup-vault-name my-efs-vault --profile default --region us-east-1

January 4, 2021

AWS EFS Tags

This script add new tags if they are missing.

#!/bin/bash
log="log.txt"
id=$(aws efs describe-file-systems --query "FileSystems[*].[FileSystemId]" --output text --region us-east-1)
tag=$(aws efs describe-file-systems --query "FileSystems[*].Tags[?Key=='aws-backup'].Value" --output text --region us-east-1 )
 
arr[0]="efs-0000"
arr[1]="efs-0400"
arr[2]="efs-0800"
arr[3]="efs-1200"
arr[4]="efs-1600"
arr[5]="efs-2000"
 
rand=$[ $RANDOM %6 ]
backup=${arr[$rand]}
 
if [[ $tag == "" ]]; then
  aws efs tag-resource --resource-id $id --tags Key="aws-backup",Value=${arr[$rand]} --profile default --region us-east-1
  echo "Added backup tag $backup to $id" 
elif [[ $tag == "no-backup" ]]; then
  echo "No backup on $id."
else
  echo "No changes done to $id."
fi

#!/bin/bash log="log.txt" id=$(aws efs describe-file-systems --query "FileSystems[*].[FileSystemId]" --output text --region us-east-1) tag=$(aws efs describe-file-systems --query "FileSystems[*].Tags[?Key=='aws-backup'].Value" --output text --region us-east-1 ) arr[0]="efs-0000" arr[1]="efs-0400" arr[2]="efs-0800" arr[3]="efs-1200" arr[4]="efs-1600" arr[5]="efs-2000" rand=$[ $RANDOM %6 ] backup=${arr[$rand]} if [[ $tag == "" ]]; then aws efs tag-resource --resource-id $id --tags Key="aws-backup",Value=${arr[$rand]} --profile default --region us-east-1 echo "Added backup tag $backup to $id" elif [[ $tag == "no-backup" ]]; then echo "No backup on $id." else echo "No changes done to $id." fi

January 2, 2021

AWS CLI Display Tags

This command lists the EC2 instance id and the tag name using query.

aws ec2 describe-instances \
--query 'Reservations[].Instances[].[InstanceId,Tags[?Key==Name]|[0].Value]' \
--profile tfc \
--region us-east-2 \
--output text

aws ec2 describe-instances \ --query 'Reservations[].Instances[].[InstanceId,Tags[?Key==Name]|[0].Value]' \ --profile tfc \ --region us-east-2 \ --output text

Output:

i-xxxxxxxxxxxxxxxxx     server-one
i-xxxxxxxxxxxxxxxxx     server-two
i-xxxxxxxxxxxxxxxxx     server-three

i-xxxxxxxxxxxxxxxxx server-one i-xxxxxxxxxxxxxxxxx server-two i-xxxxxxxxxxxxxxxxx server-three

|[0].Value insures output is one instance record per line.

January 1, 2021

AWS LightSail Blueprints

Amazon Lightsail offers a variety of OS blueprints, starting from Amazon Linux 2, Ubuntu 20, Windows Server 2019 to Debian 10 to name just a few. Blueprints are a curated selection of operating systems and software that are preinstalled for the creation of instances. For brevity, only a subset of blueprints are displayed below. The description and licenseUrl portions are truncated. To display an entire list of LightSail blueprints, run this command.

aws lightsail get-blueprints --region us-east-1

aws lightsail get-blueprints --region us-east-1

Output:

{
  "blueprints": [
        {
            "blueprintId": "ubuntu_20_04",
            "name": "Ubuntu",
            "group": "ubuntu_20",
            "type": "os",
            "description": "Ubuntu 20.04 LTS - Focal. Lean, fast and powerful, Ubuntu Server delivers services reliably ...",
            "isActive": true,
            "minPower": 0,
            "version": "20.04 LTS",
            "versionCode": "1",
            "productUrl": "https://aws.amazon.com/marketplace/pp/B087QQNGF1",
            "licenseUrl": "https://d7umqicpi7263.cloudfront.net/eula/product/aced0818- ... .txt",
            "platform": "LINUX_UNIX"
        },
        {
            "blueprintId": "wordpress",
            "name": "WordPress",
            "group": "wordpress",
            "type": "app",
            "description": "Bitnami, the leaders in application packaging, and Automattic, the experts behind WordPress .... ",
            "isActive": true,
            "minPower": 0,
            "version": "5.6.0",
            "versionCode": "1",
            "productUrl": "https://aws.amazon.com/marketplace/pp/B00NN8Y43U",
            "licenseUrl": "https://d7umqicpi7263.cloudfront.net/eula/product/7d426cb7- ... .txt",
            "platform": "LINUX_UNIX"
        }
}

{ "blueprints": [ { "blueprintId": "ubuntu_20_04", "name": "Ubuntu", "group": "ubuntu_20", "type": "os", "description": "Ubuntu 20.04 LTS - Focal. Lean, fast and powerful, Ubuntu Server delivers services reliably ...", "isActive": true, "minPower": 0, "version": "20.04 LTS", "versionCode": "1", "productUrl": "https://aws.amazon.com/marketplace/pp/B087QQNGF1", "licenseUrl": "https://d7umqicpi7263.cloudfront.net/eula/product/aced0818- ... .txt", "platform": "LINUX_UNIX" }, { "blueprintId": "wordpress", "name": "WordPress", "group": "wordpress", "type": "app", "description": "Bitnami, the leaders in application packaging, and Automattic, the experts behind WordPress .... ", "isActive": true, "minPower": 0, "version": "5.6.0", "versionCode": "1", "productUrl": "https://aws.amazon.com/marketplace/pp/B00NN8Y43U", "licenseUrl": "https://d7umqicpi7263.cloudfront.net/eula/product/7d426cb7- ... .txt", "platform": "LINUX_UNIX" } }

In this example, I’m using the query option to display only the blueprints ids.

aws lightsail get-blueprints --query 'blueprints[*].[blueprintId]' --output text --region us-east-1

aws lightsail get-blueprints --query 'blueprints[*].[blueprintId]' --output text --region us-east-1

Output:

windows_server_2019
windows_server_2016
windows_server_2012
windows_server_2016_sql_2016_express
amazon_linux_2
amazon_linux
ubuntu_20_04
ubuntu_18_04
ubuntu_16_04_2
debian_10
debian_9_5
debian_8_7
freebsd_12
opensuse_15_1
centos_7_1901_01
wordpress
wordpress_multisite
lamp_7
nodejs
joomla
magento
mean
drupal
gitlab
redmine
nginx
ghost_bitnami
django_bitnami
plesk_ubuntu_18_0_28
cpanel_whm_linux

windows_server_2019 windows_server_2016 windows_server_2012 windows_server_2016_sql_2016_express amazon_linux_2 amazon_linux ubuntu_20_04 ubuntu_18_04 ubuntu_16_04_2 debian_10 debian_9_5 debian_8_7 freebsd_12 opensuse_15_1 centos_7_1901_01 wordpress wordpress_multisite lamp_7 nodejs joomla magento mean drupal gitlab redmine nginx ghost_bitnami django_bitnami plesk_ubuntu_18_0_28 cpanel_whm_linux

December 24, 2020

AWS CloudShell

AWS just added a new feature called CloudShell. It will give users who are logged in to the AWS console access to a VM where users can run AWS CLI commands. Permissions to AWS resources is based on the user’s permissions which are managed via IAM. CloudShell is similar to the cloud shells that Azure and GCP already offer. Here’s a snapshot of AWS CloudShell.

  • « Previous Page
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • …
  • 52
  • Next Page »
  • Cloud
  • Linux
  • Git

Copyright © 2012–2021