22. EC2

EC2 is a virtual machine in the cloud. Acts like a web server in the cloud. Elastic Compute Cloud (EC2) is a web service that provides resizable compute capacity in the cloud. EC2 reduces the time required to obtain and boot new server instances to minutes, allowing us to quickly scale capacity, both up and down, as the computing requirements change.

EC2 Pricing Model:

On Demand Reserved Spot Dedicated Hosts
Allows you to pay a fixed rate by the hour (or by the second) with no commitment. Provides with a capacity reservation and offers a significant discount on the hourly charge for an instance. Contract terms are 1 year or 3 year terms Enables to bid whatever price we want for instance capacity, providing for even greater savings if your applications have flexible start and end times Physical EC2 server dedicated for our use. Dedicated hosts can help to reduce costs by allowing you to use your existing server-bound software licenses.
On demand pricing is useful for:
i. Users that want the low cost and flexibility of EC2 w/o any up-front payment or long-term commitment.
ii. Applications with short term, spiky or unpredictable workloads that cannot be interrupted.
iii. Applications being developed or tested on EC2 for the first time. Reserved pricing is useful for:
i. Applications with steady state or predictable usage
ii. Applications that require reserved capacity
iii. Users able to make upfront payments to reduce their total computing costs even further.Reserved Pricing Types:
Standard Reserved Instances Convertible Reserved Instances Scheduled Reserved Instances
These offer up to 75% off on demand instances. The more we pay up front and the longer the contract, the greater the discount. These offer up to 54% off on demand capability to change the attributes of the RI as long as the exchange results in the creation of reserved instances if equal or greater value. These are available to launch within the time windows we reserve. This option allows to match your capacity reservation to a predictable recurring schedule that only requires a fraction of a day, week or month.
Spot pricing is useful for:
i. Applications that have flexible start and end times.
ii. Applications that are only feasible at very low compute prices.
iii. Users with urgent computing needs for large amounts of additional capacity. Dedicated hosts pricing is useful for:
i. Useful for regulatory requirements that may not support multi-tenant virtualization.
ii. Great for licensing which does not support multi-tenancy or cloud deployments.
iii. Can be purchased on-demand (hourly)
iv. Can be purchased as a reservation for up to 70% off the on-demand price.
If the spot instance is terminated by EC2, you will not be charged for a partial hour of usage. However, if you terminate the instance yourself, you will be charged for any hour in which the instance ran.
EC2 Instance Types: (not required for SAA)

Family Speciality Use Case
F1 Field programmable gate array Genomics research, financial analytics, real time video processing, big data etc
I3 High speed storage No SQL DBs, data warehousing etc
G3 Graphics intensive Video encoding/ 3D Application streaming
H1 High disk throughput Map reduce based workloads, distributed file systems such HDFS and MapR-FS
T3 Lowest cost, general purpose Web servers/ Small DBs
D2 Dense storage Fileservers/ data warehousing/ hadoop
R5 Memory optimized Memory intensive apps/ dbs
M5 General purpose Application servers
C5 Compute optimized CPU intensive apps/ dbs
P3 Graphics/ general purpose GPU Machine learning, Bit coin mining etc
X1 Memory optimized SAP HANA/ Apache Spark etc
Z1D High compute capacity and a high memory footprint Ideal for electronic design automation (EDA) and certain relational DB workloads with high per-core licensing costs.
A1 Arm-based workloads Scale-out workloads such as web servers
U-6tb1 Bare metal Bare metal capabilities that eliminate virtualization overhead.
EC2 Instance Types – Mnemonic (FIGHT DR MC PXZ AU)
F – FPGA
I – IOPS = Input Output Per Second. Determines how fast the hard
G – Graphics
H – High disk throughput
T – Cheap general purpose (think T2 micro)
D – Density
R – RAM
M – Main choice for general purpose apps
C – Compute
P – Graphics (think pics)
X – Extreme memory
Z – Extreme memory and CPU
A – Arm based workloads
U – Bare Metal

Shared responsibility model for EC2 storage

AWS User
Infrastructure Setting up backup/ snapshot procedures
Replication of data for EBS volumes and EFS drives Setting up data encryption
Replacing faulty hardware Responsibility of any data on drives
Ensuring AWS employees cannot access our data Understanding the risk of using EC2 instance store
EC2 Creation Steps:
Step 1: Choose an Amazon Machine Image (AMI) — Amazon Linux 2 AMI (HVM), SSD Volume Type
Step 2: Choose an Instance Type — t2.micro
Step 3: Configure Instance Details
Step 4: Add Storage — Root device volume = Virtual disk on the cloud. This is where operating system is going to be installed.
Step 5: Add Tags
Step 6: Configure Security Group — Security group is just a virtual firewall.
HTTP – Port 80
SSH – Port 22
Step 7: Review Instance Launch

