AWS Cloud Best Practices Flashcards

1
Q

When operating services on AWS, there are several common categories of operating models.
What are they?

A
  1. Applications that are migrated, maintain existing traditional operating models, leverage the ability to manage infrastructure as Code through APIs enabling robust and repeatable build processes, improving reliability
  2. Solutions are that refactored leverage higher levels of automation of the operation processes as the supporting services, ei AWS Auto Scaling and self-healing architectures
  3. Solutions that are rearchitected and designed for cloud operations are typically fully automated through DevOps processes for delivery pipeline and management
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

How does Scalability work in regards to AWS?

A

Systems that are expected to grow over time need to be built on top of a scalable architecture.

Such an architecture can support growth in users, traffic or data size with no drop-in performance

It should provide that scale in a linear manner where adding extra resources results in at least a proportional increase in ability to serve additional load.

Growth should introduce economies of scale, and cost should follow the same dimension that generates business value out of that system.

While cloud computing provides virtually unlimited on-demand capacity, your design needs to be able to take advantage of the resources seamlessly

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

What is scaling vertically and how does it work?

A

Scaling vertically takes place through an increase in the specifications of an individual resource, such as upgrading a server with a larger hard drive or faster CPI.

With Amazon EC2, you can stop an instance and resize it to an instance type that has more RAM, CPU, I/O or networking capabilities.

This way of scaling can eventually reach a limit and it is not always a cost efficient or high available approach

However, it is very easy to implement and can be sufficient for many use cases especially in the short term

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

What is scaling horizontally and how does it work?

A

Scaling horizontally takes place through an increase in the number of resources, such as adding more hard drives to a storage array or adding more servers to support an application.

This is a great way to build internet-scale applications that leverage the elasticity of cloud computing .

Not all architectures are designed to distribute their workload to multiple resources,

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

What are stateless applications and how do they work in AWS environments?

A

When users or services interact with an application they will often perform a series of interactions that form a session,

A session is unique data for users that persists between request while they use the application

A stateless application is an application that does not need knowledge of previous interactions and does not store session information.

For example, an application that, given the same input, provides the same response to any user, is a stateless application

Stateless applications can scale horizontally because any of the available compute resources ( such as EC2 instances and AWS Lambda functions) can service any request.

Without stored sessions data, you can simply add more compute resources as needed.

When that capacity is no longer required, you can safely terminate those individual resources, after running tasks have been drained..

Those resources do not need to be aware of the presence of their peers- all that is required is a way to distribute the workload to them

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

There are two models to follow what distributing load to multiple nodes.

What are they and how to they work?

A

Push Model- With push model, you can use Elastic Load Balancing (ELB) to distribute a workload.

ELB routes incoming application request across multiple EC2 instances.

When routing traffic, a Network Load Balancer operates at layer 4 of the Open Systems Interconnection (OSI) model to handle millions of requests per second.

With the adoption of container based services, you can also use an Application Load Balancer

An Application Load Balancer provides Layer 7 of the OSI model and supports content-based routing of requests based on application traffic.

Alternatively, you can use Amazon Route 53 to implement a DNS round robin fashion

While easy to implement, this approach does not always work well with the elasticity of the cloud computing.

This is because even if you can set low time to live (TTL) values for your DNS records, caching DNS resolves are outside the control of Amazon Route 53 and might not always respect your settings

What is a pull model and how does it work?
Pull model works well with asynchronous, event-driven workloads.

In a pull model, task that need to be performed or data that needs to be processed can be stored as messages in a queue using Amazon Simple Queue Service (Amazon SQS) or as a streaming data solution such as Amazon Kinesis, Multiple compute resources can then pull and consume those messages, processing them in a distributed fashion

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

What are stateless components?

A

In practice, most applications maintain some kind of state information.

For exmaple, web applications need to track whether a user is signed in so that personalized content can be presented based on previous actions.

An automated multi-step process also needs to track previous activity to decide what is its next action should be.

You can still make a portion of these architectures stateless by not storing anything that needs to persist for more than a single request in the local file system

For example, web applications can use HTTP cookies to store session information (such as shopping cart items) in the web client cache.

The browser passes that information back to the server at each subsequent so that the application does not need to store it.

However, this approach has two drawbacks.

