EC2 (ACG) Flashcards

1
Q

How would you connect to a newly created EC2 instance from the terminal?

A
  1. After creating the new EC2 instance, browse to the download of the new key pair
  2. Change to read only:
    chmod 400 mynewkp.pem
  3. ssh ec2-user@[instance IP goes here] -i mynewkp.pem
  4. sudo su
  5. yum update -y
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

How would you list and create S3 buckets from the terminal?

A

aws S3 ls

aws S3 mb s3://mybucket-john-1234

Bucket names must be unique across all AWS accounts in all the AWS regions within a partition. A partition is a group of Regions.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What are the AWS partitions?

A

A partition is a group of Regions. AWS currently has three partitions:

  1. Standard Regions (aws)
  2. China Regions (aws-cn)
  3. AWS GovCloud US (aws-us-gov)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is Amazon’s fully managed RDS engine?

A

Amazon Aurora which is compatible with MySQL and PostgreSQL. Aurora can deliver up to five times the throughput of MySQL and up to three times the throughput of PostgreSQL without requiring changes to most of your existing applications.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is the difference between OLTP and OLAP?

A

Online Transaction Processing (OLTP) is all about data processing and completing large numbers of small transactions in real-time, for example, customer orders, banking transactions, payments and booking systems.

Online Analytics Processing (OLAP) processes complex queries to analyze historical data, for example, analyzing net profit figures from the past 3 years, and sales forecasting.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What are RDS database types?

A

SQLServer, Oracle, MySQL, PostgreSQL, Maria DB, and Amazon Aurora.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

RDS is designed for which type of workloads?

A

OLTP workloads. Great for processing lots of small transactions like customer orders, banking transactions, payments, and booking systems.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

RDS is suitable for OLAP workloads. True or false?

A

False, RDS is not suitable for OLAP. Use Redshift for data warehousing and OLAP tasks, like analyzing large amounts of data, reporting, and sales forecasting.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is Multi-AZ?

A

It is an exact copy of your production database in another Availability Zone. AWS handles the replication for you. When you write to your production database, this right will automatically synchronize to the standby database.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Which RDS types can be configured as Multi-AZ?

A

All of them. SQL Server, Oracle MySQL, PostgreSQL and MariaDB.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What happens in the event of unplanned failure in RDS Multi-AZ?

A

RDS will automatically fail over to the standby during a failure so that database operations can resume quickly without administrative intervention. Multi-AZ is for disaster recovery, not for improving performance, so you cannot connect to the standby when the primary DB is active.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What can you do to improve performance of your RDS database?

A

Add read replicas. A read replica is a read-only copy of your primary database. Great for read heavy workloads and takes the load off your primary database. Each read replica has its own DNS endpoint which is different and independent from the primary database.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Read Replicas are primarily used for disaster recovery. True or false?

A

FALSE

Read replicas are primarily used for scaling, not for disaster recovery.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Read replicas requires automatic backups. True or false?

A

TRUE

Automatic backups must be enabled in order to deploy a read replica.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Multiple read replicas are supported. True or false?

A

TRUE

MySQL, Maria DB, PostgreSQL, Oracle, and SQL Server allow you to add up to five read replicas to each DB instance.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Multi-AZ is used for disaster recovery. True or false?

A

TRUE

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

Read replicas provide a read-only copy of your primary database in the same AZ, cross-AZ or cross-region. True or false

A

TRUE

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

What are three key characteristics of Multi-AZ?

A
  1. An exact copy of your production database in another AZ.
  2. Used for DR (disaster recovery).
  3. In the event of a failure, RDS will automatically fail over to the standby instance.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

What are three key characteristics of read replica?

A
  1. A read-only copy of your primary database in the same AZ, cross-AZ, or cross-region.
  2. Used to increase or scale read performance.
  3. Great for read-heavy workloads and takes the load off your primary database for read only workloads, e.g., business intelligence reporting jobs.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

What are the two ways to backup RDS?

A
  1. Database snapshot

2. Automated Backup (enabled by default)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

You can enable encryption at any time on an RDS DB instance. True or false?

A

FALSE

You can’t enable encryption on an unencrypted RDS DB instance. Encryption must be enabled when first creating your database.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

How would you encrypt an existing unencrypted RDS DB instance?

A

Create a snapshot, encrypt the snapshot, and then do a database restore with the encrypted snapshot.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q

What are four key characteristics of automated backups?

A
  1. Automated, enabled by default, you define the backup window
  2. Point-in-time snapshot plus transaction logs
  3. Retention period of 1 to 35 days
  4. Can be used to recover your database to any point in time within the retention period
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
24
Q

What are four key characteristics of a DB snapshot?

A
  1. User initiated, ad hoc
  2. Point-in-time snapshot only
  3. No retention period; stored indefinitely until you delete
  4. Used to back up your DB instance to a known state and restore to that specific state at any time, e.g., before major changes to a database
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
Q

