← Solutions Architect Associate study path

Secure architectures · 12 min

AWS WAF, AWS Shield, GuardDuty, Macie and Cognito

In this lesson you will learn what each AWS protection and detection service does, from AWS Shield and AWS WAF to GuardDuty, Macie, Inspector and Security Hub, and when to use Amazon Cognito for an application's sign-in.

AWS has more than 20 security, identity and compliance services. For the Solutions Architect exam it is enough to tell apart the ones that look alike, because they tend to show up together as options in the same question. Task 1.2 of the exam guide names three of them as examples, Amazon Cognito, Amazon GuardDuty and Amazon Macie, and two external threats, attacks and .

These services can be sorted by what they do. Some protect, that is, they stop an attack before it reaches your application, and others detect, because they alert you to what already happened or to what is misconfigured. In addition, one of them identifies the users of your application. For example, at an online store, a protection service stops whoever tries to take the site down in the middle of a sale, a detection service warns that someone left the folder with the invoices open to the public, and the identity service handles the shoppers' sign-in.

Seven AWS security services grouped by what they do: AWS Shield and AWS WAF protect, GuardDuty, Macie, Inspector and Security Hub detect, and Cognito identifies

AWS Shield

AWS Shield protects against DDoS attacks, which try to overwhelm an application with traffic. Its basic tier, AWS Shield Standard, protects all AWS customers automatically and at no additional cost against the most common network and transport layer DDoS attacks, which are the ones that flood the connection with junk packets without even requesting a page. On Amazon Route 53 (the AWS domain name service), Amazon CloudFront (the one that delivers your site from locations close to each user) and AWS Global Accelerator that protection is even stronger. For example, if the store serves its site with CloudFront and someone sends it a flood of junk traffic, Shield Standard absorbs it without the store doing anything.

AWS Shield Advanced is the subscription that adds application layer protection, that is, against attacks that do request real pages but in huge numbers, DDoS cost protection, which gives credits when an attack drives up your bill because your resources grew to withstand it, and access to the AWS Shield Response Team, an AWS team that helps you during an attack. It costs 3,000 USD per month with a one-year commitment, plus a data transfer fee, and access to the Shield Response Team also requires a Business or Enterprise support plan. For example, a small store starts with Shield Standard, and considers Shield Advanced when it needs application layer protection or that team's support during an attack.

AWS WAF

AWS WAF is a web application , which means it reads HTTP and HTTPS requests, which are the messages a browser sends to a site, such as "show me the cart". With its rules it detects SQL injection, , with a bad reputation and . It also has rate-based rules, which limit how many requests each IP sends and can be narrowed to part of the traffic, such as a path, with a scope-down statement. Unlike a security group, which is each server's filter and only has allow rules, WAF can block the requests that match a rule. For example, the store can limit how many times per minute the same IP tries to get into its sign-in page, to stop a bot that is trying passwords.

What you configure in WAF is a web ACL, which in the new console is called a protection pack. A web ACL brings together rules in priority order and a default action, and it is associated with the resources it protects.

A web ACL with rules in priority order (IP set, rate-based rule, Core rule set, SQL injection, Bot Control) and its default action; on the right, the resources it is associated with

WAF evaluates the rules in their priority order. The first rule that allows or blocks a request ends the evaluation, and if none does, the web ACL's default action is applied. For example, if the store's first rule blocks a list of IPs known for attacking, a request from those IPs is blocked there and the rules after it are no longer checked.

The resources a web ACL can be associated with are CloudFront, Application Load Balancer, API Gateway REST, AppSync, Cognito user pools and others. A Network Load Balancer or a standalone EC2 instance are not on that list, so an option that puts WAF directly on them is wrong. The Application Load Balancer is the load balancer that spreads a website's visits across several servers, and an EC2 instance is a virtual server.

AWS Shield or AWS WAF?

0 of 4

Tap the service that handles each threat or requirement.

  1. A network DDoS attack against the CloudFront distribution

  2. An attacker injects SQL into the site's search parameter

  3. Limit /login to 100 requests every five minutes per IP

  4. Credits if an attack drives up the bill through scaling

GuardDuty, Macie, Inspector and Security Hub