First, the content of the HTTP cookies can be tampered with on the client side, so you should always treat it as untrusted data that must be validated.

Second, HTTP cookies are transmitted with every request, which means that you should keep their size to a minimum to avoid unnecessary latency

COnsider only storing a unique session identifier in an HTTP cookie and storing more detailed user session information on the server side.

Most programming platforms provide a native session management mechanism that works this way

However, user session information is often stored on the local file system by default and results in a stateful architecture

A common solution to this problem is to store this information in a database.

Amazon DynamoDB is a great choice because of its scalability, high availability and durability characteristics.

For many platforms, there are open source drop-in replacement libraries that allow you to store native sessions in Amazon DynamoDB

Other scenarios required storage of larger files (such as user uploads and interim results of batch processes)

By placing those files in a shared storage layer such as Amazon Simple Storage Service (Amazon S3) or Amazon Elastic File System (Amazon EFS), you can avoid the introduction of stateful components

Finally, a complex multi-step workflow is another example where you must track the current state of each execution.

You can use AWS Step Functions to centrally store execution history and make these workloads stateless

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

What are Stateful Components?

A

Inevitably, there will be layers of your architecture that you wont turn into stateless components.

By definition, databases are stateful.

In addition, many legacy applications were designed to run on a single server by relying on local compute resources.

Other use cases might require client devices to maintain a connection to a specific server for prolonged periods.

For example, real-time multiplayer gaming must offer multiple players a consistent view of the game world with very low latency.

This is much simpler to achieve in a non-distributed implementation where participants are connected to the same server

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

What is implement session affinity?

A

For HTTP and HTTPS traffic, you can use the sticky sessions feature of an Application Load Balancer to bind a users session to a specific instance.

With this feature, an Application Load Balancer will try to use the same server for that user for the duration of the session

Another option- if you control the code that runs on the client - is use to client-side load balancing.

This adds extra complexity, but can be useful in scenarios where a load balancer does not meet your requirements.

For example, you might be using a protocol thats not supported by ELB or you might need full control over how users are assigned to servers

In this model, the clients need a way of discovering valid server endpoints to directly connect.

You can use DNS for that, or you can build a simple discovery API to provide that information to the software running on the client.

In the absence of a load balancer, the health checking mechanism also needs to be implemented on the client side.

You should design for your client logic so that when server unavailability is detected, devices reconnect to another server with little disruption for the application

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

What is distributed processing?

A

Use cases that involve the processing of very large amounts of data - anything that can’t be handled by a single compute resource in a timely manner- require a distributed processing approach.

By dividing a task and its data into many small fragments of work, you can execute them in parallel across a set of compute resources

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

What is distributed processing implemented?

A

Offline batch jobs can be horizontally scaled by using distributed data processing engines such as AWS Batch, AWS Glue, and Apache Hadoop.

On AWS, you can use Amazon EMR to run Hadoop workloads on top of a fleet of EC2 instances without the operational complexity.

For real-time processing of streaming data, Amazon Kinesis partitions data in multiple shards that can be consumed by multiple Amazon EC2 or AWS Lambda resources to achieve scalability

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

Why is having disporable resources instead of fixed servers beneficial?

A

In a traditionally infrastructure environment, you have to work with fixed resources because of the upfront cost and lead time of introducing new hardware.

This drives practices such as manually logging in to servers to configure software or fix issues, hardcoding IP addresses, and running test or processing jobs sequentially

When designing for AWS, you can take advantage of the dynamically provisioned nature of cloud computing.

You can think of servers and other components as temporary resources.

You can launch as many as you need, and use them only for as long as you need them

Another issues with fixed, long-running is configuration drift.

Changes and software patches applied through time can result in untested and heterogeneous configurations across different environments

You can solve this problem with an immutable infrastructure pattern

With this approach, a server - once launched - is never updated

Instead, when there is a problem or need for an update, the problem server is replaced with a new server that has the latest configuration.

This enables resources to always be in a consistent (and tested) state, and makes rollbacks easier to perform

This is more easily supported with stateless architectures

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

Instantiating Compute Resources

A

Whether you are deploying a new environment for testing or increasing capacity of an existing system to cope with extra load, you do not want to manually set up new resources with their configuration and code.