Recap:
i. Termination protection is tuned off by default, we must turn it on.
ii. On an EBS backed instance, the default action is for the root EBS volume to be deleted when the instance is terminated.
iii. EBS root volumes of default AMI’s can be encrypted. We can also use a third party tool (such as bit locker etc) to encrypt the root volume, or this can be done when creating AMIs in the AWS console or using the API.
iv. Additional volumes can also be encrypted.

Please note HTTP is stateless protocol and FTP, TCP, SSH are not stateless protocol.

Question 1:
As a system operator for your company, you manage a set of web servers hosted on EC2 instances with public IP addresses. These IP addresses are associated with specific domain names. Yesterday, the servers were shut down for emergency maintenance. When the servers were started-up again, the website couldn’t be displayed on the internet.
Choose an option that may be the root cause of this issue.
Options:
A. It is necessary to reconfigure traffic on Route53 after restarting the EC2 instance
B. Elastic IP was not configured on EC2 instance
C. ELB health check failed for EC2 instance
D. Elastic IP is not set for the IP address of the subnet
Answer: B
Explanation
By default, the EC2 instance’s public IP address is released after the instance is stopped. As a result, the previous IP address that was mapped to the domain name becomes invalid and you cannot access it. By setting an Elastic IP for the EC2 instance, the IP address will be maintained even after the EC2 instance is restarted, and the domain name corresponding to the IP address can be used continuously. Therefore, option 2 is the correct answer.
Option 1 is incorrect. The overall correct solution is to prevent the IP address from changing at all. With this issue now made (loss of IP address), Route53 setting changes will be required by this is simply a follow-up response. It is not needed if the initial mistake was not made.
Option 3 is incorrect. If you get an ELB health check error on your EC2 instance, it should show an anomaly even before the reboot. This is not a reboot related problem.
Option 4 is incorrect. The IP address of the subnet will not be affected by the reboot.

Question 2:
Your company has told you the requirements for building a database using AWS. This company is required to manage the database environment in-house. As a Solutions Architect, you need to choose the best AWS service from your database requirements.
Select a database construction method that meets this requirement.
Options:
A. Build a DB using RDS
B. Build a DB using DynamoDB
C. Build a DB using Aurora
D. Build a DB using EC2 instances
Answer: D
Explanation
In order to manage the database environment in-house, it is necessary to completely control the underlying database instance by building a DB using EC2 instances. Therefore, option 4 is the correct answer.
Options 1, 2 and 3 are incorrect. Since other RDS / DynamoDB / Aurora are managed services, the infrastructure environment that configures the database cannot be managed in-house.

Question 3:
The solo founder at a tech startup has just created a brand new AWS account. The founder has provisioned an EC2 instance 1A which is running in region A. Later, he takes a snapshot of the instance 1A and then creates a new AMI in region A from this snapshot. This AMI is then copied into another region B. The founder provisions an instance 1B in region B using this new AMI in region B.
At this point in time, what entities exist in region B?
Options:
A. 1 EC2 instance and 1 snapshot exist in region B
B. 1 EC2 instance, 1 AMI and 1 snapshot exist in region B
C. 1 EC2 instance and 1 AMI exist in region B
D. 1 EC2 instance and 2 AMIs exist in region B
Answer: B
Explanation
Correct option:
1 EC2 instance, 1 AMI and 1 snapshot exist in region B
An Amazon Machine Image (AMI) provides the information required to launch an instance. You must specify an AMI when you launch an instance. When the new AMI is copied from region A into region B, it automatically creates a snapshot in region B because AMIs are based on the underlying snapshots. Further, an instance is created from this AMI in region B. Hence, we have 1 EC2 instance, 1 AMI and 1 snapshot in region B.
Incorrect options:
1 EC2 instance and 1 AMI exist in region B
1 EC2 instance and 2 AMIs exist in region B
1 EC2 instance and 1 snapshot exist in region B
As mentioned earlier in the explanation, when the new AMI is copied from region A into region B, it also creates a snapshot in region B because AMIs are based on the underlying snapshots. In addition, an instance is created from this AMI in region B. So, we have 1 EC2 instance, 1 AMI and 1 snapshot in region B. Hence all three options are incorrect.