What are three things to keep in mind regarding RDS encryption?

A
  1. Must be enabled at creation. Includes all underlying storage, automated backups, snapshots, logs, and read replicas.
  2. Uses the AWS Key Management Service (KMS) service for AES-256 encryption.
  3. Existing unencrypted RDS instances can be encrypted through snapshots. You can create a new RDS instance from the encrypted snapshot.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
26
Q

What is ElastiCache?

A

ElastiCache stores frequently accessed data in an in-memory cache. Memory is faster than disk.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
27
Q

What are the two types of ElastiCache?

A
  1. Memcached - great for object caching, scales horizontally, but no persistence, Multi-AZ, or failover.
  2. Redis - more sophisticated solution with enterprise features like persistence, replication, Multi-AZ, and failover. Supports sorting and ranking data, and complex data types like lists and hashes.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
28
Q

When should you use ElastiCache?

A

When your database is read heavy and the data is not prone to frequent changing.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
29
Q

ElastiCache is great for write heavy loads. True or false?

A

FALSE

ElastiCache is an in-memory cache designed to improve read performance for read-heavy databases.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
30
Q

When should you use memcached?

A
  1. Fast in-memory, key-value data store
  2. Object caching is your primary goal
  3. You want to keep things as simple as possible
  4. You don’t need persistence or Multi-AZ
  5. You don’t need to support advanced data types or sorting
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
31
Q

When should you use redis?

A
  1. Fast in memory, key-value data store
  2. You are performing data sorting and ranking, such as gaming leaderboards
  3. You have advanced data types, such as lists and hashes
  4. You need data persistence
  5. You need Multi-AZ
32
Q

What is Parameter Store?

A

Parameter store is a great way to store confidential information, such as, passwords, database connection strings, license codes, etc.

You can store values as plain text or encrypt them through KMS.

You can reference your parameters using the parameter name, e.g., in a bootstrap script.

You can use Parameter Store with AWS services such as EC2, CloudFormation, Lambda, CodeBuild, CodePipeline and CodeDeploy.

33
Q

What is EC2?

A

EC2 is like a virtual machine that is hosted in AWS instead of your data center. EC stands for elastic compute which allows you to:

  • select the capacity that you need right now
  • grow and shrink when you need
  • pay for what you use
  • wait minutes, not months
34
Q

What are the four EC2 instance pricing options?

A
  1. On-Demand - pay by the hour or the second on the type of instance you run. Great for flexibility.
  2. Reserved - reserve capacity for one or three years. Up to 72% discount on the hourly charge. Great if you have known, fixed requirements.
  3. Spot - purchased unused capacity at a discount of up to 90%. Prices fluctuate with supply and demand. Great for applications with flexible start and end times.
  4. Dedicated - a physical EC2 server dedicated for your use. Great if you have server-bound licenses to reuse or compliance requirements.
35
Q

What is an instance type?

A

An instance type determines the hardware of the host computer. Each instance type offers different compute, memory, and storage capabilities. These types are grouped in instance families.

36
Q

Name instance types you would select based on application requirements.

A

General purpose (web servers/code repos)

Compute optimized (batch processing, media transcoding, high performance web servers, machine learning)

Memory optimized (large data sets in memory, open-source DBs, real time big analytics)

Accelerated computing (machine learning, computational fluid dynamics, autonomous vehicles, speech recognition)

Storage optimized (search engines, data analytics workloads)

37
Q

What are EBS volumes?

A

Elastic Block Store (EBS). Highly available and scalable storage volumes you can attach to an EC2 instance.

38
Q

What are the different types of EBS volumes?

A

For general apps up to 16,000 IOPS:
gp2 - general purpose SSD
gp3 - latest gen SSD and cheaper!)

For online transaction processing (OLTP) up to 64,000 IOPS:
io1 - provisioned IOPS SSD 50 IOPS/GiB
io2 - latest gen SSD 500 IOPS/GiB

For up to 256,000 IOPS:
io3 - largest, most critical, high performance apps: SAP HANA, Oracle, Microsoft SQL Server

For big data and warehousing:
st1 - throughout optimized HDD 500 MB/s, cannot be boot vol
sc1 - cold storage HDD 250 MB/s, cannot be boot vol

39
Q

What are EBS snapshots?

A

A point-in-time copy of an EBS volume. Great for backing up EBS volumes. You can use a snapshot to create a new EBS volume.

40
Q

If you create a new EBS volume from an encrypted snapshot, then you will get an encrypted volume. True or false?

A

TRUE

41
Q

Describe Application Load Balancers

A

Intelligent load balancing for http/https. Routes requests to a specific web server based on the request type. Such as a car dealership website that routes requests based on the department, e.g., sales, service, finance, etc.