It is important that you make this an automated and repeatable process that avoids long lead times and is not prone to human error

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

What are some ways we can achieve instantiating computing resources?
Bootstrapping, what is it?

A

When you launch an AWS resource such as an EC2 instance or Amazon Relational Database Service (Amazon RDS) DB instance, you start with default configuration.

You can then execute automated bootstrapping actions, which are scripts that install software or copy data to bring resource to a particular state.

You can parameterize configuration details that vary between different environments (such as production or test) so that you can reuse the same scripts without modifications

You can set up new EC2 instances with user data scripts and cloud-init directives

You can use simple scripts and configuration management tools such as CHef or Puppet.

In addition, with customer scripts and the AWS APIs, or with AWS CloudFormation support for AWS Lambda-back customer resource, you can write provisioning logic that acts on almost any AWS resource

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

What are Golden Images?

A

A golden image is a pre-configure template for your users.

A Golden Image may also be referred to as a clone mage, master image or base image

If you have ever built a standard image for your user-base, you understand the need for consistency and ease of development

Certain AWS resource types, such as EC2 instances, Amazon RDS DB instances and Amazon Elastic Block Store (Amazon EBS) volumes, can be launched from a golden image, which is a snapshot of a particular state of that response.

When compared to the bootstrapping approach, a golden image results in faster start times and remove dependencies to configuration services or third-party repositories.

This is important in auto-scaled environments where you want to be able to quickly and reliability launch additional resources such as a response to demand changes

You can customize an EC2 instance and then save its configuration by creating an Amazon Machine Image (AMI)

You can launch as many instances from theAMI as you need, and they will all include those cusomizations

Each time you want to change your configuration you must create a new golden image, so you must have a versioning convention to manage your golden images over time.

We recommend that you use a script to create the bootstrap for the EC2 instances that you use to create your AMIs,.

Alternatively, ylu if have an existing on-premises virtualized environment, you can use VM import/export from AWS to convert a variety of virtualization formats to an AMI.

You can also find and use prebaked, shared AMIs provided either by AWS or third parties in AWS Marketplace

While golden images are most commonly used when you launch an EC2 instance, they can also be applied to resources such as Amazon RDS DB instances or Amazon EBS volumes.

For example, when you launch a new test environment, you might want to prepopulate its database by instantiating it from a specific Amazon RDS snapshot, instead of importing the data from a lengthy SQL script

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

What are containers and how do they relate to usage in AWS?

A

Docker is an open source technology that allows you to build and deploy distributed applications inside software containers.

Docker allows you to package a piece of software in a Docker image, which is a standardized unit for software development, container everything the software needs to run: code, runtime, system tools, system libraries, etc.

AWS Elastic Beanstalk, Amazon Elastic Container Service (Amazon ECS) and AWS Fargate let you deploy and manage multiple containers across a cluster of EC2 instances.

You can build golden Docker images and use the ECS Container Registry to manage them

An alternative container environment is Kubernetes and Amazon Elastic Container Service for Kubernetes (Amazon EKS).

With Kubernetes and Amazon EKS, you can easily deploy, manage and scale containerized applications

17
Q

What is the hybrid method of instantiating compute resources?

A

You can also use a combination of the two approaches: some parts of the configuration are captured in a golden image, while others are configured dynamically through a bootstrapping action

Items that do not change often or that introduce external dependencies will typically be part of your golden image.

An example of a good candidate is your web server software that would otherwise have to be downloaded by a third-party repository each time you launch an instance

Items that change often or differ between your various environments can be set up dynamically through bootstrapping actions.

For example, if you are deploying new versions of your application frequently, creating a new AMI for each application version might be impractical.

You also do not want to hard code the database hostname configuration to your AMI because that would be different between the test and production environments.

User data or tags allow you to use more generic AMIs that can be modified at launch time.

For example, if you run web servers for various small businesses, they can all use the same AMI and retrieve their content from an S3 bucket location that you specify in the user data at launch

18
Q

What is infrastructure as a code?

A

Application of the principles we discussed does not have to be limited to the individual resource level.

Because AWS assets are programmable, you can apply techniques, practices, and tools from software development to make your whole infrastructure reusable, maintainable, extensible and testable.

19
Q

What are AWS CloudFormation templates?