Question 4:
A software engineering intern at an e-commerce company is documenting the process flow to provision EC2 instances via the Amazon EC2 API. These instances are to be used for an internal application that processes HR payroll data. He wants to highlight those volume types that cannot be used as a boot volume.
Can you help the intern by identifying those storage volume types that CANNOT be used as boot volumes while creating the instances? (Select two)
Options:
A. Throughput Optimized HDD (st1)
B. Cold HDD (sc1)
C. General Purpose SSD (gp2)
D. Provisioned IOPS SSD (io1)
E. Instance Store
Answer: A & B
Explanation
Correct options:
Throughput Optimized HDD (st1)
Cold HDD (sc1)
The EBS volume types fall into two categories:
SSD-backed volumes optimized for transactional workloads involving frequent read/write operations with small I/O size, where the dominant performance attribute is IOPS.
HDD-backed volumes optimized for large streaming workloads where throughput (measured in MiB/s) is a better performance measure than IOPS.
Throughput Optimized HDD (st1) and Cold HDD (sc1) volume types CANNOT be used as a boot volume, so these two options are correct.
Incorrect options:
General Purpose SSD (gp2)
Provisioned IOPS SSD (io1)
Instance Store
General Purpose SSD (gp2), Provisioned IOPS SSD (io1), and Instance Store can be used as a boot volume.

Question 5:
An application is currently hosted on four EC2 instances (behind Application Load Balancer) deployed in a single Availability Zone (AZ). To maintain an acceptable level of end-user experience, the application needs at least 4 instances to be always available.
As a solutions architect, which of the following would you recommend so that the application achieves high availability with MINIMUM cost?
• Deploy the instances in one Availability Zones. Launch two instances in the Availability Zone
• Deploy the instances in two Availability Zones. Launch two instances in each Availability Zone
• Deploy the instances in three Availability Zones. Launch two instances in each Availability Zone(Correct)
• Deploy the instances in two Availability Zones. Launch four instances in each Availability Zone
Explanation
Correct option:
Deploy the instances in three Availability Zones. Launch two instances in each Availability Zone
The correct option is to deploy the instances in three Availability Zones and launch two instances in each Availability Zone. Even if one of the AZs goes out of service, still we shall have 4 instances available and the application can maintain an acceptable level of end-user experience. Therefore, we can achieve high availability with just 6 instances in this case.
Incorrect options:
Deploy the instances in two Availability Zones. Launch two instances in each Availability Zone – When we launch two instances in two AZs, we run the risk of falling below the minimum acceptable threshold of 4 instances if one of the AZs fails. So this option is ruled out.
Deploy the instances in two Availability Zones. Launch four instances in each Availability Zone – When we launch four instances in two AZs, we have to bear costs for 8 instances which is NOT cost-optimal. So this option is ruled out.
Deploy the instances in one Availability Zones. Launch two instances in the Availability Zone – We can’t have just two instances in a single AZ as that is below the minimum acceptable threshold of 4 instances.

Question 6:
An application runs big data workloads on EC2 instances. The application needs at least 20 instances to maintain a minimum acceptable performance threshold and the application needs 300 instances to handle spikes in the workload. Based on historical workloads processed by the application, it needs 80 instances 80% of the time.
As a solutions architect, which of the following would you recommend as the MOST cost-optimal solution so that it can meet the workload demand in a steady state?
A• Purchase 80 on-demand instances. Use Auto Scaling Group to provision the remaining instances as spot instances per the workload demand
B• Purchase 80 spot instances. Use Auto Scaling Group to provision the remaining instances as on-demand instances per the workload demand
C• Purchase 80 on-demand instances. Provision additional on-demand and spot instances per the workload demand (Use Auto Scaling Group with launch template to provision the mix of on-demand and spot instances)
D• Purchase 80 reserved instances. Provision additional on-demand and spot instances per the workload demand (Use Auto Scaling Group with launch template to provision the mix of on-demand and spot instances)
Answer: D
Explanation
Correct option:
Purchase 80 reserved instances. Provision additional on-demand and spot instances per the workload demand (Use Auto Scaling Group with launch template to provision the mix of on-demand and spot instances)
As the steady-state workload demand is 80 instances, we can save on costs by purchasing 80 reserved instances. Based on additional workload demand, we can specify a mix of on-demand and spot instances using Application Load Balancer with a launch template to provision the mix of on-demand and spot instances.
Incorrect options:
Purchase 80 on-demand instances. Use Auto Scaling Group to provision the remaining instances as spot instances per the workload demand – Provisioning 80 on-demand instances would end up costlier than the option where we provision 80 reserved instances. So this option is ruled out.
Purchase 80 on-demand instances. Provision additional on-demand and spot instances per the workload demand (Use Auto Scaling Group with launch template to provision the mix of on-demand and spot instances) – Provisioning 80 on-demand instances would end up costlier than the option where we provision 80 reserved instances. So this option is ruled out.
Purchase 80 spot instances. Use Auto Scaling Group to provision the remaining instances as on-demand instances per the workload demand – The option to purchase 80 spot instances is incorrect, as there is no guarantee regarding the availability of the spot instances, which means we may not even meet the steady-state workload.