These four services are detection services and generate findings, which are alerts that they found something suspicious or misconfigured, and that is why they get confused in the options. The difference between them is in what each one checks:

  • Amazon GuardDuty, which detects malicious or suspicious activity in three foundational sources: AWS CloudTrail management events, VPC Flow Logs and query logs. CloudTrail records every action taken in the account and Flow Logs records the network connections, and because GuardDuty reads them from its own stream, it works without you creating a trail (the setting that stores those CloudTrail logs) or turning on Flow Logs.
  • Amazon Macie, which finds sensitive data, such as personal data, financial data or credentials, in S3 buckets with machine learning and pattern matching, and which also alerts you if a bucket becomes public.
  • Amazon Inspector, which looks for software and unintended network exposure in EC2 instances, images in Amazon ECR and Lambda functions.
  • AWS Security Hub, which brings together the findings of those services and checks your account against best practice standards.

For example, at the store GuardDuty warns that an instance is connecting to an attackers' address, Macie warns that there are card numbers in a bucket, Inspector warns that the site's server has an outdated program, and Security Hub shows all three alerts in one place.

Match each question with the service

0 of 4 pairs

Tap the question and then the service that answers it.

0 of 4 pairs.

Automatic response to a finding

A GuardDuty finding can trigger an automatic response, which is the principle of preparing for security events put into services. That response connects GuardDuty with Amazon EventBridge, which receives events and decides whom to pass them to, AWS Lambda, which runs a short program when asked, and Amazon SNS, which sends alerts by email or text message.

GuardDuty sends a finding to Security Hub and to Amazon EventBridge; an EventBridge rule invokes a Lambda function that isolates the instance and sends an alert through SNS

GuardDuty sends the finding to EventBridge, and an EventBridge rule invokes a . That function replaces the instance's security group with an isolation one, and SNS alerts the team. The instance stays running so it can be investigated later, because if you terminated it you would lose the evidence. For example, if in the middle of the night GuardDuty detects that one of the store's servers is talking to an attackers' address, the function isolates it in seconds and the team reads the alert when they wake up, with the server intact to examine.

Amazon Cognito

Amazon Cognito is an identity platform for web and mobile applications: it keeps your users' accounts and takes care of their sign-in, so you don't have to program it yourself. Its user pools give you a user directory, which is the list of accounts with their passwords, and sign-in, including with providers such as Google or Apple. Its identity pools also provide temporary AWS credentials to the application, which are permissions that expire on their own.

IAM Identity Center also handles identities, and the difference between the two is who signs in. Cognito is for the users of your application, while Identity Center is for your workforce. For example, the store's shoppers create their account and sign in to the app with Cognito, and the store's employees sign in to the AWS accounts with Identity Center.

Which service do you use?

A mobile app needs its customers to sign in with their Google account and then upload photos directly to an S3 bucket with temporary credentials. Which service solves it?

In a new experience account

In a new experience account, which is the one you open with Google, GitHub, Apple, Amazon or email, AWS WAF and Amazon Cognito are included in the free plan. AWS Shield appears on the list of unavailable services, so you can't subscribe to Shield Advanced. Also, GuardDuty, Macie, Security Hub and Detective require turning on the advanced features, and Inspector doesn't appear on any list, so to practice detection you need a full account. For example, in that account you can create a web ACL with a rate-based rule and a Cognito user pool for a test app's sign-in.

How does it show up on the exam?

Questions on this topic describe a threat or a requirement and ask you for the service that handles it, and these phrases in the question point to the answer:

If the question says The answer
"DDoS" AWS Shield
"Cost protection" or "response team" AWS Shield Advanced
"SQL injection", "cross-site scripting" or "limit requests per IP" AWS WAF on CloudFront, ALB or API Gateway
"Unusual activity", "malicious IP" or "compromised credentials" Amazon GuardDuty
"PII in S3" or "sensitive data" Amazon Macie
"Vulnerabilities", "CVE" or "missing patches" Amazon Inspector
"Application users" or "sign-up and sign-in" Amazon Cognito

PII is the personal data that identifies someone, such as their name or their ID number, and a CVE is the code under which a known vulnerability is published. For example, if the question says the store wants to know whether its buckets hold customers' addresses and phone numbers, the answer is Macie.

Review question

A company has a web application behind an Application Load Balancer. A few IPs send thousands of requests per second to the sign-in page, and the instances can't keep up with them. The company wants to stop those IPs automatically with the least effort. What does it do?

Next