0% found this document useful (0 votes)
60 views26 pages

AWS SysOps Operations Guide

The document outlines the essential operations for AWS system administrators, including deploying, monitoring, optimizing, fortifying, and securing systems. It provides guidance on using the AWS CLI, configuring it, and utilizing various AWS SDKs for programming. Additionally, it includes practical activities, scripts, and resources for further learning about AWS system operations.

Uploaded by

macolindres
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
60 views26 pages

AWS SysOps Operations Guide

The document outlines the essential operations for AWS system administrators, including deploying, monitoring, optimizing, fortifying, and securing systems. It provides guidance on using the AWS CLI, configuring it, and utilizing various AWS SDKs for programming. Additionally, it includes practical activities, scripts, and resources for further learning about AWS system operations.

Uploaded by

macolindres
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

SYSTEM OPERATIONS IN AWS

SYSTEM OPERATIONS IN AWS - MODULE 1


AWS Certified SysOps Administrator
Question Domains

[Link]
System Operators

 Deploying systems
 Monitoring systems
 Optimizing Systems
 Fortifying Systems
 Securing Systems
Reference Architecture: Three-Tier Design
Reference Architecture: Serverless Design
System Operations Using AWS Toolset

 AWS Console
 AWS CLI
 AWS Tools for PowerShell
 AWS SDKs
Installing the AWS CLI

Linux /MAC OS Windows


 Use the following command:  Download and run the MSI Installer at:
pip install awscli [Link]
cli/[Link]
 To Upgrade
pip install –upgrade awscli
Configuring the AWS CLI

 Use the command aws configure


 AWS CLI prompts you for information:
 AWS Access Key
$ aws configure
 AWS Secret Key AWS Access Key ID [None]: AKIAIZO6PO5YKASXZC3A
AWS Secret Access Key [None]:
 Default region name /qvQ5xXCjXtex20lynAo0dZ62IAGQrrNCk/QUfp1
 Default output format Default region name [None]: us-east-1
Default output format [None]: table
$
Actividad – AWS CLI for Windows
 Download the MSI Installer ([Link]
 Run the downloaded MSI installer.
 Follow the instructions that appear.
 Open a command prompt.
 Type aws --version.
 Configure the AWS CLI by running the command aws configure and filling in the access key
and secret key for your user. Optionally (but highly recommended), specify a default region,
such as us-east-1. Also optionally, specify a default format type.
 Test that you have set up the AWS CLI correctly and can connect to the AWS API endpoints by
running the command aws ec2 describe-availability-zones. The AWS CLI
should return a list of the available Availability Zones in your default region.
Config and Credential Files

Settings configured with aws configure command are stored at:


 File named credentials under your home directory in the .aws subdirectory
 File named configuration under your home directory in the .aws subdirectory

$ cat credentials
[default]
aws_access_key_id = AKIAIZO6PO5YKASXZC3A
aws_secret_access_key = /qvQ5xXCjXtex20lynAo0dZ62IAGQrrNCk/QUfp1
$

$ cat config
[default]
region = us-west-2
output = json
Using Named Profiles

 Option 1: Edit the config and credentials files


Using Named Profiles

 Option 2: Directly from CLI with --profile option

 Use the profile with the --profile option


$ aws s3 ls --profile user2
AWS CLI COMMAND STRUCTURE
$ aws <command> <subcommand> [options and parameters]

 aws – issues a base call to AWS


 command – shows the top-level command (usually an AWS service like ec2 or s3)
 subcommand – specifies the operation you want to perform for that service
 options – enable you to specify exactly what you need the subcommand do
 parameters – have string or numeric values

$ aws ec2 create-key-pair --key-name sam-key-pair


AWS CLI Help

 To view all available commands


$ aws help
 To view available subcommands for a service
$ aws ec2 help
 To learn how to use a specific subcommand
$ aws ec2 describe-instances help
Controlling the Command Output

Unlike many other CLIs, the AWS CLI enables you to select the format of the output:
 JSON (Default) – Best for programatic use
 Table – Best for human Reading
 Text – Best when using text processing tools in scripts

Use the --output option on the command line:


$ aws ec2 describe-regions --output table
Filtering the Output of a Command

 The --query parameter is used to filter the output


 It uses JMESPath query language
Avoiding Unwieldy Lines
aws rds download-db-log-file-portion --db-instance-identifier awstest1 --log-file-name "error/[Link]“

 In Linux or Mac you can use the backslash character to separate a command line into
several lines:
aws rds \
download-db-log-file-portion \
--db-instance-identifier awstest1 \
--log-file-name "error/[Link]“
AWS Software Development Kits (SDKs)
AWS SDKs are available for the following programming languages:

 Android
 PHP
 JavaScript
 Python
 iOS
 Ruby
 Java
 Go
 .NET
 C++
 [Link]
Boto - AWS SDK for Python
Python must be installe prior to boto3 installation
 Use the comand:
pip install boto3

 Python and Pip must be installed prior to installing boto3


 It contains a variety of APIs that operate at either a high level or a low level.
 Waiter is a future provided by boto that allow for code to wait for changes o occur in the
cloud.
 To use Boto in Python code import the Boto SDK
import boto3
Interactive productivity with aws-shell
Laboratorio

 Preparar VM con Linux como entorno Virtual


 Instalar Python
 Instalar pip
 Instalar aws-cli
 Configurar perfiles personalizados
Sample bash script
#!/bin/bash
region="us-east-1"
vols=`aws ec2 describe-volumes --region $region --filters \
Name=status,Values=available \
--output text \
--query Volumes[].VolumeId | tr -s '\t' '\n'`

for i in $vols; do
aws ec2 delete-volume --region $region --volume-id $i --dry-run
done
Sample bash script
1. Lanzar una instancia EC2
2. Crear dos volúmenes ebs de 1 GB, sin adjuntarlos a ninguna instancia
3. Configurar perfil con aws configure
4. Verificar comando para listar volúmenes (con la opción de filtro para extraer el volumen id
de los volúmenes que están en estado disponible
5. Crear script de prueba en directorio home user de la instancia de Linux
 Salvar archivo como ebs_remove_test.sh, cambiar permisos con comando chmod +x
6. Lanzar script de prueba (./ebs_remove_test.sh)
7. Crear script para ejecución
 Salvar archivo como ebs_remove_prod.sh, asignar permiso de ejecución (chmod +x)
8. Lanzar script de ejecución (./ebs_remove_prod.sh)
Resources to Review

 The AWS CLI User Guide at: [Link]


 Command Line Interface on Microsoft Windows:
[Link]
 Tools for PowerShell: [Link]
 JMESPath query language: [Link]
 BOTO General Feature Guides:
[Link]

You might also like