A

These are templates that give users an easy way to crceate and manage a collection of related AWS resources, and provision and update them in an orderly and predictable fashion.

You can describe the AWS resources and any associated dependencies or runtime parameters required to run your application.

You CloudFormation templates can live with your application in your version control repository, which allows you to reuse architectures and reliably clone production environments for testing

20
Q

Server Management and Deployment

A

When you adopt serverless patterns, the operational focus is on the automation of deployment pipieline.

AWS Manages the underlying services, scale and availability

AWS CodePipeline, AWS CodeBuild, and AWS CodeDeploy support the automation of the deployment of these processes

21
Q

What is ?AWS Elastic Beanstalk

A

This service can be used to deploy and scale web applications and services developed with Java, .NET, PHP , Node.js, Python, Ruby, Go, and DOcker on familiar servers such as Apache, Nginx, Passenger, and IIS>

Developers can simply upload their application code, and the service automatically handles all thedetails, such as resource provisioning, load balancing, auto scaling and monitoring

22
Q

What is Amazon EC2 Auto Recovery and how does it work?

A

You can create an Amazon CloudWatch alarm that monitors and EC2 instance and automatically recovers if it becomes impaired.

A recovered instance is identical to the original instance, including the instance ID< private IP addresses, Elastic IP addresses, and all instance metadata.

However, this feature is only available for applicable instance configuration.

23
Q

What is AWS Systems Manager?

A

You can automatically collect software inventory, apply OS patches, create a system image to configure Windows and Linux operating systems, and execute arbitrary commands.

Provisioning these services simplifies the operating model and ensures the optimum environment configuration

24
Q

What is auto scaling?

A

You can maintain applications and scale your Amazon EC2, Amazon DynamoDB, Amazon ECS, Amazon Elastic Container Service For Kubernetes (Amazon EKS) capacity up or down automatically according to the conditions you define.

You can use Auto Scaling to help make sure that you are running the desired number of healthy EC2 instances across multiple availability zones.

Auto scaling can also automatically increase the number of EC2 instances during demand spikes to maintain performance and decrease capacity during less busy periods to optimize costs

25
Q

What is Amazon CloudWatch alarms and how to they work?

A

You can create a CloudWatch alarm that sends an Amazon Simple Notification service (Amzon SNS) message when a particular metric goes beyond a specified threshold for a specified number of periods

Those Amazon SNS messages can automatically kick off the execution of a subscribed Lambda function, enqueue a notification message to an Amzon SQS queue, or perform a POST request to an HTTP or HTTPS endpoints

26
Q

What are Amazon CloudWatch Events and how do they work?

A

Amazon CloudWatch Events deliver a near real-time stream of system events that describe changes in AWS resources.

Using simple rules, you can route each type of event to one or more targets, such as Lambda functions, Kinesis streams and SNS topics

27
Q

What are AWS Lambda scheduled events and how do they work/

A

You can create a Lambda function and configure AWS Lambda to excute it on a regular schedule

28
Q

What is AWS WAF security automations and how do they work?

A

AWS WAF is a web application firewall that enables you to create customer, application-specific rules that block common attack patterns that can affect application availability, compromise security, or consume excessive resources.

You can administer AWS WAF completely through APIs which makes security automation easy, enabling rule propagation and fast incident response

29
Q

What is Loose Coupling?

A

As application complexity increases, a desirable attribute of an IT system is that it can be broken into smaller, loosely coupled components.

This means that IT systems should be designed in a way that reduces interdependencies- a change or a failure in one component should not cascade to other components

30
Q

What are well-defined interfaces and how can they reduce interdependencies?

A

Well definted Interfaces can allow a system various components to interact with each other only through specific, technology-agnostic interfaces, such as RESTful APIs.

In that way, technical implementation detail is hidden so that reams can modify the underlying implementation without affecting other components.

As long as those interfaces maintain backwards compabitibility, deployments of different components are decoupled.

This granular design pattern is commonly referred to as a microservices architectures

31
Q

What is Amazon API GAteway

A

Amazon API GAteway is a fully manaed service that makes it easy for developers to create, publish, maintain, and secure APIs at any scale.

It handles all the tasks involvded in accepting and processing up to hundreds of thousands of concurrent API calls, including traffic management, authorization and access control, monitoring ,and API version management

