Skip to content

Commit 3bbdbaf

Browse files
author
abregman
committed
Add AWS exercises and questions
1 parent 195174a commit 3bbdbaf

File tree

7 files changed

+368
-270
lines changed

7 files changed

+368
-270
lines changed

README.md

+1-268
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
<td align="center"><a href="#certificates"><img src="images/certificates.png" width="75px;" height="75px;" alt="Certificates"/><br /><b>Certificates</b></a></td>
6565
<td align="center"><a href="#containers"><img src="images/containers.png" width="70px;" height="75px;" alt="Containers"/><br /><b>Containers</b></a></td>
6666
<td align="center"><a href="#sql"><img src="images/sql.png" width="75px;" height="75px;" alt="sql"/><br /><b>SQL</b></a></td>
67-
<td align="center"><a href="#openshift"><img src="images/openshift.png" width="75px;" height="75px;" alt="OpenShift"/><br /><b>OpenShift</b></a></td>
67+
<td align="center"><a href="exercises/openshift/README.md"><img src="images/openshift.png" width="75px;" height="75px;" alt="OpenShift"/><br /><b>OpenShift</b></a></td>
6868
<td align="center"><a href="#storage"><img src="images/storage.png" width="75px;" height="75px;" alt="Storage"/><br /><b>Storage</b></a></td>
6969
<td align="center"><a href="#HR"><img src="images/HR.png" width="110px;" height="75px;" alt="HR"/><br /><b>HR</b></a></td>
7070
</tr>
@@ -5100,273 +5100,6 @@ as key-value pair, document-oriented, etc.
51005100
* programming languages
51015101
</b></details>
51025102

