AWS SysOps Administrator Course Slides
AWS SysOps Administrator Course Slides
Welcome
SOA-C02 Exam Guide
Instructions
relating to the
task will be
included here
Domain % of Examination
Domain 1: Monitoring, Logging, and Remediation 20%
EJPx!*21p9%
Region
VPC
Main Route Table
Subnets are
created within
Availability Zone Destination Target
AZs Public subnet
172.31.0.0/16 Local
0.0.0.0/0 igw-id
EC2 Instance
An Internet Gateway is
used to connect to the
Internet
Multiple VPCs
VPC VPC
CIDR 172.31.0.0/16 CIDR 10.0.0.0/16
VPC
S3 Gateway Endpoint
Availability Zone
Public subnet
Private services can
Amazon DynamoDB Amazon S3 have public IP
addresses but exist
within the VPC
Availability Zone
Availability Zone
Router
Private subnet Public subnet
Security Security
Group B Group A
Security Security
Group A Groups can be
applied to Network ACL
Network ACL
instances in
any subnet
Stateful vs Stateless Firewalls
Staff training Data encryption IAM User Network ACL SSL encryption EC2 Instance Elastic load
balancer
AWS RESPONSIBILITY
Server
Network router Disk drive
SECTION 3
Compute: Amazon EC2
and AWS Lambda
Amazon Elastic Compute Cloud
EC2 instances
run Windows or
Linux OS
An EC2 instance
is a virtual server
EBS Snapshot
Memory optimized r5ad.large 2 16
Storage optimized d2.xlarge 4 30.5
GPU instances g2.2xlarge 8 15
Linux Microsoft
Windows
Amazon EC2 Reserved Instances
Burstable instances
Ø T3, T3a, and T2 instances, are designed to provide a baseline level of CPU
performance with the ability to burst to a higher level when required
Ø Burstable performance instances are the only instance types that use
credits for CPU usage
Ø A CPU credit provides for 100% utilization of a full CPU core for one
minute
Ø Each burstable performance instance continuously earns (at a
millisecond-level resolution) a set rate of CPU credits per hour, depending
on the instance size
Amazon EC2 Reserved Instances
T2/T3 Unlimited
Ø T2 instances are a low-cost, general purpose instance type that provides a
baseline level of CPU performance with the ability to burst above the
baseline when needed
Ø T2 Unlimited instances can sustain high CPU performance for as long as a
workload needs it
Ø The baseline performance and ability to burst are governed by CPU Credits
Ø T2 instances accumulate CPU Credits when they are idle, and consume CPU
Credits when they are active
Launching an Amazon EC2 instance
Shutdown behavior
Ø Configure to Stop or Terminate (applies to OS-level shutdown)
Ø Can additionally enable hibernation (stores contents of RAM on the root volume)
Termination Protection
Ø You can protect instances from being accidentally terminated
Ø Once enabled, you won't be able to terminate the instance via the API or the AWS
Management Console until termination protection has been disabled
How to Change the EC2 Instance Type
Ø Cluster – packs instances close together inside an Availability Zone. This strategy enables
workloads to achieve the low-latency network performance necessary for tightly-coupled
node-to-node communication that is typical of HPC applications.
Ø Partition – spreads your instances across logical partitions such that groups of instances in
one partition do not share the underlying hardware with groups of instances in different
partitions. This strategy is typically used by large distributed and replicated workloads, such
as Hadoop, Cassandra, and Kafka.
Ø Spread – strictly places a small group of instances across distinct underlying hardware to
reduce correlated failures.
Cluster Placement Groups
Region
VPC
Availability Zone
Region
VPC
Each partition is located on a
Availability Zone separate AWS rack Availability Zone
Partitions can be in
multiple AZs
(up to 7 per AZ)
EC2 Instances EC2 Instances EC2 Instances
Spread Placement Groups
Region
VPC
A Reserved Instance has four instance attributes that determine its price:
Ø Instance type: For example, m4.large
Ø Region: The Region in which the Reserved Instance is purchased
Ø Tenancy: Whether your instance runs on shared (default) or single-tenant
(dedicated) hardware
Ø Platform: The operating system; for example, Windows or Linux/Unix
Amazon EC2 Reserved Instances
Term commitment:
Ø One-year: A year is defined as 31536000 seconds (365 days)
Ø Three-year: Three years is defined as 94608000 seconds (1095 days)
Amazon EC2 Reserved Instances
Payment Options
Ø All Upfront: Full payment is made at the start of the term, with no other costs or
additional hourly charges incurred for the remainder of the term, regardless of hours
used
Ø Partial Upfront: A portion of the cost must be paid upfront and the remaining hours
in the term are billed at a discounted hourly rate, regardless of whether the Reserved
Instance is being used
Ø No Upfront: You are billed a discounted hourly rate for every hour within the term,
regardless of whether the Reserved Instance is being used
Amazon EC2 Reserved Instances
Offering class:
Ø Standard: These provide the most significant discount but can only be modified
Ø Convertible: These provide a lower discount than Standard Reserved Instances but
can be exchanged for another Convertible Reserved Instance with different instance
attributes
Amazon EC2 Reserved Instances
No charge
Data Packets
Src: 3.104.75.244
Linux OS
Dest: 172.31.32.63
Internet
eth0 Private-IP – e.g. 172.31.32.63 gateway
Public / Elastic IP – e.g. 3.104.75.244
EC2 Instance
IGW performs 1:1 NAT
Src: 3.104.75.244
Internet
eth1 Private-IP – e.g. 172.31.10.10
gateway
Public / Elastic IP – e.g. 3.104.75.244
AWS Cloud
Public subnet
AWS CLI configured
with access keys
Private subnet
AWS Cloud
VPC
IAM Role
S3 Bucket EC2 Instance
Private subnet
Policy
IAM Instance Profiles
Ø An instance profile is a container for an IAM role that you can use to
pass role information to an EC2 instance when the instance starts
Ø An instance profile can contain only one IAM role, although a role
can be included in multiple instance profiles
EC2 Instance
Application
IAM Role
IAM Instance Profiles
You can use the following AWS CLI commands to work with instance profiles:
Ø Create an instance profile: aws iam create-instance-profile
Ø Add a role to an instance profile: aws iam add-role-to-instance-
profile
Ø List instance profiles: aws iam list-instance-profiles, aws iam
list-instance-profiles-for-role
Ø Get information about an instance profile: aws iam get-instance-profile
Ø Remove a role from an instance profile: aws iam remove-role-from-
instance-profile
Ø Delete an instance profile: aws iam delete-instance-profile
Private Subnets and Bastion Hosts
Region
Destination Target
172.31.0.0/16 Local
NAT Instance vs NAT Gateway
Code is executed
Developer uploads
some code
Function is
Function invocation executed
Lambda
AWS Lambda in a Virtual Private Cloud (VPC)
Region
VPC
Availability Zone
Elastic network
interface Instance
Invoke Lambda Function with Amazon SNS
Amazon CloudWatch
Event is written to
CloudWatch Logs
Submit notification
to SNS Topic
User
Invoke Lambda Function on a Schedule
Administrator needs to check if any EC2 instances will Check the AWS Personal Health Dashboard
be affected by scheduled hardware maintenance
Scheduled hardware maintenance will affect a critical Stop and start the instance to move it to different
EC2 instance underlying hardware
When launching an EC2 instance the This means AWS does not currently have enough
InsufficientInstanceCapacity error is capacity to service the request for that instance type.
experienced Try a different AZ or instance type
The error InstanceLimitExceeded is experienced EC2 instance limits have been reached, need to
when launching EC2 instances contact support to request an increased limit
Exam Scenarios
System status checks are failing for an EC2 instance Stop and start again to move to a new host
For security and compliance reasons EC2 instances Launch them in a private subnet without a NAT
must not be able to access the internet gateway or NAT instance
EC2 instances must communicate with an internet- Place the instances behind a NAT gateway as the
based service which whitelists a single source IP device will have a single elastic IP address that can be
address whitelisted
A distributed app is running on EC2 and can handle Use Spot instances as the application can handle it if
processing interruptions. Determine the best pricing the instances are terminated
model to use
Exam Scenarios
Define AWS’ responsibilities for EC2 hardware AWS are responsible for managing the health of the
according to the AWS Shared Responsibility Model underlying hosts
A nightly job runs on EC2 and stores results in S3. Request a Spot block for time period required
Takes 2 hours using multiple on-demand instances. If
it fails, it must start again. Determine the best pricing
model to use
An asynchronous process runs on EC2 and feeds data Use Spot instances as the asynchronous nature of the
to a data warehouse for weekly/monthly reporting. reporting means the app can handle interruption if
Determine the best pricing model to use AWS need the capacity back
Need to track EC2 and on-premise computer memory Install the unified CloudWatch agent on both EC2 and
utilization on-premises servers
Exam Scenarios
Amazon EC2 Auto Scaling automatically terminates Install the CloudWatch agent to stream logs to
unhealthy instances but Administrator needs to keep CloudWatch Logs
the logs for subsequent analysis
There is a suspected memory leak on an Amazon EC2 Install the CloudWatch agent to monitor memory
instance utilization
An AWS Lambda function is expected to see a large Ensure the concurrency limit is higher than the
increase in traffic and must scale expected simultaneous executions
Need to invoke an AWS Lambda function every 15 Create an event rule in Amazon CloudWatch events to
minutes execute the function periodically
SECTION 4
Scaling Compute: Elastic
Load Balancing and Auto
Scaling
Elastic Load Balancing (ELB) Concepts
Availability Zone
Public subnet
Instance 2
Instance 3 User 3
User 1 is
connected to
instance 4
Instance 4
Elastic Load Balancing (ELB) Types
Region
VPC
Availability Zone
Public-IPs /
EC2 Instance 1
Elastic IP
TCP, TLS
Target Group
Availability Zone
Network Load Internet Internet Client
Private subnet Public subnet Balancer gateway
Public-IPs /
Private-IP Elastic IP
EC2 Instance 2
Application Load Balancer (Internet-Facing)
Region
VPC
Availability Zone
Private-IP
EC2 Instance 1
Public-IPs
HTTP, HTTPS
Target Group
Availability Zone
Application Internet Internet Client
Private subnet Public subnet Load gateway
Balancer
Private-IP
Public-IPs
EC2 Instance 2
Application Load Balancer with Targets in Private Subnet
Region
ELB must be
VPC configured with public
subnet in same AZ as
Availability Zone private subnet
Private subnet Public subnet
Private-IP
Availability Zone
Application Internet Internet Client
Private subnet Public subnet Load gateway
Balancer
Public-IPs
Private-IP
EC2 Instance 2
ELB Health Checks
Instance
ELB Health Checks
Ø Each load balancer node checks the health of each target, using the health
check settings for the target groups with which the target is registered
Ø Each load balancer node routes requests only to the healthy targets in the
enabled Availability Zones for the load balancer
Ø If a target group contains only unhealthy registered targets, the load
balancer nodes route requests across its unhealthy targets
ELB Health Checks Settings
Setting Description
HealthCheckProtocol The protocol the load balancer uses when performing health checks
on targets.
HealthCheckPort The port the load balancer uses when performing health checks on
targets.
HealthCheckPath The ping path that is the destination on the targets for health
checks. Specify a valid URI (/path?query). The default is /.
HealthCheckTimeoutSe The amount of time, in seconds, during which no response from a
conds target means a failed health check.
HealthCheckIntervalSec The approximate amount of time, in seconds, between health
onds checks of an individual target.
HealthyThresholdCount The number of consecutive successful health checks required
before considering an unhealthy target healthy.
UnhealthyThresholdCo The number of consecutive failed health checks required before
unt considering a target unhealthy.
Matcher The HTTP codes to use when checking for a successful response
from a target. The possible values are from 200 to 499.
ELB Health Checks – Status Checks
Value Description
initial The load balancer is in the process of registering the target or performing the initial
health checks on the target
unhealthy The target did not respond to a health check or failed the health check
unused The target is not registered with a target group, the target group is not used in a
listener rule, the target is in an Availability Zone that is not enabled, or the target is in
the stopped or terminated state
Internet Client
Requests for
Listener HTTP:80
https://dctlabs.com go to
Target Group 1
Rule (default) Rule (/orders)
Requests for
https://dctlabs.com/orders
go to Target Group 2
Internet Client
Availability Zone
Public subnet
Client 1 connects
and is bound to Cookie expires and
Instance 1
Instance 1 for the ELB routes client to
New request from cookie lifetime Instance 4
Instance 2
Client 3 is routed
to Instance 3
Instance 3
EC2 Web Servers
Client 1
Instance 4 Client 3
Private subnet(s)
Web Front-End
Multi-Tier Web Architecture
Region
VPC
Availability Zone
NAT Gateway
Private subnet Public subnet
Internal
ALB
Auto Scaling Auto Scaling HTTP, HTTPS
group group
Availability Zone
Internet Internet Client
Private subnet Public subnet gateway
Private subnet(s)
Auto Scaling
launches extra
instance
EC2 Status
EC2 Instances Auto Scaling group EC2 Instances
Checks fail
CloudWatch
notifies Auto
Scaling to scale
ASG replaces
failed instance
Availability Zone
Public subnet
Instance 2
Auto Scaling
Availability Zone User 2
Public subnet
Elastic Load
Balancer
Instance 3 User 3
User 1 is
connected to
instance 4
Instance 4
Amazon Elastic Load Balancing with EC2 Auto Scaling
Availability Zone
Public subnet
Instance 2
Auto Scaling User 2
Availability Zone
Public subnet
Elastic Load
Balancer
User 3
Instance 3
Instance 4 User 4
Roles, monitoring,
tenancy etc.
Scheduled Scaling
Ø Scaling based on a schedule allows you to scale your application ahead of
known load changes
Ø For example, every week the traffic to your web application starts to
increase on Wednesday, remains high on Thursday, and starts to decrease
on Friday
Ø You can plan your scaling activities based on the known traffic patterns of
your web application
EC2 Auto Scaling – Types of Scaling
Dynamic Scaling
Ø Amazon EC2 Auto Scaling enables you to follow the demand curve for
your applications closely, reducing the need to manually provision
Amazon EC2 capacity in advance
Ø Amazon EC2 Auto Scaling will then automatically adjust the number of
EC2 instances as needed to maintain your target
EC2 Auto Scaling – Types of Scaling
Predictive Scaling
Ø Predictive Scaling, a feature of AWS Auto Scaling uses machine learning to
schedule the right number of EC2 instances in anticipation of approaching
traffic changes
Ø Predictive Scaling predicts future traffic, including regularly-occurring
spikes, and provisions the right number of EC2 instances in advance
Ø Configured through AWS Auto Scaling – it’s a layer on top of EC2 Auto
Scaling
Ø Probably won’t be on the exam yet
Auto Scaling Termination Policies – Default Policies
instances to the allocation strategy for the On-Demand or Spot Public subnet
Design required for highly available and secure Launch ALB in public subnets, web servers in private
website on EC2 with ALB, and DB on EC2 subnets and DB layer in private subnets – all layers
across AZs
HealthyHostCount metrics for an ALB have dropped The health checks on target EC2 instances are failing
from 6 to 2. Need to determine the cause
An instance attached to an ALB exceeded Health checks will continue and the ALB will take the
the UnhealthyThresholdCount for consecutive health instance out of service
check failures. What will happen?
Exam Scenarios
Requirement to track the source IP of clients and the Check the ALB access logs for this information
instance that processes the request
Requirement to trigger an alarm when all instances Use Amazon CloudWatch with the condition:
are unhealthy "AWS/ApplicationELB HealthyHostCount <= 0"
Need to check why users cannot connect to web Check the VPC Flow Logs
server public IP and port (behind ALB)
Exam Scenarios
HTTPCode_ELB_5XX_Count Amazon CloudWatch The target group may not contain any healthy
metrics are noticed for an ALB instances
CloudWatch shows 4XX errors for app with ALB but Use ELB access logs to retrieve info from S3 bucket to
the Instances have already been terminated and need find the originators of the requests
to analyze the root cause
Need a load balancer where specific static public IP Use a Network Load Balancer (NLB)
addresses can be whitelisted by clients
Exam Scenarios
Poor performance has been experienced for an Use EC2 Auto Scaling to dynamically scale
application running on Amazon EC2
503 and 504 errors experienced and instances have Use EC2 Auto Scaling to dynamically scale
high CPU utilization
ASG does not launch instances during busy periods Could be due to service limits (check Trusted Advisor)
despite max capacity not being reached or check for RunInstances requests in CloudTrail in
case they are failing
Need to analyze instances before they are terminated Use Auto Scaling lifecycle hooks to pause termination
Exam Scenarios
Auto Scaling scales based on queue depth but at Create a scheduled scaling policy
beginning of day app slows down
Create highly available EC2 Auto Scaling group for a Use at least 3 AZs, min size of 2, desired capacity of 2,
single instance app and max of 2
Elastic Beanstalk worker node reads messages from Update ASG to scale on queue depth
SQS queue. Auto Scaling scales instances. App slows
down when number of messages in queue increases
ALB is expecting a large spike in traffic and the Use the RequestCountPerTarget metric to control
application is memory heavy scaling
Exam Scenarios
New instances in an Auto Scaling group are not Likely due to the warm-up period having not yet
showing up in the aggregated metrics. Step scaling is expired
used
SECTION 5
Storage: Amazon EBS,
EFS, and AWS Storage
Gateway
Amazon Elastic Block Store (EBS) - Block-based Storage
Volumes are
attached over
a network
/dev/xvdf Mounted as a
volume in the
instance OS
EC2 Instance
Amazon EBS Deployment
EC2 instances
must be in the
same AZ as the
EBS volume
EC2 Instance EC2 Instance EC2 Instance
Amazon EBS Multi-Attach
Must be within
a single AZ
May not be on the
exam yet
Availability Zone
Must be a
Provisioned IOPS
io1 volume EBS Volume
Up to 16 instances
can be attached to
Available for Nitro a single volume
system-based
EC2 instances
Max Throughput/Volume 1,000 MB/s 250 MB/s 500 MB/s 250 MB/s
Amazon EBS Snapshots
Region
Availability Zone A
Amazon S3
Volume
EC2 Instance
Snap A Snap B Snap C
Availability Zone B
Volume
EC2 Instance
Take Snapshot, Create AMI, Launch New Instance
Region
Availability Zone A
Amazon S3
Volume
EC2 Instance
Snapshot
Availability Zone B
AMI
Volume
EC2 Instance
• Can change encryption
Amazon EBS Copying, Sharing and Encryption key
• Can change AZ
• Encryption state retained Encrypted Encrypted
• Same region Snapshot Volume
Volume Snapshot
• Block devices remain encrypted
Copy • Can be encrypted • Cannot be shared with other
• Can change regions accounts if using AWS CMK
Encrypted Encrypted
Snapshot • Cannot be shared publicly
Unencrypted Encrypted AMI
Snapshot Snapshot
Copy
• Block devices remain encrypted
• Can change regions
• Can be encrypted
Encrypted AMI Encrypted
• Can change AZ
Unencrypted Encrypted AMI
Snapshot Volume • Can change encryption
key
• Cannot be encrypted • Can change AZ
• Can be shared with Encrypted AMI
other accounts EC2 Instance
Unencrypted AMI • Can be shared publicly
Snapshot • Can change encryption
state
Copy • Can change encryption • Can change AZ
Unencrypted
key AMI EC2 Instance
• Can change regions
Encrypted Encrypted
Snapshot Snapshot
Amazon EBS vs Instance Store
Availability Zone
EBS Volume
Instance Store
volumes are
physically attached
EC2 Host Server to the host
Amazon EBS Instance Stores
Ø Instance store volumes are high performance local disks that are
physically attached to the host computer on which an EC2 instance
runs
Ø Instance stores are ephemeral which means the data is lost when
powered off (non-persistent)
Ø Instances stores are ideal for temporary storage of information that
changes frequently, such as buffers, caches, or scratch data
Ø Instance store volume root devices are created from AMI templates
stored on S3
Ø Instance store volumes cannot be detached/reattached
Using RAID with Amazon EBS
Ø RAID stands for Redundant Array of Independent disks
Ø Not provided by AWS, you must configure through your operating
system
Ø RAID 0 and RAID 1 are potential options on EBS
Ø RAID 5 and RAID 6 are not recommended by AWS
Using RAID with Amazon EBS
Ø RAID 0 is used for striping data across disks (performance)
Ø Use 2 or more disks
Ø If one disk fails, the entire RAID set fails
Data writes
Block 1 Block 2
Block 3 Block 4
Block 5 Block 6
Block 7 Block 8
Block 1 Block 1
Block 2 Block 2
Block 3 Block 3
Block 4 Block 4
EC2 Instance
Amazon EBS Encryption
Ø Expect the same IOPS performance on encrypted volumes as on unencrypted
volumes
Ø EBS encrypts your volume with a data key using the industry-standard AES-
256 algorithm
Ø Your data key is stored on-disk with your encrypted data, but not before EBS
encrypts it with your CMK. Your data key never appears on disk in plaintext
Ø The same data key is shared by snapshots of the volume and any subsequent
volumes created from those snapshots
Ø You can share snapshots, but if they're encrypted it must be with a custom
CMK key
Ø You can check the encryption status of your EBS volumes with AWS Config
CloudWatch Metrics for EBS
A few specific metrics to understand for the exam:
Ø DiskReadBytes / DiskWriteBytes:
Ø Relates to Instance Store volumes NOT to EBS
Ø Included in the AWS/EC2 namespace
Ø VolumeReadBytes / VolumeWriteBytes:
Ø Relates to the EBS volume
Ø Included in the AWS/EBS namespace
Amazon Data Lifecycle Manager
Automate the creation, retention, and deletion of EBS snapshots and
EBS-backed AMIs
Ø Protect valuable data by enforcing a regular backup schedule
Ø Create standardized AMIs that can be refreshed at regular intervals
Ø Retain backups as required by auditors or internal compliance
Ø Reduce storage costs by deleting outdated backups
Ø Create disaster recovery backup policies that back up data to
isolated accounts
Network Attached Storage
NIC
Network Attached
Storage Server (NAS)
On-premises
EFS File system VPN or Direct client
Connect connection
NFS Protocol
is used
On-premises
Availability Zone Availability Zone computers can
/efs-mnt /efs-mnt be connected
EFS is only available
for Linux instances
EC2 Instance EC2 Instance
Amazon EFS Backups and Lifecycle Management
Ø You can control file system admin using IAM (user-based and resource-based
policies)
Ø You can control the NFS clients access to file systems (resource-based
policies).
Ø You can control access to files and directories with POSIX-compliant user and group-
level permissions
Amazon Elastic File System (EFS)
Region
VPC
/efs-mnt /efs-mnt
Encryption In Transit
HTTPS Connection
SSL SSL
EC2 Instance EFS File system
Enabled when
mounting the
file system
Must be enabled
at file system
creation time EFS File system
AWS Storage Gateway
AWS Storage Gateway – File Gateway
Server S3 Standard IA
AWS Storage Gateway
Can store data
in multiple S3
A local cache provides A virtual gateway storage classes
low latency access to appliance runs on
recently used data S3 One Zone IA
Hyper-V, VMware,
or EC2
AWS Storage Gateway – File Gateway
Ø File gateway provides a virtual on-premises file server, which enables you to store
and retrieve files as objects in Amazon S3
Ø Can be used for on-premises applications, and for Amazon EC2-resident
applications that need file storage in S3 for object based workloads
Ø Used for flat files only, stored directly on S3
Ø File gateway offers SMB or NFS-based access to data in Amazon S3 with local
caching
Ø File gateway supports Amazon S3 Standard, S3 Standard – Infrequent Access (S3
Standard – IA) and S3 One Zone – IA
AWS Storage Gateway – Volume Gateway
Server S3 Standard
AWS Storage Gateway
Data backed up
STORED VOLUME MODE as EBS point-in-
iSCSI
time snapshots
Asynchronous replication
Server S3 Standard
AWS Storage Gateway
S3 standard is
Backup server can
used when
use many common S3 Standard writing to tapes
backup applications
AWS Storage Gateway – Tape Gateway
User deleted some data in an Amazon EBS volume Can create a new EBS volume from the snapshot and
and there's a recent snapshot attach it to an instance and copy the delete file across
EBS volume runs out of space and need to prevent it Use CloudWatch agent on EC2 and monitor disk
happening again metrics with CloudWatch alarm
Most cost-effective option for big data app that stores Cold HDD (sc1)
sequentially and infrequent access
EBS volume capacity is increased but cannot see the Need to extend the volume's file system to gain
space access to extra space
Exam Scenarios
Low latency access required for image files in an Use an AWS Storage Gateway volume gateway
office location with synchronized backup to offsite configured as a stored volume
location. Local access required and disaster recovery
Performance issues with iSCSI drives in volume Create a larger disk for cached volume and select it in
gateway. CacheHitPercent metric is below 55% and management console
CachePerecentUsed is above 95%
Tape archival system needs replacement Use an AWS Storage Gateway tape gateway
SECTION 6
Operations: AWS
Systems Manager and
OpsWorks
AWS Systems Manager
Ø AWS Systems Manager provides a unified interface through which you can view operational data
from multiple AWS services
Ø With Systems Manager, you can group resources by application, view operational data for
monitoring and troubleshooting, and take action on your groups of resources
AWS Systems Manager
Inventory
AWS Systems Manager – Patch Manager
Ø AWS Systems Manager helps you select and deploy operating system
and software patches automatically across large groups of Amazon EC2
or on-premises instances
Ø Patch baselines:
Ø Set rules to auto-approve select categories of patches to be
installed
Patch Manager
Ø Specify a list of patches that override these rules and are
automatically approved or rejected
Ø You can also schedule maintenance windows for your patches so that
they are only applied during predefined times
Ø Systems Manager helps ensure that your software is up-to-date and
meets your compliance policies
AWS Systems Manager – Configuration Compliance
Ø AWS Systems Manager lets you scan your managed instances for patch
compliance and configuration inconsistencies
Ø You can collect and aggregate data from multiple AWS accounts and
Regions, and then drill down into specific resources that aren’t
compliant
Ø By default, AWS Systems Manager displays data about patching and
associations
Ø You can also customize the service and create your own compliance
types based on your requirements (must use the AWS CLI, AWS Tools for
Windows PowerShell, or the SDKs)
AWS Systems Manager – Session Manager
No need for
bastion hosts
Amazon RDS
AWS Systems Manager Parameter Store
Retrieve database
connection string
Amazon RDS
AWS Secrets Manager
Ø Stores and rotate secrets safely without the need for code
deployments
AWS Secrets Manager
Ø Secrets Manager offers automatic rotation of credentials AWS Lambda
(built-in) for:
Ø Amazon RDS (MySQL, PostgreSQL, and Amazon Aurora)
Ø Amazon Redshift
Secrets automatically
Ø Amazon DocumentDB rotated periodically
Ø For other services you can write your own AWS Lambda
Amazon RDS
function for automatic rotation
AWS Secrets Manager vs SSM Parameter Store
Price Charges apply per secret Free for standard, charges for
advanced
AWS OpsWorks
Ø AWS OpsWorks is a configuration management service that provides
managed instances of Chef and Puppet
Ø Updates include patching, updating, backup, configuration and
compliance management
Instance
Instances are
Instance configured by
OpsWorks using
SysOps Admin AWS OpsWorks
Chef/Puppet
Instance
Configuration
Instance
changes are
submitted to
OpsWorks
Exam Scenarios
Application running on EC2 needs login credentials Create an IAM role for the instance and grant
for a DB that are stored as secure strings in SSM permission to read the parameters
Parameter Store
Linux instances are patched with Systems Manager Change maintenance window to patch 10% of
Patch Manager. Application slows down whilst instances in the patch group at a time
updates are happening
Custom Linux AMI used with AWS Systems Manager. Need to add permissions to instance profile and
Can't find instances in Session Manager console install the SSM agent on the instances
Exam Scenarios
Multiple environments require authentication Store credentials in SSM Parameter Store and pass an
credentials for external service. Deployed using environment tag as a parameter in CloudFormation
CloudFormation template
IAM access keys used to manage EC2 instances using Use an AWS Config rule to identify noncompliant
the CLI. Company policy mandates that access keys keys. Create a custom AWS Systems Manager
are automatically disabled after 60 days Automation document for remediation
SECTION 7
Automation: AWS Elastic
Beanstalk
AWS Elastic Beanstalk
Region
VPC
Elastic Beanstalk environment
Version 1
S3 Bucket
AWS Elastic Beanstalk
Environments: APPLICATION
Ø An application version that has been
DEVELOPMENT PRODUCTION
deployed on AWS resources
Ø The resources are configured and
provisioned by AWS Elastic Beanstalk
Ø The environment is comprised of all Version 4
Versions can be Version 3
the resources created by Elastic applied to any
environment Version 2
Beanstalk and not just an EC2 instance
Version 1
with your uploaded code
S3 Bucket
AWS Elastic Beanstalk – Create Single Environment
Web Server
Administrator
AWS Elastic Beanstalk – Troubleshooting errors
Web Server
Administrator
Error occurs
AWS Elastic Beanstalk – Upload Prod App v1
Web Server
Administrator
AWS Elastic Beanstalk Deployment Policies
Ø All at once:
Ø Deploys the new version to all instances simultaneously
Ø Rolling:
Ø Update a batch of instances, and then move onto the next batch once the first batch is
healthy
Ø Rolling with additional batch:
Ø Like Rolling but launches new instances in a batch ensuring that there is full availability
Ø Immutable:
Ø Launches new instances in a new ASG and deploys the version update to these instances
before swapping traffic to these instances once healthy
Ø Blue/green:
Ø Create a new "stage" environment and deploy updates there
AWS Elastic Beanstalk – All at Once Update
Environment
Application Versions
Instance
Update is applied
Version 2 to all instances
simultaneously
Version 1
Instance
AWS Elastic Beanstalk – All at Once Update
Ø Deploys the new version to all instances simultaneously
Ø All of your instances are out of service while the deployment takes place
Ø Fastest deployment
Ø Good for quick iterations in development environment
Ø You will experience an outage while the deployment is taking place - not ideal for mission-critical
systems
Ø If the update fails, you need to roll back the changes by re-deploying the original version to all of
your instances
Ø No additional cost
AWS Elastic Beanstalk – Rolling Update
Instance
Instance
AWS Elastic Beanstalk – Rolling Update
Ø Update a few instances at a time (batch), and then move onto the next batch once the first batch
is healthy (downtime for 1 batch at a time)
Ø Application is running both versions simultaneously
Ø Each batch of instances is taken out of service while the deployment takes place
Ø Your environment capacity will be reduced by the number of instances in a batch while the
deployment takes place
Ø Not ideal for performance-sensitive systems
Ø If the update fails, you need to perform an additional rolling update to roll back the changes.
Ø No additional cost
Ø Long deployment time
AWS Elastic Beanstalk – Rolling with Additional Batch Update
Instance Instance
Application Versions
Version 2
Instance Instance
Version 1
Instance
Instance
AWS Elastic Beanstalk – Rolling with Additional Batch Update
Ø Like Rolling but launches new instances in a batch ensuring that there is full availability.
Ø Application is running at capacity
Ø Can set the batch size
Ø Application is running both versions simultaneously
Ø Small additional cost
Ø Additional batch is removed at the end of the deployment
Ø Longer deployment
Ø Good for production environments
AWS Elastic Beanstalk – Immutable Update
Elastic Beanstalk application
Environment
Instance Instance
Application Versions
Version 2
Instance Instance
Version 1
Instance Instance
Instance Instance
AWS Elastic Beanstalk – Immutable Update
Ø Launches new instances in a new ASG and deploys the version update to these instances before
swapping traffic to these instances once healthy
Ø Zero downtime
Ø New code is deployed to new instances using an ASG
Ø High cost as double the number of instances running during updates
Ø Longest deployment
Ø Quick rollback in case of failures
Ø Great for production environments
AWS Elastic Beanstalk – Blue/green
Elastic Beanstalk application
Environment
V1 V1
80%
Instance Instance
20% Environment
Amazon Route 53
V2 V2
Instance Instance
AWS Elastic Beanstalk – Blue/Green Update
Ø This is not a feature within Elastic Beanstalk
Ø You create a new "staging" environment and deploy updates there
Ø The new environment (green) can be validated independently and you can roll back if there are
issues
Ø Route 53 can be setup using weighted policies to redirect a a percentage of traffic to the staging
environment
Ø Using Elastic Beanstalk, you can "swap URLs" when done with the environment test
Ø Zero downtime
AWS Elastic Beanstalk - Multiple Environments
mynodeapp-prod.eba-yphz4gg2.ap-
southeast-2.elasticbeanstalk.com
Create additional
Web Server
environment for our
Dev App v2
App v2 Environment
mynodeapp-dev.eba-yphz4gg2.ap-
southeast-2.elasticbeanstalk.com
Web Server
Administrator
AWS Elastic Beanstalk - Multiple Environments
mynodeapp-dev.eba-yphz4gg2.ap-
southeast-2.elasticbeanstalk.com
Create additional
Web Server
environment for our
Prod App v2
App v2 Environment
mynodeapp-prod.eba-yphz4gg2.ap-
southeast-2.elasticbeanstalk.com
Web Server
Administrator
AWS Elastic Beanstalk Web Servers and Workers
Elastic Beanstalk application
Queue
Web Server
Worker
The worker polls
the queue
AWS Elastic Beanstalk Environment Tiers
Ø Determines how Elastic Beanstalk provisions resources based on what
the application is designed to do
Ø Consists of Web Servers and Workers:
Ø Web servers are standard applications that listen for and then
process HTTP requests, typically over port 80
Ø Workers are specialized applications that have a background
processing task that listens for messages on an Amazon SQS queue.
Ø Workers should be used for long-running tasks
AWS Elastic Beanstalk – High Availability
Region
VPC
Elastic Beanstalk environment
Availability Zone
Public subnet
Instance
Auto Scaling
group
Availability Zone
Application
Public subnet Load
Balancer
Instance
SECTION 8
Infrastructure
Automation: AWS
CloudFormation
AWS CloudFormation
Ø AWS CloudFormation is a service that
allows you to manage, configure and
provision your AWS infrastructure as
code
Ø AWS CloudFormation provides a
common language for you to describe
and provision all the infrastructure
resources in your cloud environment
Ø Resources are defined using a
CloudFormation template
AWS CloudFormation
Ø CloudFormation can be used to provision a
broad range of AWS resources
Ø Think of CloudFormation as deploying
infrastructure as code
AWS CloudFormation – Key Benefits
Ø Infrastructure is provisioned consistently, with fewer mistakes
(human error)
Ø Less time and effort than configuring resources manually
Ø You can use version control and peer review for your
CloudFormation templates
Free to use (you're only charged for the resources provisioned)
Ø Can be used to manage updates and dependencies
Ø Can be used to rollback and delete the entire stack as well
AWS CloudFormation – Key Concepts
Component Description
Templates The JSON or YAML text file that contains the instructions for building out
the AWS environment
Stacks The entire environment described by the template and created, updated,
and deleted as a single unit
StackSets AWS CloudFormation StackSets extends the functionality of stacks by
enabling you to create, update, or delete stacks across multiple accounts
and regions with a single operation
Change Sets A summary of proposed changes to your stack that will allow you to see
how those changes might impact your existing resources before
implementing them
AWS CloudFormation – Templates
Ø A template is a YAML or JSON template used to describe the end-
state of the infrastructure you are either provisioning or changing
Ø After creating the template, you upload it to CloudFormation
directly or using Amazon S3
Ø CloudFormation reads the template and makes the API calls on your
behalf.
Ø The resulting resources are called a "Stack"
Ø Logical IDs are used to reference resources within the template
Ø Physical IDs identify resources outside of AWS CloudFormation
templates, but only after the resources have been created
AWS CloudFormation – Stacks
Ø Deployed resources based on templates
Ø Create, update and delete stacks using templates
Ø Deployed through the Management Console, CLI or APIs
Ø Stack creation errors:
Ø Automatic rollback on error is enabled by default
Ø You will be charged for resources provisioned even if there is
an error
AWS CloudFormation – StackSets
Ø AWS CloudFormation StackSets extends the functionality of stacks by
enabling you to create, update, or delete stacks across multiple accounts
and regions with a single operation
Ø Using an administrator account, you define and manage an AWS
CloudFormation template, and use the template as the basis for provisioning
stacks into selected target accounts across specified regions
Ø An administrator account is the AWS account in which you create stack sets.
Ø A stack set is managed by signing into the AWS administrator account in
which it was created
Ø A target account is the account into which you create, update, or delete one
or more stacks in your stack set
Intrinsic Functions - Ref
Ø The intrinsic function Ref returns the value of the specified parameter or resource
Ø When you specify a parameter’s logical name, it returns the value of the parameter
Ø When you specify a resource’s logical name, it returns a value that you can typically
use to refer to that resource, such as a physical ID
Ø The following resource declaration for an Elastic IP address needs the instance ID of
an EC2 instance and uses the Ref function to specify the instance ID of the
MyEC2Instance resource:
Intrinsic Functions - Fn::FindInMap
Ø The intrinsic function Fn::FindInMap returns the value
corresponding to keys in a two-level map that is declared in
the Mappings section
Ø Full syntax (YAML): Fn::FindInMap: [ MapName, TopLevelKey,
SecondLevelKey ]
Ø Short form (YAML): !FindInMap [ MapName, TopLevelKey,
SecondLevelKey ]
Intrinsic Functions - Fn::FindInMap
Ø The following example shows how to use Fn::FindInMap for a template with a
Mappings section that contains a single map, RegionMap, that associates
AMIs with AWS regions:
AWS CloudFormation – Resources
Ø Resources - the required Resources section declares the AWS
resources that you want to include in the stack, such as an Amazon
EC2 instance or an Amazon S3 bucket
Ø Mandatory
Ø Resources are declared and can reference each other
AWS CloudFormation – Parameters
Ø Parameters – use the optional Parameters section to customize
your templates
Ø Parameters enable you to input custom values to your template
each time you create or update a stack
Ø Useful for template reuse
AWS CloudFormation – Mappings
Ø Mappings – the optional Mappings section matches a key to a
corresponding set of named values
Ø Exam tip: with mappings you can, for example, set values based on a
region You can create a mapping that uses the region name as a key
and contains the values you want to specify for each specific region
AWS CloudFormation – Outputs
Ø Outputs – the optional Outputs section declares output values that
you can import into other stacks (to create cross-stack references),
return in response (to describe stack calls), or view on the AWS
CloudFormation console
Ø In the following example YAML code, the output named StackVPC
returns the ID of a VPC, and then exports the value for cross-stack
referencing with the name VPCID appended to the stack’s name
AWS CloudFormation – Nested Stacks
Ø Nested stacks allow re-use of CloudFormation
code for common use cases
Ø For example standard configuration for a load
balancer, web server, application server etc.
Ø Instead of copying out the code each time,
create a standard template for each common
use case and reference from within your
CloudFormation template
AWS CloudFormation – Change Sets
Ø AWS CloudFormation provides two methods for updating stacks:
direct update or creating and executing change sets
Ø When you directly update a stack, you submit changes and AWS
CloudFormation immediately deploys them
Ø Use direct updates when you want to quickly deploy your updates
Ø With change sets, you can preview the changes AWS
CloudFormation will make to your stack, and then decide whether to
apply those changes
AWS CloudFormation – Drift Detection
Ø Drift detection enables detects whether a stack's actual configuration
differs, or has drifted, from its expected configuration
Stack deployed and manual changes were made. Use drift detection and use output to update
Need to capture changes and update template template and redeploy the stack
Need to update new version of app on EC2 and ALB. Update template with AutoScalingReplacingUpdate
Must avoid DNS changes and be able to rollback policy and perform an update
Need to write a single template that can be deployed Use parameters to enter custom values and use Ref
across several environments / Region intrinsic function to reference the parameter
Tried to launch instance in a different region from a Probably due to incorrect AMI ID
working template and it fails
Exam Scenarios
CloudFormation stack created for first time and fails To continue administrator must relaunch the
with ROLLBACK_COMPLETE status template to create a new stack
Template for infrastructure in one region used to Template likely referenced an AMI that doesn't exist
deploy in another and fails in the new region and/or services that don't exist
CloudFormation stack fails and returns Fix the error that caused the rollback to fail and then
UPDATE_ROLLBACK_FAILED select "Continue update rollback" in the console
CloudFormation deploys stack with separate VPC for May have reached the default limit for VPCs in the
each app. Fails to deploy account
Exam Scenarios
Would like to manually address any issues with Set the OnFailure parameter to "DO_NOTHING”
CloudFormation stack creation
CloudFormation fails with "The image id ‘[ami- Most likely the template is being run in a different
2a69aa47]’ does not exist" region where the AMI does not exist
When creating Stack a wait condition error is Check instance has a route through NAT device and in
experienced: ""received 0 signals out of the 1 the cfn logs confirm that the cfn-signal command ran
expected from the EC2 instance"." successfully
SECTION 9
Networking: Amazon
Virtual Private Cloud
(VPC)
A VPC is a logically
Amazon Virtual Private Cloud (VPC) isolated portion of the
AWS cloud within a
region
Region
VPC
Main Route Table
Subnets are
created within
Availability Zone Destination Target
AZs Public subnet
172.31.0.0/16 Local
0.0.0.0/0 igw-id
EC2 Instance
An Internet Gateway is
used to connect to the
Internet
Multiple VPCs
VPC VPC
CIDR 172.31.0.0/16 CIDR 10.0.0.0/16
AWS Cloud
VPC
Availability Zone
Public subnet
Private services can
Amazon DynamoDB Amazon S3 have public IP
addresses but exist
within the VPC
Ø You can then define ranges of IP addresses within the VPC CIDR that can be
assigned to subnets. AWS resources obtain addresses from these IP ranges
Amazon VPC – CIDR Blocks and IP Subnets
Ø AWS recommend that CIDR blocks of /16 or smaller are used
Ø It is recommended these come from the private IP ranges specified in RFC 1918
Ø 10.0.0.0 - 10.255.255.255 (10/8 prefix)
Ø 172.16.0.0 - 172.31.255.255 (172.16/12 prefix)
Ø 192.168.0.0 - 192.168.255.255 (192.168/16 prefix)
Ø However, it is possible to create a VPC with publicly routable CIDR block
Ø The allowed block size is between a /28 netmask and /16 netmask
Ø The CIDR blocks of the subnets within a VPC cannot overlap
Amazon VPC – CIDR Blocks and IP Subnets
Ø The first four IP addresses and the last IP address in each subnet CIDR block are
not available for you to use
Ø For example, in a subnet with CIDR block 10.0.0.0/24, the following five IP
addresses are reserved:
Ø 10.0.0.0: Network address
Ø 10.0.0.1: Reserved by AWS for the VPC router
Ø 10.0.0.2: Reserved by AWS
Ø 10.0.0.3: Reserved by AWS for future use
Ø 10.0.0.255: Network broadcast address (broadcast not supported)
Creating a Custom VPC
Region
Public Route Table
VPC
Destination Target
0.0.0.0/0 igw-id
Private subnet Public subnet
NAT gateway
Availability Zone
Private subnet Public subnet
Internet
Route table Route table gateway Private Route Table
Destination Target
Availability Zone 10.0.0.0/16 Local
Availability Zone
Availability Zone
Router
Private subnet Public subnet
Security Security
Group B Group A
Security Security
Group A Groups can be
applied to Network ACL
Network ACL
instances in
any subnet
Security Groups
Ø Security groups act like a firewall at the instance level
Ø Specifically security groups operate at the network interface level
Ø Can only assign permit/allow rules in a security group,
Ø You cannot assign deny rules
Ø There is an implicit deny rule at the end of the security group
Ø All rules are evaluated until a permit is encountered or continues until the
implicit deny
Ø Can control ingress and egress traffic with security groups
Ø Security groups are stateful
Stateful (Security Groups) vs Stateless (Network ACLs) Firewalls
VPC
Availability Zone
Outbound
Type Protocol Port Destination
MySQL TCP 3306 DB-SG
Network Access Control Lists (NACLs)
Default NACL
VPC
Inbound:
Protocol Port Source Action
Availability Zone All All 0.0.0.0/0 ALLOW
Custom NACL
Inbound:
Availability Zone
Protocol Port Source Action
Router
All All 0.0.0.0/0 DENY
Private subnet Public subnet
Security Security All All ::/0 DENY
Group B Group A
Outbound:
Security
Group A Protocol Port Source Action
An ENI is created in
the subnet
Each interface endpoint
VPC
can connect to one of
Private subnet AWS CloudFormation many AWS services
Route Table
Destination Target
pl-6ca54005 (com.amazonaws.ap-southeast-2.s3, 54.231.248.0/22, 54.231.252.0/24, 52.95.128.0/21) vpce-ID
How Uses DNS entries to redirect traffic Uses prefix lists in the route table to redirect
traffic
Which API Gateway, CloudFormation, Amazon S3, DynamoDB
services CloudWatch etc.
Security Security Groups VPC Endpoint Policies
Amazon VPC Peering
Region 1 Region 2
Ø Must update the inbound and outbound rules for VPC security group to
reference security groups in the peered VPC
Amazon VPC Peering
Ø When creating a VPC peering connection with another account you need to
enter the account ID and VPC ID from the other account
Amazon VPC Peering
How VPC peering request made; accepter accepts request (either within or across
accounts)
Amazon Virtual Private Networks (VPN)
VPNs are quick and
easy to deploy
VPC
CIDR: 10.0.0.0/16
Public subnet
A VGW is
deployed on
the AWS site Corporate data center
CIDR: 192.168.0.0/16
Destination Target
192.168.0.0/16 vgw-id A customer gateway is
deployed on the
customer side
Route table points
to the VGW
AWS Managed VPN
What AWS Managed IPSec VPN Connection over your existing Internet
When Quick and usually simple way to establish a secure tunnelled connection
to a VPC; redundant link for Direct Connect or other VPC VPN
VPC
Corporate data center
AWS Direct Connect location
Public subnet
Direct Connect
Connect to offers consistent,
public services low-latency access
over a public VIF to AWS
Amazon Simple Storage
Amazon EC2
Service (S3)
AWS Direct Connect
What Dedicated network connection over private lines straight into the AWS
backbone
When Requires a large network link into AWS; lots of resources and services being
provided on AWS to your corporate users
Direct Connect
Gateway
AWS Direct Customer / Customer Router
Connect partner router
Region endpoint
Public subnet
Need to identify the instances that are generating the Use VPC flow logs on the NAT gateway ENI and use
most traffic using a NAT gateway CloudWatch insights to filter based on source IP
address
Latency on a NAT instance has increased, need a Swap with a NAT gateway
solution that scales with demand cost-efficiently
NAT gateway is NOT highly available across AZs, only Use multiple NAT gateways for HA across AZs
within an AZ
NAT instance deployed but not working Make sure to disable source/destination checks
Need to enable access to S3 without the instances Use a NAT gateway or VPC endpoint
using public IP addresses
Exam Scenarios
EC2 instance in private subnet cannot reach the Indicates the NAT gateway has been deleted
Internet. Route table has a route to a NAT gateway
with a status of "Blackhole"
Need to connect to S3 from EC2 using private Create a VPC endpoint and a bucket policy with a
network only. Must also ensure that only the Condition that limits S3 actions to the VPC endpoint
instances can access the bucket as the source
VPC endpoint setup to allow private IP address Make sure the subnet has a target in the route table
connectivity to S3 bucket, permissions configured, for the VPC endpoint
but instances still can't connect
Exam Scenarios
Need to manage EC2 instances in a private subnet Add a VGW and configure routing in the VPC and
from an office using SSH but instances cannot have establish a VPN to the office
internet access
Need encryption in-transit and at-rest for hybrid Use an AWS VPN and use KMS keys for data
environment encryption
Network change was made that resulted in Analyze using VPC Flow Logs
application to DB connection issues
Inbound and outbound internet connectivity required Need to attach an internet gateway to the VPC and
for EC2 instances add an entry in the route table for the subnet that
points to the internet gateway
Exam Scenarios
Web application has EC2 with public IPs behind an Need to create an attach an IGW to the VPC and
ALB. EC2 instances cannot connect to external service update the route table
VPC peering connection setup between two different Make sure the route tables are updated
VPCs. Instances in private subnets still can't
communicate
A company has configured a VPC peering connection Configure the VPC route tables with routes pointing
between two VPCs and needs to set up connectivity to the address range of the other VPC
between instances in private subnets
Company backing up one VPC to another in different Use inter-region VPC peering which encrypts across
region. All data must be private and encrypted the AWS global network
Exam Scenarios
Malicious IP identified and must be blocked from all Add a rule to a network ACL for all affected subnets
ingress and egress connectivity
VPC connected to data center by VPN. User pings Modify the network ACL to allow outbound traffic
private subnet instance from on-prem computer and
fails. VPC Flow Logs show accept for inbound but
reject for outbound traffic
Malicious traffic coming from a single IP address Use a NACL for the web server subnet to deny IP
address
Admin has setup instance for remote access and can Most likely reason is that the instance's security
SSH from internet but cannot ping group does not have a rule allowing ICMP
Exam Scenarios
Admin connecting to EC2 instance using SSH from Most likely doesn't have the home network IP range
office but gets connection timeout from home in the security group allow rule for SSH
SECTION 10
DNS: Amazon Route 53
Amazon Route 53 Overview
Amazon Route 53
.net example.com
.com dctlabs.com
.org
EC2 Instances
DNS Resolution
mycompany.local A 192.168.0.1
emailserver.local MX 192.168.0.2
DNS Server
Amazon Route 53
A hosted zone represents a
set of records belonging to a
domain
What’s the address for
example.com? example.com
Region
VPC
Address is 8.1.2.1
Availability Zone
Public subnet
CNAME Alias
Supported DNS records Route 53 charges for CNAME queries Route 53 doesn’t charge for alias queries
• A (address record) to AWS resources
• AAAA (IPv6 address record)
• CNAME (canonical name record)
• Alias (an Amazon Route 53-specific You can’t create a CNAME record at the top You can create an alias record at the zone
virtual record) node of a DNS namespace (zone apex) apex (however you can’t route to a
• CAA (certification authority
authorization) CNAME at the zone apex)
• MX (mail exchange record)
• NAPTR (name authority pointer
record) A CNAME can point to any DNS record that is An alias record can only point to a
• NS (name server record) hosted anywhere CloudFront distribution, Elastic Beanstalk
• PTR (pointer record)
environment, ELB, S3 bucket as a static
• SOA (start of authority record)
• SPF (sender policy framework) website, or to another record in the same
• SRV (service locator) hosted zone that you’re creating the alias
• TXT (text record)
record in
Using Alias and CNAME Records
simple.dctlabs.com A 1.1.1.1 60
2.2.2.2
simple2.dctlabs.com A 3.3.3.3 60
Amazon Route 53
2
Region
DNS query
Amazon Route 53 - Simple Routing Policy
Ø With simple routing, you typically route traffic to a single resource such as a
webserver
Ø You can't create multiple records that have the same name and type, but you can
specify multiple values in the same record, such as multiple IP addresses
Ø When using multiple values in a record:
Ø Route 53 returns all values to the recursive resolver in random order, and the
resolver returns the values to the client
Ø The client then chooses a value and resubmits the query
Amazon Route 53 - Weighted Routing Policy
1.1.1.1
60%
1
2
Region
20%
3
2.2.2.2
20%
Optional Health
Name Type Value Health Region Checks
latency.dctlabs.com A 1.1.1.1 ID ap-southeast-1
Region – us-east-1
Singapore
New York
Region – ap-southeast-2
Sydney
DNS query
ALB
DNS query
Amazon Route 53 - Latency Routing Policy
Ø When Route 53 receives a DNS query for a domain it determines which AWS
Regions you've created latency records for, determines which region gives the
user the lowest latency, and then selects a latency record for that region
Ø Route 53 responds with the value from the selected record, such as the IP
address for a web server
Amazon Route 53 - Failover Routing Policy Corporate data center
Region – us-east-1
1.1.1.1
Region – ap-southeast-2
DNS query
ALB
Amazon Route 53 - Failover Routing Policy
Ø When responding to queries, Route 53 includes only the healthy primary
resources
Ø If all the primary resources are unhealthy, Route 53 begins to include only the
healthy secondary resources in response to DNS queries
Ø If you're routing traffic to any AWS resources that you can create alias records
for, don't create health checks for those resources. When you create the alias
records, you set Evaluate Target Health to Yes instead
Amazon Route 53 - Geolocation Routing Policy Region – ap-southeast-1
Optional Health
Name Type Value Health Geolocation Checks
geolocation.dctlabs.com A 1.1.1.1 ID Singapore
Region – us-east-1
Singapore
Mexico
Region – ap-southeast-2
New Zealand
DNS query
ALB
DNS query
Amazon Route 53 - Geoproximity Routing Policy
Ø To use geoproximity routing, you must use Route 53 traffic flow
Ø You create geoproximity rules for your resources and specify one of the
following values for each rule:
Ø If you're using AWS resources, the AWS Region that you created the
resource in
Ø If you're using non-AWS resources, the latitude and longitude of the
resource
Amazon Route 53 - Geoproximity Routing Policy
Traffic originating
within a geographical
area is routed to the
numbered AWS
Regions
Amazon Route 53 - Multivalue Routing Policy
Name Type Value Health Multi Value
2
Region
DNS query
Amazon Route 53 - Multivalue Routing Policy
Ø To route traffic approximately randomly to multiple resources, such as
web servers, you create one multivalue answer record for each
resource
Ø Can optionally associate a Route 53 health check with each record
Ø Route 53 responds to DNS queries with up to eight healthy records
and gives different answers to different DNS resolvers
Amazon Route 53 – Health Checks
There are three types of Amazon Route 53 health checks:
Ø Health checks that monitor an endpoint
Ø Health checks that monitor other health checks (calculated health
checks)
Ø Health checks that monitor CloudWatch alarms
Exam Scenarios
Use Route 53 to direct based on health checks with Need to create an A record for each server and a
(2xx) traffic to primary and other responses to HTTP (not TCP) health check
secondary
Route 53 health check uses string matching for The search string must appear entirely within the first
"/html". Alert shows health check fails 5,120 bytes of the response body
Need to make a website promotion visible to users Use Route 53 geolocation routing policy
from a specific country only
Exam Scenarios
New website runs on EC2 behind ALB. Need to create Use an alias record
record in Route 53 to point to the domain apex (e.g.
example.com)
Hosted zone in Account A and ALB in Account B. Need Create an Alias record in Account A that points to ALB
the most cost-effective and efficient solution for in Account B
pointing to the ALB
SECTION 11
Object Storage and
Content Delivery: S3 and
CloudFront
Amazon Simple Storage Service (S3)
EC2 instances
connect using
private addresses
A bucket is a container
for objects
Bucket Private Connection
http://bucket.s3.aws-region.amazonaws.com Amazon S3
http://s3.aws-region.amazonaws.com/bucket
VPC
S3 Gateway Endpoint
Public subnet
Object
Internet EC2 Instance
An objects consists of: gateway
Ø Key (name of objects) Public Internet
Ø Version ID EC2 instances Private subnet
Internet Client
Block, File, and Object Storage
HDD/SSD
File system On-premises client
Volume
REST API: GET, PUT,
Uses the NFS POST, SELECT, DELETE
Protocol
Linux only
/dev/xvdf Object
Availability Zone Availability Zone
or C:
/efs-mnt /efs-mnt
S3 Standard S3 Intelligent Tiering S3 Standard-IA S3 One Zone-IA S3 Glacier S3 Glacier Deep Archive
Region Region
Account Account
Region
Same-Region
Replication (SRR)
Bucket Bucket
Amazon S3 –Replication
Ø You can replicate objects between different AWS Regions or within the
same AWS Region
Ø Cross-Region replication (CRR) is used to copy objects across Amazon S3
buckets in different AWS Regions
Ø Same-Region replication (SRR) is used to copy objects across Amazon S3
buckets in the same AWS Region
How:
Ø Enable the AWS Region in the account
Ø Enable versioning on source and destination buckets
Ø Ensure S3 has permissions to both buckets
Ø Configure replication
Access Control Options
Example identity-
based policy
Object ACL
Access Control List Permissions
WRITE_ACP Allows grantee to write the ACL for the Allows grantee to write the ACL for the applicable object
applicable bucket
FULL_CONTROL Allows grantee the READ, WRITE, READ_ACP, Allows grantee the READ, READ_ACP, and WRITE_ACP
and WRITE_ACP permissions on the bucket permissions on the object
S3 Encryption
Encryption / Encryption /
decryption decryption
Encryption /
decryption
Enforces encryption
using SSE-S3
https://dct-data-bucket.s3.ap-southeast-
2.amazonaws.com/cool_image.jpeg?X-Amz-Algorithm=AWS4-HMAC-
SHA256&X-Amz-Credential=AKIA3KSVPHP6MAHNW5YH%2F20200909%2Fap-
southeast-2%2Fs3%2Faws4_request&X-Amz-Date=20200909T053538Z&X-
Amz-Expires=3600&X-Amz-SignedHeaders=host&X-Amz-
Signature=8b74653beee371da07a73dfdb4ff6883742383afa528aecd5c95
c326c97764db
Uses a different
endpoint
http://bucket.s3.aws-region.amazonaws.com
http://s3.aws-region.amazonaws.com/bucket
http://bucketname.s3-accelerate.amazonaws.com Bucket
http://bucketname.s3-accelerate.dualstack.amazonaws.com
User
S3 Server Access Logging
Ø Provides detailed records for the requests that are made
to a bucket
Ø Details include the requester, bucket name, request time,
request action, response status, and error code (if
applicable)
Ø Disabled by default
Ø Only pay for the storage space used
Ø Must configure a separate bucket as the destination (can
specify a prefix)
Ø Must grant write permissions to the Amazon S3 Log
Delivery group on destination bucket
S3 Event Notifications
Ø Sends notifications when events happen in buckets
Ø Destinations include:
Ø Amazon Simple Notification Service (SNS) topics
Ø Amazon Simple Queue Service (SQS) queues
Ø AWS Lambda
S3 Glacier Vault Lock and Vault Access Policies
S3 Glacier Vault Lock:
Ø S3 Glacier Vault Lock enforces compliance controls for S3 Glacier vaults with
a vault lock policy
Ø Can specify controls such as “write once read many” (WORM) in a vault lock
policy and lock the policy from future edits
Ø Once locked, the policy can no longer be changed
S3 Glacier Vault Access Policy:
Ø Cannot be locked to prevent future changes
Ø Use for access controls that are not compliance related, temporary, and
subject to frequent modification
Ø Can be used with a vault lock policy
S3 Select and Glacier Select SQL expression to retrieve
individual file from zip archive
AWS Lambda
AWS Lambda
Edge location
Edge location
Edge location
Users
Users Edge location
Users
Users
CloudFront Distribution and Origins
S3 Origin
S3 Bucket Distribution
Custom Origin
Users
Distribution Amazon CloudFront
S3 Static
Website
Web Distribution:
Custom Origin • Static and dynamic content
• HTTP/HTTPS
• Add/update/delete objects + webforms
• Real time live streaming
RTMP Distribution:
EC2 Instance
• Uses Adobe Flash Media RTMP protocol
• Can play media file before downloaded
Application • Must use S3 origin
Load Balancer
EC2 Instance
CloudFront with S3 Static Website
Region
Custom Origin
Static website on Amazon S3 with custom domain Requires that the bucket name matches the DNS
name name / record set name in Route 53
503 errors experienced with new site and thousands Request rate is too high
of user
Discrepancy with number of objects in bucket console Use Amazon S3 Inventory to properly determine the
vs CloudWatch number of objects in a bucket
Need to enforce encryption on all objects uploaded Use a bucket policy with a "Condition": { "Bool": {
to bucket "aws:SecureTransport": "false" statement for
PutObject and with the resource set to the bucket
Exam Scenarios
Unauthorized users tried to connect to S3 buckets. Use S3 server access logs and Athena to query for
Need to know which buckets are targeted and who is HTTP 403 errors and look for IAM user or role making
trying to get access requests
Need to provide access to third-party to S3 bucket Use a pre-signed URL allowing access to the specific
and must limit amount of access. List of users files
changes a lot
After enabling MFA on a bucket, what operations will Permanently removing object versions and
require MFA authentication? suspending versioning on the bucket
Exam Scenarios
Files are downloaded from S3, edited and uploaded To allow recovery enable versioning on the bucket
with same file name. Sometimes they are accidentally
modified or deleted
Existing application uses EC2, RDS, EFS and S3. Need Can enable encryption only on S3 (as already
to enable encryption deployed)
Static website deployed but "HTTP 403 Forbidden" Add bucket policy granting everyone read access to
message received objects
Application on EC2 must save files to Amazon S3 and Create an IAM role for S3 access and attach to EC2
needs access instance
Exam Scenarios
Large volume of log files stored in S3 bucket and Most cost-effective option is S3 standard
processed daily
Need to restrict S3 bucket access to same account Change ACL to restrict only to bucket owner
after previously shared with other account
Static content is served from Amazon S3 with long Use CloudFront to cache for better performance
loading times
Need to use custom domain name with CloudFront Create an alias record in Route 53 pointing to the
distribution URL
Exam Scenarios
CloudFront in front of ALB and EC2 and logging Check ALB access logs and CloudFront access logs
enabled. Need to view logs for HTTP layer 7 status
codes
App running on EC2 with RDS multi-AZ has static Use CloudFront to cache the content
content on S3. Need to improve performance as load
testing slowed it down
Need to secure S3 bucket that is used with Use an OAI and grant permissions to read objects in
CloudFront the bucket
Website with dynamic content and need to restrict Use Amazon CloudFront geo-restriction and Amazon
access from certain countries and regions Route 53 geolocation routing
SECTION 12
Databases: Amazon RDS
and ElastiCache
Amazon Relational Database Service (RDS)
Ø Managed relational database
service including:
Ø Backups
RDS runs on EC2
Ø Software patching RDS is a managed, instances, so you choose
relational database an instance type
Ø Automatic failure detection
Ø Recovery
Ø Backup options include automated
Amazon RDS EC2 Amazon Aurora
db.m4.2xlarge 4
M4 Instance vCPUs, 32 GiB
RAM
M4 instance
db.m4.large 2
vCPUs, 8 GiB
RAM
Amazon RDS – Disaster Recovery (DR) and Scaling Out (horizontally)
Region
VPC
Application servers can
Availability Zone
read from the read replica
and write to the master
Multi-AZ creates a
Writes
passive standby.
Primarily used for RDS Standby Writes EC2 App Server EC2 App Server
disaster recovery
Synchronous
replication
Availability Zone Reads only
Asynchronous
replication
Read Replicas are used
RDS Master RDS Read Replica for scaling database
queries (reads)
Amazon RDS – Multi-AZ and Read Replicas
Only database engine on primary instance is active All read replicas are accessible and can be used for read scaling
Always span two Availability Zones within a single Region Can be within an Availability Zone, Cross-AZ, or Cross-Region
Database engine version upgrades happen on primary Database engine version upgrade is independent from source
instance
Automatic failover to standby when a problem is detected Can be manually promoted to a standalone database instance
Amazon RDS Read Replicas
Region
VPC
Availability Zone
RDS Standby
EC2 App Server EC2 App Server
Synchronous Reads and writes
replication
Availability Zone Reads only
Region
VPC
Availability Zone
Synchronous
replication
Availability Zone
Region
VPC
Availability Zone
Snapshot Snapshot
(unencrypted) (encrypted)
Amazon RDS Monitoring
Ø Enhanced Monitoring:
Ø Provides metrics in real time for the operating system (OS) that the DB instance runs
on
Ø Installs an agent on the DB instance to collect the metrics
Ø Metrics can be viewed in the console
Amazon Aurora Key Features
Aurora Feature Benefit
Offers high performance, self-healing storage that scales up to 64TB, point-in-time recovery
High performance and scalability
and continuous backup to S3
DB compatibility Compatible with existing MySQL and PostgreSQL open source databases
Aurora Replicas In-region read scaling and failover target – up to 15 (can use Auto Scaling)
Cross-region cluster with read scaling and failover target – up to 5 (each can have up to 15
MySQL Read Replicas
Aurora Replicas)
Cross-region cluster with read scaling (fast replication / low latency reads). Can remove
Global Database
secondary and promote
Multi-Master Scales out writes within a region. In preview currently and will not appear on the exam
On-demand, autoscaling configuration for Amazon Aurora - does not support read replicas
Serverless
or public IPs (can only access through VPC or Direct Connect - not VPN)
Amazon RDS Aurora Replicas
Feature Aurora Replica MySQL Replica
Number of replicas Up to 15 Up to 5
Asynchronous
replication Reads Reads
Asynchronous
replication
Region
Reads Reads
Aurora Auto Scaling
Ø Dynamically adjusts the number of Aurora Replicas provisioned
Ø Scaling policy defines min and max replicas
Ø Uses CloudWatch metrics to adjust number of replicas
Ø Application should use the Aurora reader endpoint
Database write
Amazon ElastiCache Overview
Ø Good solution if your database is particularly read-heavy and the data does not change
frequently
Ø ElastiCache can be used for storing session state
Ø Provides push-button scalability for memory, writes and reads
Ø Runs on Amazon EC2 instances
Ø ElastiCache EC2 nodes cannot be accessed from the Internet, nor can they be accessed by EC2
instances in other VPCs
Amazon ElastiCache Overview
Feature Memcached Redis (cluster mode disabled) Redis (cluster mode enabled)
Yes, place nodes in multiple AZs. Yes, with auto-failover. Uses read replicas (0-5 Yes, with auto-failover. Uses read replicas (0-5
Multi-AZ
No failover or replication per shard) per shard)
Scaling Up (node type); out (add nodes) Up (node type); out (add replica) Up (node type); out (add shards)
Multithreaded Yes No No
Backup and restore No (and no snapshots) Yes, automatic and manual snapshots Yes, automatic and manual snapshots
Amazon ElastiCache - Scalability
Scaling options are dependent on the database engine:
Memcached
Ø Add nodes to a cluster
Ø Scale vertically (node type) – must create a new cluster manually
Redis
Ø Cluster mode disabled:
Ø Add replica or change node type – creates a new cluster and migrates data
Ø Cluster mode enabled:
Ø Online resharding to add or remove shards; vertical scaling to change node
type
Ø Offline resharding to add or remove shards change node type or upgrade
engine (more flexible than online)
Amazon ElastiCache Memcached
Region A
Shard
Can failover to a
replica
Primary
• It is a non-relational database
DynamoDB Table
• Tables
• Items
• Attributes userid orderid book price date
Horizontal scaling Seamless scalability to any scale with push button scaling or Auto Scaling
DynamoDB Accelerator (DAX) Fully managed in-memory cache for DynamoDB that increases performance (microsecond latency)
Backup Point-in-time recovery down to the second in last 35 days; On-demand backup and restore
Captures a time-ordered sequence of item-level modifications in any DynamoDB table and stores this
DynamoDB Streams
information in a log for up to 24 hours
Automated failover of a multi-AZ DB occurred This may be due to storage failure on primary DB or
the instance type could have been changed
Need to encrypt unencrypted RDS database Take a snapshot, encrypt it, then restore a new
encrypted instance from the snapshot
RDS DB query latency is high and CPU utilization is at Scale up with larger instance type
100%
Need to share RDS DB snapshots across different Use an AWS KMS key for encryption and update key
accounts. Data must be encrypted policy to grant accounts with access then share
snapshot
Exam Scenarios
DB needs to be made HA to protect against failure Change to Multi-AZ outside of business hours
and updates cannot impact users in business hours
Need to protect RDS databases against table Enable automated backups and set the appropriate
corruption within a 30 day window of protection retention period
EC2 connects to RDS instance and fails with: "Error Web server may be using certificate validation and
Establishing a Database Connection” RDS does not trust the certificate. Or, the DB security
group does not have the correct ingress rule
Aurora DB is hitting 100% CPU. Read-heavy app with Add Aurora Replicas and use a Reader Endpoint for
many lookups product table lookups
Database is running MySQL on Amazon EC2. Need to Use Aurora MySQL and configure an Aurora Replica in
increase availability and durability without changing another AZ
application
Reporting job runs against RDS instance and is Create a read replica and point the reporting job to
causing performance issues the read replica endpoint
Exam Scenarios
Backup of RDS instance must be copied regularly to Create a snapshot with create-db-snapshot CLI, share
another account for testing with other account, then create a copy in that
account
MySQL database on RDS must be patched due to a AWS is responsible for patching Amazon RDS
security vulnerability. Who is responsible? database instances
Reporting job runs against RDS instance and is Create a read replica and point the reporting job to
causing performance issues the read replica endpoint
Exam Scenarios
How can a Redis cluster be scaled to improve read Scale horizontally by adding shards
times
High CPU on a Memcached cluster Options are to add additional nodes to cluster or
vertically scale the node types
ElastiCache Memcached storing session state. Scale the cluster by adding additional nodes
Performance poor, eviction count metrics are high
A Memcached cluster is experiencing increased Create a new cache cluster with the new node type
traffic, need to change to larger node type using the CreateCacheCluster API
SECTION 13
Management,
Governance and Billing
AWS Organizations
Ø SCPs affect only principals that are managed by accounts that are part
of the organization
Ø An SCP restricts permissions for principals in member accounts,
including each AWS account root user (except in the master account)
Ø Users and roles must still be granted permissions with appropriate IAM
permission policies
Ø Users / roles must have permissions through IAM and be allowed (or
not denied) through an SCP to perform an action
Ø SCPs do not affect any service-linked roles
AWS Organizations – SCP Effects on Permissions
Service
Root Control Policy
(SCP)
{
"Version": "2012-10-17",
“Statement": [
Master Account {
Service “Effect": "Allow",
Control Policy "Action": "*",
(SCP) "Resource": "*"
}
]
Service }
Organizational unit 1
Control Policy
(SCP)
Effect: Deny
Action: EC2RunInstances
Resource: ec2* Account A Organizational unit 2
StringNotEquals
EC2InstanceType: t2.micro
Effect: Allow
Action: EC2RunInstances
Resource: ec2*
Account B
Amazon CloudWatch – Examples of Functionality
Dashboard
Metrics:
Logs:
ConsumedReadCapacityUnits,
Application logs ConsumedWriteCapacityUnits
System logs
Amazon DynamoDB
Amazon EC2
Events:
Metrics: ECS Task State Change
ECS Container Instance
CPU Utilization State Change
Amazon CloudWatch
Alarms:
Initiate scaling event
Event triggers Amazon Elastic Container
AWS Auto Scaling function Service
Lambda function
Amazon CloudWatch Overview
Ø Amazon CloudWatch monitors AWS resources and applications in
real-time
Ø CloudWatch collects and tracks metrics
Ø Metrics are data points that are published to CloudWatch
Amazon EC2
Ø CloudWatch alarms monitor metrics and automatically initiate
actions Metrics
ConsumedReadCapacityUnits,
ConsumedWriteCapacityUnits
CPUUtilization, DiskReadOps,
NetworkIn, StatusCheckFailed
Amazon DynamoDB
Amazon EC2
BucketSizeBytes, NumberOfObjects,
ReadLatency, FreeStorageSpace,
GetRequests, PutRequests
WriteIOPS, WriteLatency
Amazon CloudWatch
These are
dimensions
Amazon CloudWatch – Key Terminology and Concepts
Statistics:
Ø Statistics are metric data aggregations over specified periods of time
Ø CloudWatch provides statistics based on the metric data points provided
by your custom data or provided by other AWS services to CloudWatch
Amazon CloudWatch – Key Terminology and Concepts
Alarms:
Ø You can use an alarm to automatically initiate actions on your behalf
Ø An alarm watches a single metric over a specified time period, and performs
one or more specified actions, based on the value of the metric relative to a
threshold over time
Ø The action is a notification sent to an Amazon SNS topic or an Auto Scaling
policy
Ø Alarms invoke actions for sustained state changes only
Ø CloudWatch alarms do not invoke actions simply because they are in a
particular state
Ø The state must have changed and be maintained for a specified period
Amazon CloudWatch Alarms – Useful API Actions
Ø PutMetricAlarm
Ø Creates or updates an alarm and associates it with the specified
metric, metric math expression, or anomaly detection model
Ø Alarms based on anomaly detection models cannot have Auto Scaling
actions
Ø SetAlarmState
Ø Temporarily sets the state of an alarm for testing purposes
Amazon CloudWatch Logs
Dashboard
CloudWatch
Agent installed
Application logs Application logs
System logs System logs
CloudWatch
Agent installed
Amazon EC2 Amazon CloudWatch
On-premises
servers
AWS Lambda
Amazon CloudWatch Logs
Ø CloudWatch Logs enables you to centralize the logs from all of your systems,
applications, and AWS services.
Ø Features:
Ø Monitor logs from Amazon EC2 instances - monitors application and
system logs and can trigger notifications
Ø Monitor CloudTrail Logged Events – alarms can be created in CloudWatch
based on API activity captured by CloudTrail
Ø Log retention – by default, logs are retained indefinitely. Configurable per
log group from 1 day to 10 years
Amazon CloudWatch Logs Agent
Ø The CloudWatch Logs agent provides an automated way to send
log data to CloudWatch Logs from Amazon EC2 instances
Ø There is now a unified CloudWatch agent that collects both logs
and metrics
Ø The unified CloudWatch agent includes metrics such as memory
and disk utilization
Amazon CloudWatch Agent
Ø The unified CloudWatch agent enables you to do the following:
Ø Collect more system-level metrics from Amazon EC2 instances across
operating systems. The metrics can include in-guest metrics, in addition
to the metrics for EC2 instances
Ø Collect system-level metrics from on-premises servers. These can
include servers in a hybrid environment as well as servers not managed
by AWS
Ø Retrieve custom metrics from your applications or services using the
StatsD and collectd protocols
Amazon CloudWatch Events
Dashboard
Events: Events:
EC2 Instance State- ECS Task State Change
change Notification ECS Container Instance
EBS Volume Notification State Change
Event source:
EC2 Instance State-
Topic sends a
change Notification Event target message
SetQueueAttributes
RunInstances DeleteQueue
TerminateInstances
Amazon EC2 Amazon Simple Queue
Service
CreateFunction DeleteTable
UpdateFunctionCode AWS CloudTrail UpdateTable
Amazon DynamoDB
AWS Lambda
Amazon CloudTrail
Ø AWS CloudTrail is a web service that records API activity made on AWS
accounts
Ø A CloudTrail trail can be created which delivers log files to an Amazon S3
bucket
Ø Enables governance, compliance, and operational and risk auditing of
your AWS account
Ø Events include actions taken in the AWS Management Console, AWS
Command Line Interface, and AWS SDKs and APIs
Ø CloudTrail is enabled on your AWS account when you create it
Ø Can use Athena to query logs
Amazon CloudTrail
You can create two types of trails for an AWS account:
Ø A trail that applies to all regions - records events in all regions and
delivers to an S3 bucket
Ø A trail that applies to a single region – records events in a single region
and delivers to an S3 bucket. Additional single trails can use the same
or different bucket
Amazon CloudTrail – Management Events
Ø Management events provide information about management operations
that are performed on resources in your AWS account. These are also
known as control plane operations
Ø Example management events include:
Ø Configuring security (for example IAM AttachRolePolicy API
operations)
Ø Registering devices (for example, CreateDefaultVpc API operations)
Ø Configuring rules for routing data (for example CreateSubnet API
operations)
Ø Setting up logging (for example, AWS CloudTrail CreateTrail API
operations)
Amazon CloudTrail – Data Events
Ø Data events provide information about the resource operations
performed on or in a resource
Ø These are also known as data plane operations
Ø Data events are often high-volume activities.
Ø Example data events include:
Ø Amazon S3 object-level API activity (for example, GetObject,
DeleteObject, and PutObject API operations)
Not personalized
information so
may not be
relevant to you Shows current status
information on
service availability
No proactive
notification of
scheduled
activities
AWS Cost Explorer
Ø The AWS Cost Explorer is a free tool that allows you to view charts of
your costs
Ø You can view cost data for the past 13 months and forecast how much
you are likely to spend over the next three months
Ø Cost Explorer can be used to discover patterns in how much you spend
on AWS resources over time and to identify cost problem areas
Ø Cost Explorer can help you to identify service usage statistics such as:
Ø Which services you use the most
Ø View metrics for which AZ has the most traffic
Ø Which linked account is used the most
AWS Cost Allocation Tags
Ø AWS Cost and Usage reports provides a detailed data set about your
AWS billing, delivered to an S3 bucket
Ø This is small excerpt:
AWS Budgets
Ø AWS Budgets gives you the ability to set custom budgets that alert you
when your costs or usage exceed (or are forecasted to exceed) your
budgeted amount
Exam Scenarios
Audit requests to AWS Organizations for creating new use CloudTrail and look for the federated identity user
accounts by federated users name
Employees have created individual AWS accounts not Send each account an invitation from the central
under control. Security team need them in AWS organization
Organizations
Need to restrict ability to launch specific instance Use an organizations SCP to deny launches unless the
types for a specific team/account instance type is T2, create an IAM group in the
account granting access to T2 instances to the
relevant users
Exam Scenarios
Need to ensure that S3 buckets are NEVER deleted in Use an SCP to deny the s3:DeleteBucket API action
a production account
Need to create user-defined cost allocation tags for Use Tag Editor in new account to create user-defined
new account tags and then use the billing and cost management
console in the payer account to mark them as cost
allocation tags
Separate departments must operate in isolation and Use AWS Organizations to create accounts
only use pre-approved services (Organizations API) and SCPs to control the services
available for use
Exam Scenarios
Developers can manipulate IAM policies/roles and Use an SCP to block those services
need to block them from some services
AWS bill is increasing and unauthorized services are Use AWS Organizations with an SCP to restrict the
being used across accounts unauthorized services
Configuring AWS SSO for an Organizations master Next step is to create a permission set and associate
account. Directory created and full access enabled with directory users and groups
Process to create a custom dashboard in CloudWatch Create metric filters and select custom metrics
for custom metrics after installing agent on EC2
Exam Scenarios
Need to test notification settings for CloudWatch Use the set-alarm-state CLI command to test
alarm with SNS
App with EC2 and RDS is running slowly and Use CloudWatch metrics to examine resource usage
suspected high CPU
Site uses CloudFront and S3. Users accessing content Check the 4XXErrorRate metric in CloudWatch to
that does not exist or they don't have access to understand the extent of the issue
Script generates custom CloudWatch metrics from CloudWatch will accept the custom metric data and
EC2 instance and clock is configured incorrectly by 30 record it
mins
Exam Scenarios
Need to collect logs from many EC2 instances Use the unified CloudWatch Agent
External auditor needs to check for unauthorized Create an IAM user, assign an IAM policy with read
changes to AWS account access to CloudTrail logs on Amazon S3
Need to identify who is creating EIPs and not using Use CloudTrail and query logs using Athena to search
them for EIP address events
S3 bucket holds sensitive data. Must monitor object Use AWS CloudTrail and enable data event logging
upload / download activity including AWS account
and IAM user account of caller and time of API call
Exam Scenarios
Need to record any modifications or deletions of Enable CloudTrail log file integrity validation and
CloudTrail logs in an S3 bucket enabled MFA delete on the bucket
Large increase in requests to SQS. Need to determine Use CloudTrail to audit API calls
the source of the calls
Need to ensure that S3 buckets have logging enabled Auto remediate with AWS Config managed rule
without stopping users creating them S3_BUCKET_LOGGING_ENABLE
Need to provide real-time compliance reporting for Use the AWS Config restricted-common-ports rule
security groups to check that port 80 is not being and add port 80
used
Exam Scenarios
Company wants to limit the AMIs that are used. Need Create an AWS Config rule to check that only
to review compliance with the policy approved AMIs are used
Need to automatically disable access keys that are Use Config rule to identify noncompliant keys and use
greater than 90 days old Systems Manager Automation to remediate
Need to address concerns about exposing sensitive Use AWS Config rules to identify public buckets and
data in buckets without restricting ability to create send SNS notification to security team
them
Company needs to verify that specific KMS CMK is Use AWS Config with the encrypted-volumes
used to encrypted EBS volumes managed rule and specify the key ID of the CMK
Need to create replica of existing infrastructure in Most efficient option is to share the portfolio with the
new account. AWS Service Catalog is used new accounts and import into those other accounts
Users have a specialized EC2 instance config and don't Use CloudFormation template with AWS Service
want to configure EC2 settings but need to Catalog portfolio and grant permissions to users
launch/terminate instances. Special instance must
only be available to them
Shared portfolio is imported into a second AWS Admin can add products from the imported portfolio
account controlled by a different administrator to a local portfolio
Exam Scenarios
Need to monitor costs per user in an account Activate the createdBy tag and analyze with AWS Cost
Explorer
How to check for underutilized EC2 instances? Use AWS Cost Explorer to generate resource
optimization recommendations
Bill is increasing over time, need to determine the Use AWS Cost Explorer
cause of increased cost
Need breakdown of costs per project in a single Do this by activating cost allocation tags and creating
account using Cost Explorer and applying resource tags
Exam Scenarios
Need to check that security best practices are being Use AWS Trusted Advisor security checks to review
followed for the AWS account root user configuration of root user
Costs rising and need to be alerted when a specific Use AWS Budgets
spending limit is forecast to be exceeded
Company needs to track the allocation of reserved Use the AWS Cost and Usage report
instances in consolidated bill
Company needs to integrate AWS maintenance Use the AWS Health API
events that may affect their resources into an
operations dashboard
SECTION 14
Security and Compliance
Multi-Factor Authentication in AWS
IAM User
Physical MFA
EJPx!*21p9%
Password
AWS Managed Policies
Ø An AWS managed policy is a standalone policy that is created and
administered by AWS
Ø Standalone policy means that the policy has its own Amazon Resource Name
(ARN) that includes the policy name
Ø AWS managed policies are designed to provide permissions for many
common use cases
Ø You cannot change the permissions defined in AWS managed policies
AWS Managed Policies
Ø Some AWS managed policies are designed for specific job functions
Ø The job-specific AWS managed policies include:
Ø Administrator
Ø Billing
Ø Database Administrator
Ø Data Scientist
Ø Developer Power User
Ø Network Administrator
Ø Security Auditor
Ø Support User
Ø System Administrator
Ø View-Only User
Customer Managed Policies
Ø You can create standalone policies that you administer in your own AWS
account, which we refer to as customer managed policies
Ø You can then attach the policies to multiple principal entities in your AWS
account
Ø When you attach a policy to a principal entity, you give the entity the
permissions that are defined in the policy
Allowing access to an S3 bucket from IPv4 and IPv6 Addresses
Grant access to instances with a specific tag
Grant user permission to pass an IAM role
Ø To pass a role (and its permissions) to an AWS service, a user must have
permissions to pass the role to the service.
IAM Policy Evaluation Logic
Ø Identity-based policies – Identity-based policies are attached to an IAM identity
(user, group of users, or role) and grant permissions to IAM entities (users and
roles)
Ø Resource-based policies – Resource-based policies grant permissions to the
principal (account, user, role, or federated user) specified as the principal
Ø IAM permissions boundaries – Permissions boundaries are an advanced feature
that sets the maximum permissions that an identity-based policy can grant to
an IAM entity (user or role)
Ø AWS Organizations service control policies (SCPs) – Organizations SCPs specify
the maximum permissions for an organization or organizational unit (OU)
Ø Session policies – Session policies are advanced policies that you pass as
parameters when you programmatically create a temporary session for a role or
federated user
IAM Policy Evaluation Logic
Ø By default, all requests are implicitly denied. (Alternatively, by default,
the AWS account root user has full access.)
Ø An explicit allow in an identity-based or resource-based policy overrides
this default
Ø If a permissions boundary, Organizations SCP, or session policy is
present, it might override the allow with an implicit deny
Ø An explicit deny in any policy overrides any allows
IAM Policy Evaluation Logic
Amazon Inspector
Ø Inspector is an automated security assessment service that helps improve
the security and compliance of applications deployed on AWS
Ø Inspector automatically assesses applications for vulnerabilities or
deviations from best practices
Ø Uses an agent installed on EC2 instances
Ø Instances must be tagged
Encryption – In Transit vs At Rest
Encryption In Transit
HTTPS Connection
Unencrypted
SSL Object SSL
Amazon Simple Storage
Developer
Service
Data is protected
Encryption At Rest by SSL/TLS in
transit or “in-flight”
Amazon S3 encrypts
the object as it is
written to the bucket Data encryption key
Decryption
The same key is used
for both encryption and
decryption
Data encryption key
Encryption Decryption
Encrypted data
Plaintext data Plaintext data
AWS Key Management Service (KMS)
Ø AWS KMS is a service for creating and controlling encryption keys
Ø The customer master keys (CMKs) are protected by hardware
security modules (HSMs)
AWS KMS
Developer creates
customer managed
CMK CMK CMK CMK
Developer customer master keys
(CMKs) in AWS KMS
AWS Managed Keys
Type of CMK Can view Can manage Used only for my AWS account Automatic rotation
Customer managed CMK Yes Yes Yes Optional. Every 365 days
CMK
User
Ø AWS KMS does not store, manage, or track your data keys, or perform
cryptographic operations with data keys
Plaintext data key
Ø You must use and manage data keys outside of AWS KMS Encryption
Algorithm
Availability Customer-managed durability and Highly available and durable key storage
available and management
Root of Trust Customer managed root of trust AWS managed root of trust
3rd Party Support Broad 3rd Party Support Broad AWS service support
AWS CloudHSM
Benefits:
Ø FIPS 140-2 level 3 validated HSMs
Ø You can configure AWS Key Management Service (KMS) to use your AWS CloudHSM
cluster as a custom key store rather than the default KMS key store
Ø Managed service and automatically scales
Ø Retain control of your encryption keys - you control access (and AWS has no visibility of
your encryption keys)
AWS Certificate Manager (ACM)
Ø ACM is used for creating and managing public SSL/TLS certificates
Ø You can use public certificates provided by ACM (ACM certificates) or
certificates that you import into ACM
Ø ACM certificates can secure multiple domain names and multiple names
within a domain
Ø You can also use ACM to create wildcard SSL certificates that can protect an
unlimited number of subdomains
Certificate Renewal with ACM
Ø Managed renewal for SSL/TLS certificates
Ø Automatic if using DNS validation; email notification otherwise
Ø Provided for both public and private ACM certificates
Certificate Renewal with ACM
Ø At 60 days prior to expiration, ACM checks for the renewal
criteria:
Ø The certificate is currently in use by an AWS service
Ø A valid DNS record for the apex domain exists
Ø The required CNAME token is present and accessible in the
DNS record
Ø Each domain and subdomain that is named in the certificate
is present in the DNS record
Ø If all of these criteria are met, ACM considers the domain
names validated and renews the certificate
AWS Web Application Firewall (WAF)
Ø AWS WAF is a web application firewall
Ø WAF lets you create rules to filter web traffic based on conditions that include IP
addresses, HTTP headers and body, or custom URIs
Ø WAF makes it easy to create rules that block common web exploits like SQL
injection and cross site scripting
Ø WAF can be used to protect CloudFront distributions, ALBs (and the resources
behind them), and API Gateway APIs
AWS Web Application Firewall (WAF)
Ø Web ACLs - You use a web access control list (ACL) to protect a set of AWS
resources
Ø Rules - Each rule contains a statement that defines the inspection criteria, and
an action to take if a web request meets the criteria
Ø Rules groups – You can use rules individually or in reusable rule groups
AWS Web Application Firewall (WAF)
Ø IP Sets - An IP set provides a collection of IP addresses and IP address ranges
that you want to use together in a rule statement
Ø Regex pattern set - A regex pattern set provides a collection of regular
expressions that you want to use together in a rule statement
AWS Web Application Firewall (WAF)
A rule action tells AWS WAF what to do with a web request when it
matches the criteria defined in the rule:
Ø Count – AWS WAF counts the request but doesn't determine whether
to allow it or block it. With this action, AWS WAF continues processing
the remaining rules in the web ACL
Ø Allow – AWS WAF allows the request to be forwarded to the AWS
resource for processing and response
Ø Block – AWS WAF blocks the request and the AWS resource responds
with an HTTP 403 (Forbidden) status code
AWS Web Application Firewall (WAF)
Match statements compare the web request or its origin against
conditions that you provide
IP set match Inspects the request against a set of IP addresses and address ranges
Regex pattern set Compares regex patterns against a specified request component
SQLi attack Inspects for malicious SQL code in a specified request component
XSS scripting attack Inspects for cross-site scripting attacks in a specified request component
AWS Shield
Ø AWS Shield is a managed Distributed Denial of Service (DDoS)
protection service
Ø Safeguards web application running on AWS with always-on detection
and automatic inline mitigations
Ø Helps to minimize application downtime and latency
Ø Two tiers – Standard and Advanced
Ø Integrated with Amazon CloudFront
AWS Artifact
Ø AWS Artifact is your go-to, central resource for compliance-related
information that matters to you
Ø It provides on-demand access to AWS’ security and compliance reports and
select online agreements
Ø Reports available in AWS Artifact include our Service Organization Control
(SOC) reports, Payment Card Industry (PCI) reports, and certifications from
accreditation bodies across geographies and compliance verticals that validate
the implementation and operating effectiveness of AWS security controls
Ø Agreements available in AWS Artifact include the Business Associate
Addendum (BAA) and the Nondisclosure Agreement (NDA)
Identity Providers and Federation
AWS IAM
Social
Authenticated and
Providers
authorized users can
access AWS services
Web Identity Federation
for mobile apps uses
OpenID Connect (OIDC) –
AWS recommend to use
Cognito for this use case
AWS Single Sign-on (SSO)
AWS Organizations
Azure AD
(self-managed) AWS Account C
Amazon WorkSpaces
Connection over VPN Seamlessly join
or Direct Connect Windows EC2
instances to on-
premise AD domain
Company wishes to force users to change their Create an IAM password policy and enabled password
passwords regularly expiration
Need to restrict access to a bucket based on source IP Use bucket policy with "Condition": "NotIpAddress":
range statement
Need to control access to group of EC2 instances with Use an IAM policy with a condition element granting
specific tags access based on the tag and attach an IAM policy to
the user or groups that require access
IAM policy for SQS queue allows too much access. According the AWS shared responsibility mode, this is
Who is responsible for correcting the issue? a customer responsibility
Exam Scenarios
Data is encrypted with AWS KMS customer-managed Just enable key rotation in AWS KMS for the CMK
CMKs. Need to enable rotation ensuring the data (backing key is rotated, data key is not changed)
remains readable
Company must rotate encryption keys once a year Use customer-managed CMK and enabled automatic
with least effort key rotation
App uses KMS CMK with imported key material and To rotate, create a new CMK with new imported
references the CMK by alias in the application. Must material and update the key alias to point to new
be rotated every 6 months CMK
Exam Scenarios
Certificate request rejected by ACM Submit a request for a certificate using the correct
domain name NOT the ALB FQDN
Security findings are missing in Amazon Inspector Verify agent installed on affected instances and
restart agent
Security team need to verify vulnerabilities and Use Amazon Inspector and perform regular
exposures are addressed for EC2 instances regularly assessments
There may be a vulnerable version of software Create and run an Amazon Inspector assessment
installed on EC2 instances and need to check template
Exam Scenarios
Need to use information in request header to count Use a string match statement
requests from each front-end server
Large amount of suspicious HTTP requests hitting an Block the traffic using AWS WAF with a rate-based
ALB from various source IPs rule and a defined threshold
Many 404 errors being sent to one IP address every Use AWS WAF to block the activity
minute. Bot may be collecting info
Website has been deployed and penetration testing Use AWS WAF to mitigate cross-site scripting attacks
shows its vulnerable to cross-site scripting
Exam Scenarios
Application is under repeated DDoS attacks. Need to Setup AWS Shield Advanced
minimize downtime and require 24/7 support
Company needs to understand the PCI status of the Use AWS Artifact to locate this information
AWS infrastructure
Exam Scenarios
Company uses LDAP and needs to implement access Need to configure SAM federation of IAM users and
control in AWS as part of an integration between groups with the LDAP DB and map LDAP user and
internal and cloud groups to IAM roles
Permissions policy for cross-account access must be According to the AWS shared responsibility model,
created and attached. Who is responsible for doing this is a customer responsibility
this?
Company wishes to move from IAM user accounts to Configure a VPN tunnel and use Active Directory
using on-premises Active Directory accounts for AWS Connector
management console access
THE END
Hope you enjoyed the
course!