Question 7:
An engineering team wants to examine the feasibility of the user data feature of Amazon EC2 for an upcoming project.
Which of the following are true about the EC2 user data configuration? (Select two)
A• By default, user data is executed every time an EC2 instance is re-started
B• By default, user data runs only during the boot cycle when you first launch an instance
C• By default, scripts entered as user data do not have root user privileges for executing
D• When an instance is running, you can update user data by using root user credentials
E• By default, scripts entered as user data are executed with root user privileges
Answer: B & E
Explanation
Correct options:
User Data is generally used to perform common automated configuration tasks and even run scripts after the instance starts. When you launch an instance in Amazon EC2, you can pass two types of user data – shell scripts and cloud-init directives. You can also pass this data into the launch wizard as plain text or as a file.
By default, scripts entered as user data are executed with root user privileges – Scripts entered as user data are executed as the root user, hence do not need the sudo command in the script. Any files you create will be owned by root; if you need non-root users to have file access, you should modify the permissions accordingly in the script.
By default, user data runs only during the boot cycle when you first launch an instance – By default, user data scripts and cloud-init directives run only during the boot cycle when you first launch an instance. You can update your configuration to ensure that your user data scripts and cloud-init directives run every time you restart your instance.
Incorrect options:
By default, user data is executed every time an EC2 instance is re-started – As discussed above, this is not a default configuration of the system. But, can be achieved by explicitly configuring the instance.
When an instance is running, you can update user data by using root user credentials – You can’t change the user data if the instance is running (even by using root user credentials), but you can view it.
By default, scripts entered as user data do not have root user privileges for executing – Scripts entered as user data are executed as the root user, hence do not need the sudo command in the script.

Question 8:
An IT company wants to optimize the costs incurred on its fleet of 100 EC2 instances for the next year. Based on historical analyses, the engineering team observed that 70 of these instances handle the compute services of its flagship application and need to be always available. The other 30 instances are used to handle batch jobs that can afford a delay in processing.
As a solutions architect, which of the following would you recommend as the MOST cost-optimal solution?
A• Purchase 70 on-demand instances and 30 spot instances
B• Purchase 70 on-demand instances and 30 reserved instances
C• Purchase 70 reserved instances and 30 on-demand instances
D• Purchase 70 reserved instances and 30 spot instances
Answer: D
Explanation
Correct option:
Purchase 70 reserved instances and 30 spot instances
As 70 instances need to be always available, these can be purchased as reserved instances for a one-year duration. The other 30 instances responsible for the batch job can be purchased as spot instances. Even if some of the spot instances are interrupted, other spot instances can continue with the job.
Incorrect options:
Purchase 70 on-demand instances and 30 spot instances
Purchase 70 on-demand instances and 30 reserved instances
Purchasing 70 on-demand instances would be costlier than 70 reserved instances, so these two options are ruled out.
Purchase 70 reserved instances and 30 on-demand instances – Purchasing 30 instances as on-demand instances to handle the batch jobs would not be cost-optimal as these instances don’t need to be always available. Spot instances are better at handling such batch jobs. So this option is not correct.

Question 9:
A health-care solutions company wants to run their applications on single-tenant hardware to meet regulatory guidelines.
Which of the following is the MOST cost-effective way of isolating their Amazon EC2 instances to a single tenant?
A• Dedicated Instances
B• On-Demand Instances
C• Spot Instances
D• Dedicated Hosts
Answer: A
Explanation
Correct option:
Dedicated Instances – Dedicated Instances are Amazon EC2 instances that run in a virtual private cloud (VPC) on hardware that’s dedicated to a single customer. Dedicated Instances that belong to different AWS accounts are physically isolated at a hardware level, even if those accounts are linked to a single-payer account. However, Dedicated Instances may share hardware with other instances from the same AWS account that are not Dedicated Instances.
A Dedicated Host is also a physical server that’s dedicated for your use. With a Dedicated Host, you have visibility and control over how instances are placed on the server.
Incorrect options:
Spot Instances – A Spot Instance is an unused EC2 instance that is available for less than the On-Demand price. Your Spot Instance runs whenever capacity is available and the maximum price per hour for your request exceeds the Spot price. Any instance present with unused capacity will be allocated. Even though this is cost-effective, it does not fulfill the single-tenant hardware requirement of the client and hence is not the correct option.
Dedicated Hosts – An Amazon EC2 Dedicated Host is a physical server with EC2 instance capacity fully dedicated to your use. Dedicated Hosts allow you to use your existing software licenses on EC2 instances. With a Dedicated Host, you have visibility and control over how instances are placed on the server. This option is costlier than the Dedicated Instance and hence is not the right choice for the current requirement.
On-Demand Instances – With On-Demand Instances, you pay for compute capacity by the second with no long-term commitments. You have full control over its lifecycle—you decide when to launch, stop, hibernate, start, reboot, or terminate it. Hardware isolation is not possible and on-demand has one of the costliest instance charges and hence is not the correct answer for current requirements.