42
Q

Describe Network Load Balancers

A

Provides high performance load balancing for TCP traffic. Most expensive.

43
Q

Describe Classic Load Balancers

A

The legacy option that supports both HTTP/HTTPS and TCP.

44
Q

Describe Gateway Load Balancers

A

Provides load balancing for third-party virtual appliances.

45
Q

X-Forwarded-For

A

If you need the IPv4 address of your end user, look for the X-Forwarded-For HTTP header.

46
Q

504 Error

A

Gateway timeout. The application is not responding within the time out. Troubleshoot your application or database server.

47
Q

What is Route 53?

A

Amazon’s DNS service. Allows you to map a domain name to either an EC2 instance, Elastic Load Balancer, or S3 bucket.

48
Q

What is a Hosted Zone in Route 53?

A

A container for DNS records for your domain.

49
Q

What is an Alias in Route 53?

A

Allows you to route traffic addressed to the zone apex, or the top of the DNS namespace e.g. ilovecloud.com, and send it to a resource within AWS, such as an elastic load balancer.

50
Q

What is an A Record in Route 53?

A

Allows you to route traffic to a resource, such as a web server, using an IPv4 address.

51
Q

What is the principle of least privilege?

A

Always give your users the minimum amount of access required to do their job.

52
Q

It is best practice to use groups. True or false?

A

TRUE

It is best practice to create IAM groups and assign your users to groups.

Group permissions are assigned using IAM policy documents.

Your users will automatically inherit the permissions of the group.

53
Q

You can retrieve your secret access key from the AWS console. True or false?

A

FALSE

You will only see your secret access key once. If you lose it, you can delete the access key ID and secret access key and regenerate them. You will need to run ‘aws configure’ again.

54
Q

You can temporarily share key pairs to provide another developer access. True or false?

A

FALSE

Each developer should have their own access key ID and secret access key. Just like passwords, they should not be shared.

55
Q

Where can you install the AWS CLI?

A

You can install the CLI on your Mac, Linux, or Windows PC. You can also use it on EC2 instances.

56
Q

What is the preferred option from a security perspective to give EC2 instances access to AWS resources like S3?

A

Roles can be used to give EC2 instances access to AWS resources.

57
Q

Briefly describe how to provide an EC2 instance access to S3.

A

Create an IAM Role with S3 access, attach the role to the EC2 instance, and now you should be able to access S3 from the EC2 instance.

58
Q

What are the benefits of using roles with EC2 instances?

A
  1. Avoid hard coding your credentials. Roles allow you to provide access without having to manage access key IDs and secret access keys.
  2. Policies control our role’s permissions.
  3. You can update a policy attached to a role, and it will take immediate effect.
  4. You can attach and detach roles to running EC2 instances without having to stop or terminate these instances.
59
Q

You have a WordPress site hosted on EC2 with a MySQL database hosted on RDS. The majority of your traffic is read traffic. There is only write traffic when you create a new blog. One of your blogs has gone viral and your WordPress site is struggling to cope. You check your CloudWatch metrics and notice your RDS instance is at 100% CPU utilization. What two steps should you take to reduce the CPU utilization?

A
  1. Create an ElastiCache cluster and use this to cache your most frequently read blog posts.
  2. Create multiple RDS read replicas and point multiple EC2 instances to these read replicas, thereby spreading the load.
60
Q

What can be used to securely store confidential information like credentials and license codes so that they can be accessed by EC2 instances?

A

Systems Manager Parameter Store

61
Q

A new CIO joins your company and implements a new company policy that all EC2 EBS backed instances must have encryption at rest. What is the quickest and easiest way to apply this policy to your existing EC2 EBS backed instances?

A

Create a snapshot of the EC2 volume. Then create a copy of the snapshot, checking the box to enable encryption. Create an AMI of the copied snapshot and then redeploy the EC2 instance using the encrypted AMI. Delete the old EC2 instance.

62
Q

You work for a web analytics firm who have recently migrated their application to AWS. The application sits behind an Elastic Load Balancer and it monitors user traffic to their website. You have noticed that in the application logs you are no longer seeing your users public IP addresses, instead you are seeing the private IP address of the elastic load balancer. This data is critical for your business and you need to rectify the issue immediately. What should you do?

A

Update the application to log the x-forwarded-for header to get your users public IPv4 addresses.

63
Q

You see a “timed out” error when using the AWS CLI to list all the files in an S3 bucket containing thousands of files. What could be the reason for this?

A

Too many results are being returned which is causing the command to time out.

64
Q

You work for a government contractor who supply services that are critical to national security. Because of this your corporate IT policy states that no multi-tenant virtualization is authorized within the company. Despite this, they are interested in moving to AWS, but they cannot violate corporate IT policy. Which EC2 billing model would you recommend that they use to achieve this?