5103-
## OpenShift
5104-
5105-
### OpenShift Exercises
5106-
5107-
|Name|Topic|Objective & Instructions|Solution|Comments|
5108-
|--------|--------|------|----|----|
5109-
| My First Project | Projects | [Exercise](exercises/openshift/projects_101.md) | [Solution](exercises/openshift/solutions/projects_101.md)
5110-
5111-
### OpenShift Self Assessment
5112-
5113-
<details>
5114-
<summary>What is OpenShift?</summary><br><b>
5115-
5116-
OpenShift is a container orchestration platform based on Kubernetes.<br>
5117-
It can be used for deploying applications while having minimal management overhead.
5118-
</b></details>
5119-
5120-
<details>
5121-
<summary>How OpenShift is related to Kubernetes?</summary><br><b>
5122-
5123-
It's built on top of Kubernetes while defining its own custom resources in addition to the built ones.
5124-
</b></details>
5125-
5126-
<details>
5127-
<summary>True or False? OpenShift is a IaaS (infrastructure as a service) solution</summary><br><b>
5128-
5129-
False. OpenShift is a PaaS (platform as a service) solution.
5130-
</b></details>
5131-
5132-
## OpenShift - Architecture
5133-
5134-
<details>
5135-
<summary>What types of nodes OpenShift has?</summary><br><b>
5136-
5137-
- Workers: Where the end-user applications are running
5138-
- Masters: Responsible for managing the cluster
5139-
</b></details>
5140-
5141-
<details>
5142-
<summary>Which component responsible for determining pod placement?</summary><br><b>
5143-
5144-
The Scheduler.
5145-
</b></details>
5146-
5147-
<details>
5148-
<summary>What else the scheduler responsible for except pod placement?</summary><br><b>
5149-
5150-
Application high availability by spreading pod replicas between worker nodes
5151-
</b></details>
5152-
5153-
## OpenShift - Projects
5154-
5155-
<details>
5156-
<summary>What is a project in OpenShift?</summary><br><b>
5157-
5158-
A project in OpenShift is a Kubernetes namespace with annotations.<br>
5159-
In simpler words, think about it as an isolated environment for users to manage and organize their resources (like Pods, Deployments, Service, etc.).
5160-
</b></details>
5161-
5162-
<details>
5163-
<summary>How to list all projects? What the "STATUS" column means in projects list output?</summary><br><b>
5164-
5165-
`oc get projects` will list all projects. The "STATUS" column can be used to see which projects are currently active.
5166-
</b></details>
5167-
5168-
<details>
5169-
<summary>You have a new team member and you would like to assign to him the "admin" role on your project in OpenShift. How to achieve that?</summary><br><b>
5170-
5171-
`oc adm policy add-role-to-user <role> <user> -n <project>`
5172-
</b></details>
5173-
5174-
## OpenShift - Images
5175-
5176-
<details>
5177-
<summary>What is an image stream?</summary><br><b>
5178-
</b></details>
5179-
5180-
<details>
5181-
<summary>What would be the best way to run and manage multiple OpenShift environments?</summary><br><b>
5182-
5183-
Federation
5184-
</b></details>
5185-
5186-
#### OpenShift - Federation
5187-
5188-
<details>
5189-
<summary>What is OpenShift Federation?</summary><br><b>
5190-
5191-
Management and deployment of services and workloads accross multiple independent clusters from a single API
5192-
</b></details>
5193-
5194-
<details>
5195-
<summary>Explain the following in regards to Federation:
5196-
5197-
* Multi Cluster
5198-
* Federated Cluster
5199-
* Host Cluster
5200-
* Member Cluster
5201-
</summary><br><b>
5202-
5203-
* Multi Cluster - Multiple clusters deployed independently, not being aware of each other
5204-
* Federated Cluster - Multiple clusters managed by the OpenShift Federation Control Plane
5205-
* Host Cluster - The cluster that runs the Federation Control Plane
5206-
* Member Cluster - Cluster that is part of the Federated Cluster and connected to Federation Control Plane
5207-
</b></details>
5208-
5209-
## OpenShift - Storage
5210-
5211-
<details>
5212-
<summary>What is a storage device? What storage devices are there?</summary><br><b>
5213-
5214-
* Hard Disks
5215-
* SSD
5216-
* USB
5217-
* Magnetic Tape
5218-
</b></details>
5219-
5220-
<details>
5221-
<summary>What is Random Seek Time?</summary><br><b>
5222-
5223-
The time it takes for a disk to reach the place where the data is located and read a single block/sector.
5224-
5225-
Bones question: What is the random seek time in SSD and Magnetic Disk?
5226-
Answer: Magnetic is about 10ms and SSD is somewhere between 0.08 and 0.16ms
5227-
</b></details>
5228-
5229-
#### OpenShift - Pods
5230-
5231-
<details>
5232-
<summary>What happens when a pod fails or exit due to container crash</summary><br><b>
5233-
5234-
Master node automatically restarts the pod unless it fails too often.
5235-
</b></details>
5236-
5237-
<details>
5238-
<summary>What happens when a pod fails too often?</summary><br><b>
5239-
5240-
It's marked as bad by the master node and temporarly not restarted anymore.
5241-
</b></details>
5242-
5243-
<details>
5244-
<summary>How to find out on which node a certain pod is running?</summary><br><b>
5245-
5246-
`oc get po -o wide`
5247-
</b></details>
5248-
5249-
#### OpenShift - Services
5250-
5251-
<details>
5252-
<summary>Explain Services and their benefits</summary><br><b>
5253-
5254-
- Services in OpenShift define access policy to one or more set of pods.<br>
5255-
- They are connecting applications together by enabling communication between them
5256-
- They provide permanent internal IP addresses and hostnames for applications
5257-
- They are able to provide basic internal load balancing
5258-
</b></details>
5259-
5260-
#### OpenShift - Labels
5261-
5262-
<details>
5263-
<summary>Explain labels. What are they? When do you use them?</summary><br><b>
5264-
5265-
- Labels are used to group or select API objects
5266-
- They are simple key-value pairs and can be included in metadata of some objects
5267-
- A common use case: group pods, services, deployments, ... all related to a certain application
5268-
</b></details>
5269-
5270-
#### OpenShift - Service Accounts
5271-
5272-
<details>
5273-
<summary>How to list Service Accounts?</summary><br><b>
5274-
5275-
`oc get serviceaccounts`
5276-
</b></details>
5277-
5278-
#### OpenShift - Networking
5279-
5280-
<details>
5281-
<summary>What is a Route?</summary><br><b>
5282-
5283-
A route is exposing a service by giving it hostname which is externally reachable
5284-
</b></details>
5285-
5286-
<details>
5287-
<summary>What Route is consists of?</summary><br><b>
5288-
5289-
- name
5290-
- service selector
5291-
- (optional) security configuration
5292-
</b></details>
5293-
5294-
<details>
5295-
<summary>True or False? Router container can run only on the Master node</summary><br><b>
5296-
5297-
False. It can run on any node.
5298-
</b></details>
5299-
5300-
<details>
5301-
<summary>Given an example of how a router is used</summary><br><b>
5302-
5303-
1. Client is using an address of application running on OpenShift
5304-
2. DNS resolves to host running the router
5305-
3. Router checks whether route exists
5306-
4. Router proxies the request to the internal pod
5307-
</b></details>
5308-
5309-
#### OpenShift - Security
5310-
5311-
<details>
5312-
<summary>What are "Security Context Constraints"?</summary><br><b>
5313-
5314-
From [OpenShift Docs](https://docs.openshift.com/container-platform/4.7/authentication/managing-security-context-constraints.html): "Similar to the way that RBAC resources control user access, administrators can use security context constraints (SCCs) to control permissions for pods".
5315-
</b></details>
5316-
5317-
<details>
5318-
<summary>How to add the ability for the user `user1` to view the project `wonderland` assuming you are authorized to do so</summary><br><b>
5319-
5320-
oc adm policy add-role-to-user view user1 -n wonderland
5321-
</b></details>
5322-
5323-
<details>
5324-
<summary>How to check what is the current context?</summary><br><b>
5325-
5326-
`oc whoami --show-context`
5327-
</b></details>
5328-
5329-
#### OpenShift - Serverless
5330-
5331-
<details>
5332-
<summary>What is OpenShift Serverless?</summary><br><b>
5333-
5334-
- In general 'serverless' is a cloud computing model where scaling and provisioning is taken care for application developers, so they can focus on the development aspect rather infrastructure related tasks
5335-
- OpenShift Serverless allows you to dynamically scale your applications and provides the ability to build event-driven applications, whether the sources are on Kubernetes, the cloud or on-premise solutions
5336-
- OpenShift Serverless is based on the Knative project.
5337-
</b></details>
5338-
5339-
<details>
5340-
<summary>What are some of the event sources you can use with OpenShift Serverless?</summary><br><b>
5341-
5342-
* Kafka
5343-
* Kubernetes APIs
5344-
* AWS Kinesis
5345-
* AWS SQS
5346-
* JIRA
5347-
* Slack
5348-
5349-
More are supported and provided with OpenShift.
5350-
</b></details>
5351-
5352-
<details>
5353-
<summary>Explain serverless functions</summary><br><b>
5354-
</b></details>
5355-
5356-
<details>
5357-
<summary>What is the difference between Serverless Containers and Serverless functions?</summary><br><b>
5358-
</b></details>
5359-
5360-
#### OpenShift - Misc
5361-
5362-
<details>
5363-
<summary>What is Replication Controller?</summary><br><b>
5364-
5365-
Replication Controller responsible for ensuring the specified number of pods is running at all times.<br>
5366-
If more pods are running than needed -> it deletes some of them<br>
5367-
If not enough pods are running -> it creates more
5368-
</b></details>
5369-
53705103
## SQL
53715104

53725105
### SQL Exercises

exercises/aws/README.md

+43-1
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ Note: Provided solutions are using the AWS console. It's recommended you'll use
4444
|Name|Topic|Objective & Instructions|Solution|Comments|
4545
|--------|--------|------|----|----|
4646
| Auto Scaling Groups Basics | ASG | [Exercise](auto_scaling_groups_basics.md) | [Solution](solutions/auto_scaling_groups_basics.md) | Easy |
47+
| Dynamic Scaling Policy | ASG, Policies | [Exercise](asg_dynamic_scaling_policy.md) | [Solution](solutions/asg_dynamic_scaling_policy.md) | Easy |
4748

4849
#### AWS - Lambda
4950

@@ -1287,13 +1288,54 @@ One way is to use CloudWatch alarms where an alarm will monitor a metric and bas
12871288
</b></details>
12881289

12891290
<details>
1290-
<summary>Provide examples to metrics/rules used for auto scaling</summary><br><b>
1291+
<summary>What are some metrics/rules used for auto scaling</summary><br><b>
12911292

12921293
* Network In/Out
12931294
* Number of requests on ELB per instance
12941295
* Average CPU, RAM usage
12951296
</b></details>
12961297

1298+
<details>
1299+
<summary>What is dynamic Scaling policy in regards to Auto Scaling Groups?</summary><br><b>
1300+
1301+
A policy in which scaling will occur automatically based on different metrics.
1302+
1303+
There are 3 types:
1304+
1305+
1. Target Tracking Scaling: scale when the baseline changes (e.g. CPU is over 60%)
1306+
2. Step Scaling: more granular scaling where you can choose different actions for different metrics values (e.g. when CPU less than 20%, remove one instance. When CPU is over 40%, add 3 instances)
1307+
3. Scheduled Actions: set in advance scaling for specific period of time (e.g. add instances on Monday between 10:00 am to 11:00 am)
1308+
</b></details>
1309+
1310+
<details>
1311+
<summary>What is a predictive scaling policy in regards to Auto Scaling Groups?</summary><br><b>
1312+
1313+
Scale by analyzing historical load and schedule scaling based on forecast load.
1314+
</b></details>
1315+
1316+
<details>
1317+
<summary>Explain scaling cooldowns in regards to Auto Scaling Groups</summary><br><b>
1318+
1319+
During a scaling cooldown, ASG will not terminate or launch additional instances. The cooldown happens after scaling activity and the reason for this behaviour is that some metrics have to be collected and stabilize before another scaling operating can take place.
1320+
</b></details>
1321+
1322+
<details>
1323+
<summary>Explain the default ASG termination policy</summary><br><b>
1324+
1325+
1. It finds the AZ which the most number of EC2 instnaces
1326+
2. If number of instances > 1, choose the with oldest launch configuration, template and terminate it
1327+
</b></details>
1328+
1329+
<details>
1330+
<summary>True or False? by deafult, ASG tries to balance the number of instances across AZ</summary><br><b>
1331+
1332+
True, this is why when it terminates instances, it chooses the AZ with the most instances.
1333+
</b></details>
1334+
1335+
<details>
1336+
<summary>Explain Lifecycle Hooks in regards to Auto Scaling Groups</summary><br><b>
1337+
</b></details>
1338+
12971339
#### AWS - Security
12981340

12991341
<details>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
## AWS Auto Scaling Groups - Dynamic Scaling Policy
2+
3+
### Requirements
4+
5+
1. Existing Auto Scaling Group with maximum capacity set to at least 3
6+
2. One running EC2 instance with max of 4 CPUs
7+
8+
### Objectives
9+
10+
1. Create a dynamic scaling policy with the following properties
11+
1. Track average CPU utilization
12+
2. Target value should be 70%
13+
2. Increase the CPU utilization to at least 70%
14+
1. Do you see change in number of instances?
15+
1. Decrease CPU utilization to less than 70%
16+
1. Do you see change in number of instances?

0 commit comments

Comments
 (0)