Question 10:
Amazon EC2 Auto Scaling needs to terminate an instance from Availability Zone (AZ) us-east-1a as it has the most number of instances amongst the AZs being used currently. There are 4 instances in the AZ us-east-1a like so: Instance A has the oldest launch template, Instance B has the oldest launch configuration, Instance C has the newest launch configuration and Instance D is closest to the next billing hour.
Which of the following instances would be terminated per the default termination policy?
A• Instance C
B• Instance D
C• Instance B
D• Instance A
Answer: C
Explanation
Correct option:
Instance B
Per the default termination policy, the first priority is given to any allocation strategy for On-Demand vs Spot instances. As no such information has been provided for the given use-case, so this criterion can be ignored. The next priority is to consider any instance with the oldest launch template unless there is an instance that uses a launch configuration. So this rules out Instance A. Next, you need to consider any instance which has the oldest launch configuration. This implies Instance B will be selected for termination and Instance C will also be ruled out as it has the newest launch configuration. Instance D, which is closest to the next billing hour, is not selected as this criterion is last in the order of priority.
Incorrect options:
Instance A
Instance C
Instance D
These three options contradict the explanation provided above, so these options are incorrect.

Question 11:
Your company has a monthly big data workload, running for about 2 hours, which can be efficiently distributed across various servers of various sizes, with a variable number of CPU, and that can withstand server failures.
Which is the MOST cost-optimal solution for this workload?
A• Run the workload on Dedicated Hosts
B• Run the workload on Reserved Instances
C• Run the workload on Spot Instances
D• Run the workload on a Spot Fleet
Answer: D
Explanation
Correct option:
Run the workload on a Spot Fleet
The Spot Fleet selects the Spot Instance pools that meet your needs and launches Spot Instances to meet the target capacity for the fleet. By default, Spot Fleets are set to maintain target capacity by launching replacement instances after Spot Instances in the fleet are terminated.
A Spot Instance is an unused EC2 instance that is available for less than the On-Demand price. Spot Instances provide great cost efficiency, but we need to select an instance type in advance. In this case, we want to use the most cost-optimal option and leave the selection of the cheapest spot instance to a Spot Fleet request, which can be optimized with the lowestPrice strategy. So this is the correct option.
Incorrect options:
Run the workload on Spot Instances – A Spot Instance is an unused EC2 instance that is available for less than the On-Demand price. Because Spot Instances enable you to request unused EC2 instances at steep discounts, you can lower your Amazon EC2 costs significantly. The hourly price for a Spot Instance is called a Spot price. As spot fleets can maintain target capacity by launching replacement instances after Spot Instances in the fleet are terminated, so spot instances are not the right fit for this use-case.
Run the workload on Reserved Instances – Reserved Instances are less cost-optimized than Spot Instances, and most efficient when used continuously. Here the workload is once a month, so this is not efficient.
Run the workload on Dedicated Hosts – Amazon EC2 Dedicated Hosts allow you to use your eligible software licenses from vendors such as Microsoft and Oracle on Amazon EC2 so that you get the flexibility and cost-effectiveness of using your licenses, but with the resiliency, simplicity, and elasticity of AWS. An Amazon EC2 Dedicated Host is a physical server fully dedicated for your use, so you can help address corporate compliance requirement. They’re not particularly cost-efficient. So this option is not correct.

Question 12:
A financial services company is looking to move its on-premises IT infrastructure to AWS Cloud. The company has multiple long-term server bound licenses across the application stack and the CTO wants to continue to utilize those licenses while moving to AWS.
As a solutions architect, which of the following would you recommend as the MOST cost-effective solution?
• Use EC2 dedicated instances
• Use EC2 reserved instances
• Use EC2 dedicated hosts
• Use EC2 on-demand instances
Answer: C
Explanation
Correct option:
Use EC2 dedicated hosts
You can use Dedicated Hosts to launch Amazon EC2 instances on physical servers that are dedicated for your use. Dedicated Hosts give you additional visibility and control over how instances are placed on a physical server, and you can reliably use the same physical server over time. As a result, Dedicated Hosts enable you to use your existing server-bound software licenses like Windows Server and address corporate compliance and regulatory requirements.
Incorrect options:
Use EC2 dedicated instances – Dedicated instances are Amazon EC2 instances that run in a VPC on hardware that’s dedicated to a single customer. Your dedicated instances are physically isolated at the host hardware level from instances that belong to other AWS accounts. Dedicated instances may share hardware with other instances from the same AWS account that are not dedicated instances. Dedicated instances cannot be used for existing server-bound software licenses.
Use EC2 on-demand instances
Use EC2 reserved instances
Amazon EC2 presents a virtual computing environment, allowing you to use web service interfaces to launch instances with a variety of operating systems, load them with your custom application environment, manage your network’s access permissions, and run your image using as many or few systems as you desire.
Amazon EC2 provides the following purchasing options to enable you to optimize your costs based on your needs:
On-Demand Instances – Pay, by the second, for the instances that you launch.
Reserved Instances – Reduce your Amazon EC2 costs by making a commitment to a consistent instance configuration, including instance type and Region, for a term of 1 or 3 years.
Neither on-demand instances nor reserved instances can be used for existing server-bound software licenses.