A

Dedicated Instances.

65
Q

You are the IT manager at a furniture retailer and they are considering moving their web application to AWS. They currently colocate their servers in a co-location facility and the contract for this facility is now coming to an end. Management are comfortable signing a 3 year contract and want to get the cheapest web servers as possible while still maintaining availability. Their traffic is very steady and predictable. What EC2 pricing model would you recommend to maintain availability and to get the lowest cost price available?

A

Reserved Instances.

66
Q

You work for a media production company that streams popular TV shows to millions of users. They are migrating their web application from an in house solution to AWS. They will have a fleet of over 10,000 web servers to meet the demand and will need a reliable layer 4 load balancing solution capable of handling millions of requests per second. What AWS load balancing solution would best suit their needs?

A

Network Load Balancer.

67
Q

In order to enable encryption at rest using EC2 and Elastic Block Store, you must ____.

A

Configure encryption when creating the EBS volume

68
Q

Which of the following EBS volume types gives you SAN performance in the cloud and is suitable for the largest, most critical, high-performance applications?

A

Provisioned IOPS SSD io2 Block Express

69
Q

You work for an online gaming store which has a global worldwide leader board for players of the game. You need to implement a caching system for your leader board that has multiple availability zones in order to prevent an outage. Which ElastiCache solution should you use?

A

Redis

Amazon ElastiCache for Redis supports both Redis cluster and non-cluster modes and provides high availability via support for automatic failover by detecting primary node failures and promoting a replica to be primary with minimal impact. It allows for read availability for your application by supporting read replicas (across availability zones), to enable the reads to be served when the primary is busy with the increased workload.

70
Q

Which of the following is a suitable use case for Provisioned IOPS SSD io2 Block Express EBS volumes?

A

Large mission-critical applications that need SAN-level performance

71
Q

Your company has a web application on AWS. The application computes thousands of algorithms per second and is very CPU and disk intensive. The application runs on a c4.8xlarge, the largest C class instance available. The application stores its data locally on a General Purpose SSD (gp2) disk. Your application starts to perform slow. You check the logs and notice that your disk I/O is routinely reaching 16,000 IOPS. What should you do to remediate the issue?

A

Migrate the EBS volume from a standard EBS volume to a provisioned IOPS EBS volume.

72
Q

You have a three-tier web application with a web server tier, application tier, and database tier. The application is spread across multiple availability zones for redundancy and is in an Auto Scaling group with a minimum size of two and a maximum size of ten. The application relies on connecting to an RDS Multi-AZ database. When new instances are launched, they download a connection string file that is saved in an encrypted S3 bucket using a bootstrap script. During a routine scaling event, you notice that your new web servers are failing their health checks and are not coming into service. You investigate and discover that the web server’s S3 read-only role has no policies attached to it. What combination of steps should you take to remediate this problem while maintaining the principle of least privilege?

A
  1. Attach the S3 – read-only policy to the role.

2. Leave the healthy instances as they are and allow new instances to come into service after fixing the policy issue.

73
Q

Name three types of Elastic Load Balancers.

A

Application Load Balancer
Classic Load Balancer.
Network Load Balancer

74
Q

You have an EC2 instance in a single availability zone connected to an RDS instance. The EC2 instance needs to communicate to S3 to download some important configuration files from it. You try the command aws s3 cp s3://yourbucket /var/www/html however you receive an error message. You log in to Identity Access Management (IAM) and discover there is no role created to allow EC2 to communicate to S3. You create the role and attach it to the existing EC2 instance. How fast will the changes take to propagate?

A

Almost immediately.

You can change the permissions on the IAM role associated with a running instance, and the updated permissions take effect almost immediately.

75
Q

You are a developer for a genomics firm that is moving its infrastructure to AWS. Their environment consists of a three-tier web application, a web tier, an application tier and a relational database tier. They have a separate fleet of virtual machines that are used to access large HPC clusters on the fly. Their lab researchers run multiple projects simultaneously and they will need to launch and decommission 1,000’s of nodes on-demand while reducing the time required to complete genomic sequencing from weeks to days. In order to stay competitive they need to do this at as low cost as possible, with no long-term contracts. These HPC clusters can run any time day or night and their workloads store information in S3, so the instances can be terminated at any time without any effect on the data. What is the most COST EFFECTIVE EC2 pricing model for their requirements?

A

Spot Instances

Amazon EC2 Spot Instances let you take advantage of unused EC2 capacity in the AWS cloud and are the lowest cost option for on-demand and short term capacity requirements. As the HPC cluster nodes store the data in S3 the termination of Spot instances will not impact the data processing. Both on-demand and dedicated instances are more expensive than Spot instances, and reserved instances are for long running applications (1 to 3 years) so are not suitable for this HPC cluster scenario.