32
Q

What is service discovery?

A

Applications that are deployed as a set of smaller services depend on the ability of those services to interact with each other.

Because each of those services can be running across multiple compute resources, there needs to be a way for each service to be addressed.

For example in a traditional infrastructure, if your front-end web service needs to connect with your back-end web service, you could hardcode the IP addresses of the compute resource where this server was running.

Although this approach can still work in cloud computing, if those services are meant to be loosely coupled, they should be able to be consumed without prior knowledge of their network topology details.

Apart from hiding complexity, this also allows infrastructure details to change at aby time.

Loose coupling is a crucial element if you want to take advantage of the elasticity of cloud computing where new resources can be launched or terminated at any point in time.

In order to achieve that you will need some way of implementing service discovery

33
Q

How is service discovery implemented/

A

For an Amazon EC2-hosted service, a simple way to achieve service discovery is through Elastic Load Balancing (ELB).

Because each load balancer gets its own hostname m you can consume a service through a stable endpoint.

This can be combined with DNS and private Amazon Route 53 zones, so that the particular load balancers endpoint can be abstracted and modified at any time

Another option is to use a service registration and discovery method to allow retrieval of the endpoint IP addresses and port number of any service.

Because service discovery becomes the glue between the components, it is important that it is highly available and reliable.

If load balancers are not used, service discovery should also allows options such as health checks,

Amamzon Route 53 supports auto naming to make it easier to provision instances for microservices.

Auto naming lets you automatically create DNS records based on a configure you define.

Other example implementations include custom solutions using a combination of tags, a highly available database, custom scripts that call the AWS APIs, or open source tools such as Netflix Eureka, Airbnb Synapse, or HashiCorp Consul

34
Q

What is asynchronous integration and how is it implemented in AWS?

A

Asynchronous integration is another form of loose coupling between services.

This model is suitable for any interaction that does not need an immediate response and where an acknowledgment that a request has been registered will suffice.

It involves one component that generates events and another that consumes them.

The two component do not integrate through direct point-to-point interaction but usually through an intermediate durable storage layer, such as an SQS queue or a streaming data platform such as Amazon Kinesis, cascading Lambda events, AWS Step Functions, or Amazon Simple Workflow Service

This approach decouples the two components and introduces additional resiliency.

So for example, if a process that is reading messages from the queue fails, messages can still be added to the queue and processed when the system recovers.

It also allows you to protect a less scalable back-end service from front-end spikes and find the right trade between cost and processing lag.

For example, you can decide that you do not need to scale your database to accomodate an occasional peak of write queries, as long as you eventually process those queries asynchronously with some delay.

Finally, by removing slow operations from interactive requests paths you can also improve the end-user experience

35
Q

What are some examples of a synchronous integration?

A

A front-end application inserts jobs in a queue system such as Amazon SQS. A backend system retrieves those jobs and processes them at its own pace

An API generates events and pushes them into Kinesis streams. A backend application processes these events in batches to create aggregated time-series data stored in a database

Multiple heterogenous systems use AWS Step Functions to communicate the flow of work between them without directly interacting with each other

Lambda functions can consume events from a variety of AWS sources, such as Amazon DynamoDB update streams and Amazon S3 event notifications.

You dont have to worry about implementing a queing or other asynchronous integration method because Lambda handles this for you

36
Q

What are some distributed system best practices?

A

Another way to increase loose coupling is to build applications that handle component failure in a graceful manner.

You can identify ways to reduce the impact to your end users and increase your ability to make progress on your offline procedures, even in the event of some component failure

37
Q

Explain graceful failure in practice

A

A request that fails can be retrieved with an exponential backoff and Jitter strategy, or it can be stored in a queue for later processing.

For front-end interfaces, it might be possible to provide alternative or cached content instead of failing completely when, for example, your databse server becomes unavailable.

The Amazon Route 53 DNS failover feature also gives you the ability to monitor your website and automatically route your visitors to a backup site if your primary site becomes unavailable.

You can host your backup site as a static website on Amazon S3 or as a separate dynamic environment

38
Q

Explained managed services in AWS

A

AWS Managed services provide building blocks that developers can consume to power their applications.

These managed services