Question 13:
The development team at a retail company wants to optimize the cost of EC2 instances. The team wants to move certain nightly batch jobs to spot instances. The team has hired you as a solutions architect to provide the initial guidance.
Which of the following would you identify as CORRECT regarding the capabilities of spot instances? (Select three)
• If a spot request is persistent, then it is opened again after your Spot Instance is interrupted
• When you cancel an active spot request, it does not terminate the associated instance
• Spot blocks are designed to be interrupted, just like a spot instance
• When you cancel an active spot request, it terminates the associated instance as well
• If a spot request is persistent, then it is opened again after you stop the Spot Instance
• Spot blocks are designed not to be interrupted
Answer: A, B & F
Explanation
Correct options:
If a spot request is persistent, then it is opened again after your Spot Instance is interrupted
Spot blocks are designed not to be interrupted
When you cancel an active spot request, it does not terminate the associated instance
A Spot Instance is an unused EC2 instance that is available for less than the On-Demand price. Because Spot Instances enable you to request unused EC2 instances at steep discounts, you can lower your Amazon EC2 costs significantly. The hourly price for a Spot Instance is called a Spot price. The Spot price of each instance type in each Availability Zone is set by Amazon EC2 and adjusted gradually based on the long-term supply of and demand for Spot Instances.
A Spot Instance request is either one-time or persistent. If the spot request is persistent, the request is opened again after your Spot Instance is interrupted. If the request is persistent and you stop your Spot Instance, the request only opens after you start your Spot Instance. Therefore the option – “If a spot request is persistent, then it is opened again after your Spot Instance is interrupted” – is correct.
How Spot requests work via – https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/spot-requests.html
Spot Instances with a defined duration (also known as Spot blocks) are designed not to be interrupted and will run continuously for the duration you select. You can use a duration of 1, 2, 3, 4, 5, or 6 hours. In rare situations, Spot blocks may be interrupted due to Amazon EC2 capacity needs. Therefore, the option – “Spot blocks are designed not to be interrupted” – is correct.
If your Spot Instance request is active and has an associated running Spot Instance, or your Spot Instance request is disabled and has an associated stopped Spot Instance, canceling the request does not terminate the instance; you must terminate the running Spot Instance manually. Moreover, to cancel a persistent Spot request and terminate its Spot Instances, you must cancel the Spot request first and then terminate the Spot Instances. Therefore, the option – “When you cancel an active spot request, it does not terminate the associated instance” – is correct.
Incorrect options:
When you cancel an active spot request, it terminates the associated instance as well – If your Spot Instance request is active and has an associated running Spot Instance, then canceling the request does not terminate the instance; you must terminate the running Spot Instance manually. So, this option is.
If a spot request is persistent, then it is opened again after you stop the Spot Instance – If the request is persistent and you stop your Spot Instance, the request only opens after you start your Spot Instance. So, this option is.
Spot blocks are designed to be interrupted, just like a spot instance – Spot blocks are designed not to be interrupted. Only in rare situations, spot blocks may be interrupted due to Amazon EC2 capacity needs. So, this option is.

Question 14:
An IT consultant is helping a small business revamp their technology infrastructure on the AWS Cloud. The business has two AWS accounts and all resources are provisioned in the us-west-2 region. The IT consultant is trying to launch an EC2 instance in each of the two AWS accounts such that the instances are in the same Availability Zone of the us-west-2 region. Even after selecting the same default subnet (us-west-2a) while launching the instances in each of the AWS accounts, the IT consultant notices that the Availability Zones are still different.
As a solutions architect, which of the following would you suggest resolving this issue?
• Use the default VPC to uniquely identify the Availability Zones across the two AWS Accounts
• Reach out to AWS Support for creating the EC2 instances in the same Availability Zone across the two AWS accounts
• Use AZ ID to uniquely identify the Availability Zones across the two AWS Accounts(Correct)
• Use the default subnet to uniquely identify the Availability Zones across the two AWS Accounts
Explanation
Correct option:
Use AZ ID to uniquely identify the Availability Zones across the two AWS Accounts
An Availability Zone is represented by a region code followed by a letter identifier; for example, us-east-1a. To ensure that resources are distributed across the Availability Zones for a region, AWS maps Availability Zones to names for each AWS account. For example, the Availability Zone us-west-2a for one AWS account might not be the same location as us-west-2a for another AWS account.
To coordinate Availability Zones across accounts, you must use the AZ ID, which is a unique and consistent identifier for an Availability Zone. For example, usw2-az2 is an AZ ID for the us-west-2 region and it has the same location in every AWS account.
Viewing AZ IDs enables you to determine the location of resources in one account relative to the resources in another account. For example, if you share a subnet in the Availability Zone with the AZ ID usw2-az2 with another account, this subnet is available to that account in the Availability Zone whose AZ ID is also usw2-az2.
You can view the AZ IDs by going to the service health section of the EC2 Dashboard via your AWS Management Console.
AZ IDs for Availability Zones
Incorrect options:
Use the default VPC to uniquely identify the Availability Zones across the two AWS Accounts – A virtual private cloud (VPC) is a virtual network dedicated to your AWS account. It is logically isolated from other virtual networks in the AWS Cloud. Since a VPC spans an AWS region, it cannot be used to uniquely identify an Availability Zone. Therefore, this option is incorrect.
Use the default subnet to uniquely identify the Availability Zones across the two AWS Accounts – A subnet is a range of IP addresses in your VPC. A subnet spans an Availability Zone of an AWS region. The default subnet representing the Availability Zone us-west-2a for one AWS account might not be the same location as us-west-2a for another AWS account. Therefore, this option is incorrect.
Reach out to AWS Support for creating the EC2 instances in the same Availability Zone across the two AWS accounts – Since the AZ ID is a unique and consistent identifier for an Availability Zone, there is no need to contact AWS Support. Therefore, this option is incorrect.

Question 15:
A social media company runs its IT infrastructure on the AWS Cloud. The company has a batch job running at 1 am daily that takes a backup of the media assets uploaded for the past day and the entire job takes about 3 hours to run. The company wants to use the MOST cost-effective long-term purchasing option for EC2 instances such that the job is guaranteed to run during the defined time window.
As a solutions architect, which of the following EC2 purchase options would you recommend?
• Dedicated Instances
• Scheduled Reserved Instances (Correct)
• On-Demand Instances
• Spot Instances
Explanation
Correct option:
Scheduled Reserved Instances
EC2 Scheduled Reserved Instances provide a capacity reservation so that you can have confidence in your ability to launch the number of instances you have reserved when you need them. Scheduled Reserved Instances run on a part-time basis. Scheduled Reserved Instances option allows you to reserve capacity on a recurring daily, weekly, and monthly schedule. For the given use-case, you can purchase a daily reservation every day so that the daily job to backup media assets is guaranteed to run during the defined time window. Scheduled Reserved Instances are available for one-year terms at 5-10% below On-Demand rates.
Incorrect options:
On-Demand Instances – With an On-Demand instance, you pay for compute capacity by the hour or the second depending on which instances you run. It is a good fit for applications with short-term, spiky, or unpredictable workloads that cannot be interrupted. For the given use-case, we don’t need the instance to be always running, as that would incur unnecessary costs. We could use a script to run the on-demand instance only during the defined job window, still, it would be expensive compared to Scheduled Reserved instances (remember that Scheduled Reserved Instances are available for one-year terms at 5-10% below On-Demand rates)
Spot Instances – A Spot Instance is an unused EC2 instance that is available for less than the On-Demand price. Because Spot Instances enable you to request unused EC2 instances at steep discounts, you can lower your Amazon EC2 costs significantly (up to 90% off the On-Demand price). As the Spot Instance runs whenever capacity is available, there is no guarantee that the daily job will be executed during the defined time window. Therefore this option is incorrect.
Dedicated Instances – Dedicated instances are Amazon EC2 instances that run in a VPC on hardware that’s dedicated to a single customer. Your dedicated instances are physically isolated at the host hardware level from instances that belong to other AWS accounts. Dedicated instances may share hardware with other instances from the same AWS account that are not dedicated instances. The given use-case does not require the instances to run on dedicated hardware, so it’s not the correct choice.
References:
https://aws.amazon.com/about-aws/whats-new/2016/01/announcing-amazon-ec2-reserved-instances-for-recurring-instances/
https://aws.amazon.com/ec2/pricing/

Question 16:
A DevOps engineer at an IT company just upgraded an EC2 instance type from t2.nano (0.5G of RAM, 1 vCPU) to u-12tb1.metal (12.3 TB of RAM, 448 vCPUs). How would you categorize this upgrade?
• This is an example of high availability
• This is a scale-out example of vertical scalability
• This is a scale-up example of horizontal scalability
• This is a scale-up example of vertical scalability (Correct)
Explanation
Correct option:
This is a scale-up example of vertical scalability
Vertical scalability means increasing the size of the instance. For example, your application runs on a t2.micro. Scaling up that application vertically means running it on a larger instance such as t2.large. Scaling down that application vertically means running it on a smaller instance such as t2.nano. Scalability is very common for non-distributed systems, such as a database. There’s usually a limit to how much you can vertically scale (hardware limit). In this case, as the instance type was upgraded from t2.nano to u-12tb1.metal, this is a scale-up example of vertical scalability.
Incorrect options:
This is a scale-up example of horizontal scalability – Horizontal Scalability means increasing the number of instances/systems for your application. When you increase the number of instances, it’s called scale-out whereas if you decrease the number of instances, it’s called scale-in. Scale-up is used in conjunction with vertical scaling and not with horizontal scaling. Hence this is incorrect.
This is a scale-out example of vertical scalability – Scale-out is used in conjunction with horizontal scaling and not with vertical scaling. Hence this is incorrect.
This is an example of high availability – High availability means running your application/system in at least 2 data centers (== Availability Zones). The goal of high availability is to survive a data center loss. An example of High Availability is when you run instances for the same application across multi AZ. This option has been added as a distractor.

Question 17:
A development team working for a gaming company has deployed an application on EC2 and needs CloudWatch monitoring for the relevant metrics with a resolution of 1 minute in order to set alarms that can rapidly react to changes.
As a solutions architect, which of the following would you suggest as the MOST optimal solution?
• The development team should create and send a high-resolution custom metric
• Use AWS Lambda to retrieve metrics often using the application /health route
• Enable EC2 basic monitoring
• Enable EC2 detailed monitoring (Correct)
Explanation
Correct option:
Enable EC2 detailed monitoring
Metrics are the fundamental concept in CloudWatch. A metric represents a time-ordered set of data points that are published to CloudWatch. Think of a metric as a variable to monitor, and the data points as representing the values of that variable over time.
By default, your instance is enabled for basic monitoring. You can optionally enable detailed monitoring. After you enable detailed monitoring, the Amazon EC2 console displays monitoring graphs with a 1-minute period for the instance. So you can use EC2 detailed monitoring for the given use-case. You are charged per metric that is sent to CloudWatch. You are not charged for data storage.
Incorrect options:
The development team should create and send a high-resolution custom metric – You can publish your own metrics to CloudWatch using the AWS CLI or an API. You can view statistical graphs of your published metrics with the AWS Management Console. Metrics produced by AWS services are standard resolution by default. When you publish a custom metric, you can define it as either standard resolution or high resolution. When you publish a high-resolution metric, CloudWatch stores it with a resolution of 1 second, and you can read and retrieve it with a period of 1 second, 5 seconds, 10 seconds, 30 seconds, or any multiple of 60 seconds. Custom metrics need extra effort to capture and push the custom metrics to CloudWatch via the API or CLI, so it’s not the MOST optimal solution for the given use-case.
Use AWS Lambda to retrieve metrics often using the application /health route – This option has been added as a distractor as you cannot retrieve performance metrics using the /health route via Lambda or otherwise.
Enable EC2 basic monitoring – By default, your instance is enabled for basic monitoring free of cost. Data is available automatically in 5-minute periods.

Question 18:
A retail company has its flagship application running on a fleet of EC2 instances behind an Elastic Load Balancer (ELB). The engineering team has been seeing recurrent issues wherein the in-flight requests from the ELB to the EC2 instances are getting dropped when an instance becomes unhealthy.
Which of the following features can be used to address this issue?
• Cross Zone load balancing
• Sticky Sessions
• Idle Timeout
• Connection Draining (Correct)
Explanation
Correct option:
Connection Draining
To ensure that an Elastic Load Balancer stops sending requests to instances that are de-registering or unhealthy while keeping the existing connections open, use connection draining. This enables the load balancer to complete in-flight requests made to instances that are de-registering or unhealthy. The maximum timeout value can be set between 1 and 3,600 seconds (the default is 300 seconds). When the maximum time limit is reached, the load balancer forcibly closes connections to the de-registering instance.
Incorrect options:
Cross Zone Load Balancing – The nodes for your load balancer distribute requests from clients to registered targets. When cross-zone load balancing is enabled, each load balancer node distributes traffic across the registered targets in all enabled Availability Zones. Cross Zone load balancing cannot be used to complete in-flight requests made to instances that are de-registering or unhealthy.
Sticky Sessions – You can use the sticky session feature (also known as session affinity) to enable the load balancer to bind a user’s session to a specific instance. This ensures that all requests from the user during the session are sent to the same instance. Sticky sessions cannot be used to complete in-flight requests made to instances that are de-registering or unhealthy.
Idle Timeout – For each request that a client makes through an Elastic Load Balancer, the load balancer maintains two connections. The front-end connection is between the client and the load balancer. The back-end connection is between the load balancer and a registered EC2 instance. The load balancer has a configured “idle timeout” period that applies to its connections. If no data has been sent or received by the time that the “idle timeout” period elapses, the load balancer closes the connection. “Idle timeout” can not be used to complete in-flight requests made to instances that are de-registering or unhealthy.