<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Wilklins Nyatteng</title>
    <description>The latest articles on Forem by Wilklins Nyatteng (@wilklins).</description>
    <link>https://forem.com/wilklins</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1037358%2F3e0a510d-516a-4800-88cd-dcab90713290.jpeg</url>
      <title>Forem: Wilklins Nyatteng</title>
      <link>https://forem.com/wilklins</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/wilklins"/>
    <language>en</language>
    <item>
      <title>Deep Dive into AWS AppSync API Authorization Mechanisms</title>
      <dc:creator>Wilklins Nyatteng</dc:creator>
      <pubDate>Thu, 23 Oct 2025 23:44:27 +0000</pubDate>
      <link>https://forem.com/aws-builders/deep-dive-into-aws-appsync-api-authorization-mechanisms-1ifl</link>
      <guid>https://forem.com/aws-builders/deep-dive-into-aws-appsync-api-authorization-mechanisms-1ifl</guid>
      <description>&lt;p&gt;AWS AppSync provides a robust and flexible set of authorization mechanisms to secure GraphQL APIs. These mechanisms cater to a wide range of use cases—from public APIs to enterprise-grade, fine-grained access control. AppSync supports five distinct authorization types, each with its own strengths, limitations, and ideal use cases. Developers can also combine multiple authorization types to implement layered security models.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. API Key Authorization&lt;/strong&gt;&lt;br&gt;
API keys are static credentials used to authenticate requests to an AppSync API. They are best suited for development environments, public-facing APIs, or guest access scenarios where minimal security is acceptable.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Key Characteristics:&lt;/strong&gt;&lt;br&gt;
Validity Period: API keys can be configured for up to 365 days. On the final day of validity, they can be extended for another 365 days. Once expired, they cannot be renewed—a new key must be generated.&lt;br&gt;
Security Considerations: API keys do not provide identity context. Any client with the key can access the API, making them unsuitable for production environments or sensitive data.&lt;br&gt;
Use Case: Ideal for unauthenticated access, such as read-only public data or early-stage development.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. AWS Lambda Authorization (Custom Authorizers)&lt;/strong&gt;&lt;br&gt;
Lambda authorizers offer maximum flexibility by allowing developers to implement custom authentication and authorization logic. This method is suitable for complex scenarios where standard identity providers or IAM policies are insufficient.&lt;br&gt;
&lt;strong&gt;Invocation Flow:&lt;/strong&gt;&lt;br&gt;
When a request is made to the AppSync API, the Lambda function is invoked with the following payload:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
  "authorizationToken": "AuthTokenExample",
  "requestContext": {
    "apiId": "ApiId39393939",
    "accountId": "1234567890",
    "requestId": "f4081827-1111-4444-5555-5cf4695f339f",
    "queryString": "mutation deletePost {...}",
    "operationName": "deletePost",
    "variables": {}
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Response Format:&lt;/strong&gt;&lt;br&gt;
The Lambda function must return a structured response:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
  "isAuthorized": true,
  "deniedFields": ["Mutation.deletePosts"],
  "resolverContext": {
    "role": "editor"
  },
  "ttlOverride": 900
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Key Features:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;isAuthorized (Required): Boolean flag indicating whether the request is allowed.&lt;/li&gt;
&lt;li&gt;deniedFields (Optional): Specific GraphQL fields that are denied, even if isAuthorized is true.&lt;/li&gt;
&lt;li&gt;resolverContext (Optional): Custom context passed to resolvers, accessible via $ctx.identity.resolverContext.&lt;/li&gt;
&lt;li&gt;ttlOverride (Optional): Overrides the default 5-minute cache TTL for the authorization result.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Use Case:&lt;/strong&gt;&lt;br&gt;
Perfect for multi-tenant applications, custom token validation, or role-based access control beyond what Cognito or IAM can offer.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. AWS IAM Authorization&lt;/strong&gt;&lt;br&gt;
IAM-based authorization leverages AWS's native identity and access management system. It is ideal for server-to-server communication, backend services, or authenticated AWS users.&lt;br&gt;
&lt;strong&gt;Mechanism:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Requests are signed using AWS Signature Version 4.&lt;/li&gt;
&lt;li&gt;IAM policies define access to specific GraphQL operations using the appsync:GraphQL action.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Example IAM Policy:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": ["appsync:GraphQL"],
      "Resource": [
        "arn:aws:appsync:us-west-2:123456789012:apis/PostsAPI/types/Query/fields/listPosts",
        "arn:aws:appsync:us-west-2:123456789012:apis/PostsAPI/types/Mutation/fields/createPost"
      ]
    }
  ]
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Use Case:&lt;/strong&gt;&lt;br&gt;
Best suited for internal applications, microservices, or AWS-authenticated clients using temporary credentials (e.g., STS tokens).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. OpenID Connect (OIDC) Authorization&lt;/strong&gt;&lt;br&gt;
OIDC is an identity layer built on top of OAuth 2.0. AppSync supports OIDC for integrating with third-party identity providers such as Auth0, Okta, or any compliant OIDC provider.&lt;br&gt;
&lt;strong&gt;Mechanism:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Clients send requests with an OIDC token.&lt;/li&gt;
&lt;li&gt;AppSync validates the token against the OIDC Issuer URL.&lt;/li&gt;
&lt;li&gt;Upon successful validation, AppSync extracts user claims from the token.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Configuration Requirements:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Issuer URL (OIDC Provider Domain): Must be publicly accessible and support standard OIDC discovery endpoints.&lt;/li&gt;
&lt;li&gt;Token Expiry: Tokens must be short-lived and securely issued.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Use Case:&lt;/strong&gt;&lt;br&gt;
Ideal for enterprise applications with existing identity infrastructure or federated login systems.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;5. Amazon Cognito User Pools&lt;/strong&gt;&lt;br&gt;
Cognito User Pools are AWS’s managed identity service that supports OIDC and integrates natively with AppSync. It provides user sign-up, sign-in, and group-based access control.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Mechanism:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Users authenticate via Cognito and receive a JWT token.&lt;/li&gt;
&lt;li&gt;AppSync validates the token and uses Cognito groups to enforce access control.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Advanced Features:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Group-based Authorization: Define access rules based on user group membership.&lt;/li&gt;
&lt;li&gt;Token Claims: Use custom claims to pass additional context to resolvers.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Use Case:&lt;/strong&gt;&lt;br&gt;
Best for mobile and web applications requiring user authentication, multi-factor authentication, and fine-grained access control.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Combining Authorization Types&lt;/strong&gt;&lt;br&gt;
AppSync allows multiple authorization modes to be configured simultaneously. This enables developers to support diverse access patterns, such as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Public access via API Key&lt;/li&gt;
&lt;li&gt;Authenticated access via Cognito&lt;/li&gt;
&lt;li&gt;Backend access via IAM&lt;/li&gt;
&lt;li&gt;Custom logic via Lambda&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Example Use Case:&lt;/strong&gt;&lt;br&gt;
A blogging platform might use:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;API Key for public read access to posts.&lt;/li&gt;
&lt;li&gt;Cognito for authenticated users to create and edit posts.&lt;/li&gt;
&lt;li&gt;Lambda for admin-level moderation logic.&lt;/li&gt;
&lt;li&gt;IAM for internal analytics services.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Conclusion&lt;/strong&gt;&lt;br&gt;
AWS AppSync’s flexible authorization model empowers developers to secure GraphQL APIs using a combination of standard protocols, custom logic, and AWS-native identity services. By understanding the strengths and limitations of each authorization type, teams can design APIs that are both secure and scalable.&lt;/p&gt;

</description>
      <category>awsappsync</category>
      <category>graphqlsecurity</category>
      <category>serverlessauthorization</category>
      <category>awscommunitybuilder</category>
    </item>
    <item>
      <title>Evaluating Network Security With Amazon VPC Network Access Analyzer</title>
      <dc:creator>Wilklins Nyatteng</dc:creator>
      <pubDate>Sun, 12 Oct 2025 06:47:00 +0000</pubDate>
      <link>https://forem.com/aws-builders/evaluating-network-security-with-amazon-vpc-network-access-analyzer-2h41</link>
      <guid>https://forem.com/aws-builders/evaluating-network-security-with-amazon-vpc-network-access-analyzer-2h41</guid>
      <description>&lt;h1&gt;
  
  
  &lt;strong&gt;Description&lt;/strong&gt;
&lt;/h1&gt;

&lt;p&gt;Amazon VPC Network Access Analyzer is a security analysis service that helps you improve the security and compliance of your AWS resources. This service analyzes all network traffic within your VPCs to provide you with visibility into traffic flows and detect unintended access. It can also help you identify overly permissive security group rules and network access control lists (ACLs).&lt;/p&gt;

&lt;p&gt;In this lab, you will enable Network Access Analyzer and create a scope to analyze network traffic in a VPC.&lt;/p&gt;

&lt;h3&gt;
  
  
  Learning objectives
&lt;/h3&gt;

&lt;p&gt;Upon completion of this beginner-level lab, you will be able to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Analyze a Network Access Analyzer finding&lt;/li&gt;
&lt;li&gt;Create a Network Access Analyzer scope&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Logging In to the Amazon Web Services Console&lt;/strong&gt;
This lab experience involves Amazon Web Services (AWS), and you will use the AWS Management Console to complete the instructions in the following lab steps.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0qf2iocrnl8s3jhxwitu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0qf2iocrnl8s3jhxwitu.png" alt=" " width="800" height="410"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The AWS Management Console is a web control panel for managing all your AWS resources, from EC2 instances to SNS topics. The console enables cloud management for all aspects of the AWS account, including managing security credentials and even setting up new IAM Users.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Introduction&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Developers can begin working with Network Access Analyzer using the AWS Management Console, AWS CLI, or AWS SDKs. When you access the Network Access Analyzer service for the first time, AWS creates four default scopes on your behalf. These default scopes can be used to analyze all traffic in your VPCs and subnets.&lt;/p&gt;

&lt;p&gt;You can also create network access scopes to analyze specific traffic patterns. For example, you can create a scope to analyze traffic to a specific EC2 instance or subnet. You can also create a scope to analyze traffic from a specific source, such as a security group or IP address.&lt;/p&gt;

&lt;p&gt;In this lab step, you will explore a default Network Access Analyzer scope and finding.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Instructions&lt;/strong&gt;
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;In the AWS Management Console, in the search bar at the top, enter &lt;em&gt;network manager&lt;/em&gt;, and under &lt;strong&gt;Features&lt;/strong&gt;, click the &lt;strong&gt;Network Manager&lt;/strong&gt; result:&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fd7yk7835ufwh0luicszf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fd7yk7835ufwh0luicszf.png" alt=" " width="372" height="228"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;In the left navigation pane, click Network Access Analyzer below Security and governance:&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5va1os1cnpqujcxk86k7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5va1os1cnpqujcxk86k7.png" alt=" " width="189" height="49"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Click Get started:&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fo5ubcjhxw8xndxybvw6s.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fo5ubcjhxw8xndxybvw6s.png" alt=" " width="242" height="68"&gt;&lt;/a&gt;&lt;br&gt;
I have created the following default scopes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;AWS-IGW-Egress&lt;/strong&gt;: Identify egress paths from all Network Interfaces to Internet Gateways.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;All-IGW-Ingress&lt;/strong&gt;: Identify ingress paths from Internet Gateways to all Network Interfaces.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;AWS-VPC-Ingress&lt;/strong&gt;: Identify ingress paths into your VPCs from Internet Gateways, Peering Connections, VPC Service Endpoints, VPN and Transit Gateways.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;AWS-VPC-Egress&lt;/strong&gt;: Identify egress paths to Internet Gateways, Peering Connections, VPC Endpoints, VPN, and Transit Gateways from all of your VPCs.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These default scopes created for you do not rely on any preconfigured resources. The &lt;a href="https://docs.aws.amazon.com/aws-managed-policy/latest/reference/AmazonVPCNetworkAccessAnalyzerFullAccessPolicy.html" rel="noopener noreferrer"&gt;AmazonVPCNetworkAccessAnalyzerFullAccessPolicy, opens in a new tab&lt;/a&gt; IAM managed policy grants the necessary permissions to create and analyze these scopes.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Select the &lt;strong&gt;All-IGW-Ingress&lt;/strong&gt; scope, then click &lt;strong&gt;Analyze&lt;/strong&gt;:&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fq680hdddxaoimfnry099.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fq680hdddxaoimfnry099.png" alt=" " width="560" height="56"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzngzbp2m0ujvnqi8f68f.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzngzbp2m0ujvnqi8f68f.png" alt=" " width="194" height="66"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;While you wait for the analysis to complete, click the arrow icon to expand the Network Access Scope definition:&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fo2l48esxoif9nu2kp4wl.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fo2l48esxoif9nu2kp4wl.png" alt=" " width="255" height="30"&gt;&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
          "NetworkInsightsAccessScopeId": "nis-0ca0d5341e6e92e8f",
          "MatchPaths": [
                    {
                              "Source": {
                                        "ResourceStatement": {
                                                  "ResourceTypes": [
                                                            "AWS::EC2::InternetGateway",
                                                            "AWS::EC2::VPCPeeringConnection",
                                                            "AWS::EC2::VPCEndpointService",
                                                            "AWS::EC2::TransitGatewayAttachment",
                                                            "AWS::EC2::VPNGateway"
                                                  ]
                                        }
                              },
                              "Destination": {
                                        "ResourceStatement": {
                                                  "ResourceTypes": [
                                                            "AWS::EC2::NetworkInterface"
                                                  ]
                                        }
                              }
                    }
          ]
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The scope definition is a JSON object that specifies the source and destination of the traffic to analyze. In this case, the source is an internet gateway, and the destination is a network interface. Findings that match this scope definition will be displayed in the Findings tab.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;The following analysis status will appear when the analysis is complete:&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1g0guubwuzd4z444zqe8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1g0guubwuzd4z444zqe8.png" alt=" " width="779" height="53"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;In the Findings table, select the lab-igw to lab-bastion-instance finding:&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxhf5usxgs6h7dxe7lqe9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxhf5usxgs6h7dxe7lqe9.png" alt=" " width="392" height="54"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The traffic flow diagram will appear below the table:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftfnpx0aaf1jdyugpljfi.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftfnpx0aaf1jdyugpljfi.png" alt=" " width="434" height="569"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The source of the traffic is the &lt;strong&gt;lab-igw&lt;/strong&gt; internet gateway, and the destination is the elastic network interface associated with the &lt;strong&gt;lab-bastion-instance&lt;/strong&gt; EC2 instance. Rule 100 of the access control list allows all inbound traffic. The SSH traffic is allowed by the inbound &lt;strong&gt;lab-bastion-instance&lt;/strong&gt; security group rule on port 22.&lt;/p&gt;

&lt;p&gt;The &lt;strong&gt;End&lt;/strong&gt; section of the diagram also provides details on which VPC the traffic is flowing through and the destination subnet.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Creating a Network Access Analyzer Scope
### &lt;strong&gt;Introduction&lt;/strong&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Developers can begin working with Network Access Analyzer using the AWS Management Console, AWS CLI, or AWS SDKs. When you access the Network Access Analyzer service for the first time, AWS creates four default scopes on your behalf. These default scopes can be used to analyze all traffic in your VPCs and subnets.&lt;/p&gt;

&lt;p&gt;You can also create network access scopes to analyze specific traffic patterns. For example, you can create a scope to analyze traffic to a specific EC2 instance or subnet. You can also create a scope to analyze traffic from a specific source, such as a security group or IP address.&lt;/p&gt;

&lt;p&gt;In this lab step, you will create a network access scope and analyze traffic to the &lt;strong&gt;lab-db-instance&lt;/strong&gt; EC2 instance.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Instructions&lt;/strong&gt;
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Click the Network Access Scopes breadcrumb link to return to the scopes page:&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffoozd31vvbb4sog7p0di.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffoozd31vvbb4sog7p0di.png" alt=" " width="153" height="31"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Click Create Network Access Scope:&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Foyosr0lzb9r5p2t26f1z.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Foyosr0lzb9r5p2t26f1z.png" alt=" " width="192" height="46"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;In the Select Network Access Scope template step, select Empty template, then click Next:
In the Select Network Access Scope template step, select Empty template, then click Next:&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0w0t6imgaj5p0dq2vmrn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0w0t6imgaj5p0dq2vmrn.png" alt=" " width="800" height="98"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;In the Define Network Access Scope step, enter db-instance-ingress for the Name:
In the Define Network Access Scope step, enter db-instance-ingress for the Name:&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fz1q2iy5isd5tt143sp76.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fz1q2iy5isd5tt143sp76.png" alt=" " width="713" height="66"&gt;&lt;/a&gt;&lt;br&gt;
Network access scopes can include a match condition and an exclude condition.&lt;/p&gt;

&lt;p&gt;A &lt;strong&gt;match&lt;/strong&gt; condition specifies the network access patterns that do not meet your requirements. If a finding matches a match condition, it will be reported in the analysis.&lt;/p&gt;

&lt;p&gt;An &lt;strong&gt;exclude&lt;/strong&gt; condition specifies the traffic that you want to exclude from the analysis. Exclude conditions can be used to define network access that you consider as trusted. If a finding matches an excluded condition, it will not be reported in the analysis.&lt;/p&gt;

&lt;p&gt;Up next, you will create a match condition to analyze all traffic to the &lt;strong&gt;lab-db-instance&lt;/strong&gt; EC2 instance.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Click Add match condition below Match conditions:&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fh7tn2163oc9n61nux08o.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fh7tn2163oc9n61nux08o.png" alt=" " width="406" height="111"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;A Match findings condition will be added to the scope.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;1. Configure the following match condition:&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Source&lt;/strong&gt;: You will not configure a source. This scope will analyze all traffic and sources that can access the &lt;strong&gt;lab-db-instance&lt;/strong&gt; EC2 instance.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Destination&lt;/strong&gt;:

&lt;ul&gt;
&lt;li&gt;Expand the &lt;strong&gt;Resources&lt;/strong&gt; section.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Resource selection&lt;/strong&gt;: Select &lt;strong&gt;Resource IDs&lt;/strong&gt; from the drop-down menu&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Resource types&lt;/strong&gt;: Select &lt;strong&gt;EC2 Instances&lt;/strong&gt; from the drop-down menu&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Resource IDs&lt;/strong&gt;: Select the &lt;strong&gt;lab-db-instance&lt;/strong&gt; EC2 instance from the drop-down menu&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This network access scope will capture any network traffic that is allowed to access the &lt;strong&gt;lab-db-instance&lt;/strong&gt; EC2 instance. In this example, you want to ensure that the only SSH access allowed to the &lt;strong&gt;lab-db-instance&lt;/strong&gt; EC2 instance is from the &lt;strong&gt;bastion-security-group&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8ut3jdljzq33vzlxqfqv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8ut3jdljzq33vzlxqfqv.png" alt=" " width="733" height="231"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Click Next.&lt;/li&gt;
&lt;li&gt;Click Create Network Access Scope:&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fblux7sgnislmu7i7neve.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fblux7sgnislmu7i7neve.png" alt=" " width="200" height="39"&gt;&lt;/a&gt;&lt;br&gt;
You will be redirected to the Network Access Scopes page.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Select the db-instance-ingress scope, then click Analyze:&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fd7nlfvwejhwl3i1fm96w.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fd7nlfvwejhwl3i1fm96w.png" alt=" " width="190" height="27"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In this lab step, you created a network access scope and analyzed the traffic to the &lt;strong&gt;lab-db-instance&lt;/strong&gt; EC2 instance.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Addressing Network Access Analyzer Findings
### &lt;strong&gt;Introduction&lt;/strong&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Network access findings are generated by analyzing network traffic in a scope. A finding is a potential path in your network that matches any of the &lt;strong&gt;match&lt;/strong&gt; conditions and does not match any of the &lt;strong&gt;exclude&lt;/strong&gt; conditions defined in the scope. Findings are presented in the Network Access Analyzer console and can be exported for further analysis.&lt;/p&gt;

&lt;p&gt;In this lab step, you will review a finding generated by your custom network access scope and address the unintended access to the &lt;strong&gt;lab-db-instance&lt;/strong&gt; EC2 instance.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Instructions&lt;/strong&gt;
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;In the &lt;strong&gt;Findings&lt;/strong&gt; table below, select the finding with the &lt;strong&gt;lab-default-instance&lt;/strong&gt; EC2 instance in the &lt;strong&gt;Start&lt;/strong&gt; column:&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fabwc47pxvtclcyeoy21s.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fabwc47pxvtclcyeoy21s.png" alt=" " width="800" height="486"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The diagram above presents the following details:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Start&lt;/strong&gt;: The finding begins with the ENI that initiated the network traffic. In this case, the ENI is associated with the &lt;strong&gt;lab-default-instance&lt;/strong&gt; EC2 instance.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;End&lt;/strong&gt;: The ENI of the EC2 instance that received the network traffic&lt;/li&gt;
&lt;li&gt;The outbound network traffic is allowed by the &lt;strong&gt;default-security-group&lt;/strong&gt; security group and is destined for the &lt;strong&gt;lab-db-instance&lt;/strong&gt; EC2 instance.&lt;/li&gt;
&lt;li&gt;The &lt;strong&gt;db-security-group&lt;/strong&gt; allows inbound SSH traffic on port 22 from the &lt;strong&gt;0.0.0.0/0&lt;/strong&gt; CIDR block to the &lt;strong&gt;lab-db-instance&lt;/strong&gt; EC2 instance. This public internet access is unintended and should be addressed:&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fuof7mcdoo03ornq9c18g.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fuof7mcdoo03ornq9c18g.png" alt=" " width="337" height="94"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Click the db-security-group ID to expand the access details:&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Firq32pw5aeqqznxa4gas.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Firq32pw5aeqqznxa4gas.png" alt=" " width="399" height="220"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You will notice the &lt;strong&gt;db-security-group&lt;/strong&gt; is allowing SSH traffic from the &lt;strong&gt;0.0.0.0/0&lt;/strong&gt; CIDR block.&lt;/p&gt;

&lt;p&gt;To remove this unintended access, you will update the &lt;strong&gt;db-security-group&lt;/strong&gt; security group rule to only allow SSH traffic from the &lt;strong&gt;bastion-security-group&lt;/strong&gt;.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;To update the security group rule, click the security group ID below Resource ID:&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F06ja7ckwh6kaut5hla1s.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F06ja7ckwh6kaut5hla1s.png" alt=" " width="154" height="43"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Click Edit inbound rules:&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fllwxxvdnrarg41c5db6k.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fllwxxvdnrarg41c5db6k.png" alt=" " width="143" height="32"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Click Delete next to the only inbound rule defined:&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6cgfounxo8luxcwpujfb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6cgfounxo8luxcwpujfb.png" alt=" " width="84" height="44"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Click Add rule:&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fy7ysczemght4gpue72y4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fy7ysczemght4gpue72y4.png" alt=" " width="94" height="39"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Configure the following rule:&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Type&lt;/strong&gt;: Select &lt;strong&gt;SSH&lt;/strong&gt; from the drop-down menu&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Source&lt;/strong&gt;:

&lt;ul&gt;
&lt;li&gt;Select &lt;strong&gt;Custom&lt;/strong&gt; from the drop-down menu&lt;/li&gt;
&lt;li&gt;Select the &lt;strong&gt;bastion-security-group&lt;/strong&gt; from the drop-down menu&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzk2ql8s6jfb5hy97qvoj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzk2ql8s6jfb5hy97qvoj.png" alt=" " width="164" height="28"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Click Save rules:&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgqly8pvd98sxyib5ovyy.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgqly8pvd98sxyib5ovyy.png" alt=" " width="226" height="62"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Return to the Network Access Analyzer tab, then click Analyze to re-run the db-instance-ingress analysis:&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Foma9kfa9am0vh8c5se22.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Foma9kfa9am0vh8c5se22.png" alt=" " width="192" height="66"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After the analysis completes, you will notice the Findings table now displays a single finding. This finding indicates that the lab-bastion-instance is the only EC2 instance that has access to the lab-db-instance EC2 instance:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmjvf37jub8spb5x69q6u.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmjvf37jub8spb5x69q6u.png" alt=" " width="655" height="29"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The inbound rule you added to the db-security-group allows SSH traffic from the lab-bastion-instance to the lab-db-instance.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyoy6wx61pmdtzbevm1cd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyoy6wx61pmdtzbevm1cd.png" alt=" " width="376" height="171"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Summary&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;In this lab step, you reviewed your network access finding and addressed the SSH access issue by updating the &lt;strong&gt;db-security-group&lt;/strong&gt; security group rule.&lt;/p&gt;

&lt;p&gt;By completing this lab, you've completed the following tasks:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Created a Network Access Analyzer scope&lt;/li&gt;
&lt;li&gt;Evaluated a Network Access Analyzer finding&lt;/li&gt;
&lt;li&gt;Updated a security group rule to restrict SSH access to the &lt;strong&gt;lab-db-instance&lt;/strong&gt; EC2 instance&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>vpc</category>
      <category>awsnetwork</category>
      <category>awscommunitybuilder</category>
    </item>
    <item>
      <title>Review and Secure a Lambda Function with an IAM Least Privilege Based Security Policy: CloudTrail and Athena Approach</title>
      <dc:creator>Wilklins Nyatteng</dc:creator>
      <pubDate>Sun, 05 Oct 2025 08:26:43 +0000</pubDate>
      <link>https://forem.com/aws-builders/review-and-secure-a-lambda-function-with-an-iam-least-privilege-based-security-policy-cloudtrail-adm</link>
      <guid>https://forem.com/aws-builders/review-and-secure-a-lambda-function-with-an-iam-least-privilege-based-security-policy-cloudtrail-adm</guid>
      <description>

&lt;p&gt;In this lab scenario, you take on the role of a cloud security engineer, working for a business that has implemented a particular business process in AWS using &lt;a href="https://aws.amazon.com/lambda/" rel="noopener noreferrer"&gt;AWS Lambda&lt;/a&gt;. Version one (MVP) of the implementation has proven very successful with customers (in this lab - you actually deploy and set up the Lambda function). Due to the immediate success and demand of the serverless workflow, the company has now decided to review the IAM security policies involved in its operation and uptime of it. It is expected that current IAM permissions may be too broad and too permissive.&lt;/p&gt;

&lt;p&gt;As a cloud security engineer, it is your responsibility to perform the review and update existing IAM security permissions assigned to the Lambda function's execution role. Your task is to review the current IAM policies and refine them such that they adhere to the rule of &lt;strong&gt;least privilege&lt;/strong&gt;. To understand exactly what the Lambda function does, and in particular, the specific set of AWS API operations it integrates with, you will set up &lt;a href="https://aws.amazon.com/cloudtrail/" rel="noopener noreferrer"&gt;CloudTrail&lt;/a&gt; together with &lt;a href="https://aws.amazon.com/athena/" rel="noopener noreferrer"&gt;Athena&lt;/a&gt;. Additionally, this new setup will support another business requirement - being able to audit all AWS API calls made by the Lambda function for auditing and compliance reasons.&lt;/p&gt;

&lt;h3&gt;
  
  
  Learning Objectives
&lt;/h3&gt;

&lt;p&gt;Upon completion of this lab, you will be able to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Configure CloudTrail and Athena together to help you analyze AWS API operations being made within an AWS Account.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Environment before&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fz2fi7serjdq0qy4ohb6a.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fz2fi7serjdq0qy4ohb6a.png" alt=" " width="515" height="500"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Environment after&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6d4uvr38xjyeisegncxw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6d4uvr38xjyeisegncxw.png" alt=" " width="518" height="500"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. **Logging In to the Amazon Web Services Console&lt;/strong&gt;**&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;### **Introduction&lt;/strong&gt;**&lt;/p&gt;

&lt;p&gt;This lab experience involves Amazon Web Services (AWS), and you will use the AWS Management Console to complete the instructions in the following lab steps.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Foxti7pn9h3tnpvqni5qz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Foxti7pn9h3tnpvqni5qz.png" alt=" " width="800" height="410"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The AWS Management Console is a web control panel for managing all your AWS resources, from EC2 instances to SNS topics. The console enables cloud management for all aspects of the AWS account, including managing security credentials and even setting up new IAM Users.&lt;/p&gt;

&lt;p&gt;Amazon Web Services is available in different regions all over the world, and the console lets you provision resources across multiple regions. You usually choose a region that best suits your business needs to optimize your customer’s experience, but we must use the &lt;strong&gt;US West 2&lt;/strong&gt;for this lab.&lt;br&gt;
The AWS Management Console is a web control panel for managing all your AWS resources, from EC2 instances to SNS topics. The console enables cloud management for all aspects of the AWS account, including managing security credentials and even setting up new IAM Users.&lt;/p&gt;

&lt;p&gt;Amazon Web Services is available in different regions all over the world, and the console lets you provision resources across multiple regions. You usually choose a region that best suits your business needs to optimize your customer’s experience, but we must use the &lt;strong&gt;US West 2&lt;/strong&gt;for this lab.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fg7ygc8mirrrqqmkpshtv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fg7ygc8mirrrqqmkpshtv.png" alt=" " width="800" height="135"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. **Create CloudTrail Trail&lt;/strong&gt;**&lt;/p&gt;
&lt;h3&gt;
  
  
  &lt;strong&gt;Introduction&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;In this lab step, you'll learn how to set up CloudTrail to capture and log a subset of AWS API calls. For this lab scenario which involves a Lambda function (to be deployed) writing out to S3, you'll only need to configure CloudTrail to capture and record Lambda and S3 data plane AWS API calls. Next, to support your security policy analysis, you need complete the CloudTrail set up by establishing a new Athena database table, configured to read over the new CloudTrail logs. Upon completion, you'll be able to use Athena later in the lab to perform SQL queries over the data captured in the new CloudTrail logs.&lt;/p&gt;
&lt;h3&gt;
  
  
  &lt;strong&gt;Instructions&lt;/strong&gt;
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;In the AWS Management Console search bar, enter &lt;em&gt;CloudTrail&lt;/em&gt;, and click the &lt;strong&gt;CloudTrail&lt;/strong&gt; result under &lt;strong&gt;Services&lt;/strong&gt;:&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F347rrt2o3u13l77oaf8q.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F347rrt2o3u13l77oaf8q.png" alt=" " width="800" height="110"&gt;&lt;/a&gt;&lt;br&gt;
The CloudTrail management console will load.&lt;/p&gt;

&lt;p&gt;You may see blue warning notifications that say you aren't allowed to create a Cloud Trail for an organization. In this lab, you will create a Cloud Trail for the AWS account, blue warning notifications you see as you fill out the CloudTrail creation form can be safely ignored.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;In the &lt;strong&gt;Trails&lt;/strong&gt; section, click the &lt;strong&gt;Create trail&lt;/strong&gt; button:&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fx0r8ax28c7daseg0oqp6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fx0r8ax28c7daseg0oqp6.png" alt=" " width="252" height="76"&gt;&lt;/a&gt;&lt;br&gt;
A multi-step form-wizard will load, beginning with the &lt;strong&gt;Choose trail attributes&lt;/strong&gt; step.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;In the &lt;strong&gt;General details&lt;/strong&gt; section, enter the following information to complete the form:&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Trail name&lt;/strong&gt;: &lt;em&gt;LambdaS3Trail&lt;/em&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Storage location&lt;/strong&gt;: Select &lt;strong&gt;Create new S3 bucket&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Trail log bucket and folder&lt;/strong&gt;: Accept the provided default&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Log file SSE-KMS encryption&lt;/strong&gt;: Uncheck this&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Log file validation:&lt;/strong&gt; Uncheck this&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqti34ltq5eukd8vhsnwo.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqti34ltq5eukd8vhsnwo.png" alt=" " width="800" height="619"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Make a note of the name of the Amazon S3 bucket.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;You will use this later in the lab when querying within Amazon Athena.&lt;/p&gt;

&lt;p&gt;I recommend opening a notes page and using it to store notes for the duration of this lab.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;At the bottom of the page, click &lt;strong&gt;Next&lt;/strong&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;On this page, ensure the only &lt;strong&gt;Event type&lt;/strong&gt; selected is &lt;strong&gt;Data events&lt;/strong&gt;:&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbrun0fxkgq6but9qpzlf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbrun0fxkgq6but9qpzlf.png" alt=" " width="800" height="231"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;6.1. In the Data events section add the first data event type for Lambda. Select Lambda in the Data event type drop-down:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftc3r8t92h5fjqva6qt9w.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftc3r8t92h5fjqva6qt9w.png" alt=" " width="800" height="316"&gt;&lt;/a&gt;&lt;br&gt;
6.2. In the Dataevents section add a second data event type for S3 by clicking the Add data event type button. Select S3 in the Data event type drop-down:&lt;br&gt;
6.2. In the Dataevents section add a second data event type for S3 by clicking the Add data event type button. Select S3 in the Data event type drop-down:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;At the bottom of the page, click &lt;strong&gt;Next&lt;/strong&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Review the settings and click &lt;strong&gt;Create trail&lt;/strong&gt; at the bottom when ready.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;You will see your newly created trail listed in the &lt;strong&gt;Trails&lt;/strong&gt; table:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Femhrsjotyybgcw7r91c0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Femhrsjotyybgcw7r91c0.png" alt=" " width="800" height="57"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Your LambdaS3Trail Trail has now been created successfully, along with the S3 bucket it will deliver logs to. The path in S3 to a specific CloudTrail object adheres to the following pattern:&lt;br&gt;
bucket_name/prefix_name/AWSLogs/Account ID/CloudTrail/region/YYYY/MM/DD/file_name.json.gz&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Click on the name of your Trail. This opens up a Configuration page for your new Trail
Your LambdaS3Trail Trail has now been created successfully, along with the S3 bucket it will deliver logs to. The path in S3 to a specific CloudTrail object adheres to the following pattern:
bucket_name/prefix_name/AWSLogs/Account ID/CloudTrail/region/YYYY/MM/DD/file_name.json.gz&lt;/li&gt;
&lt;li&gt;Click on the name of your Trail. This opens up a Configuration page for your new Trail&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmlpfep3ziqo0q41kntmy.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmlpfep3ziqo0q41kntmy.png" alt=" " width="800" height="168"&gt;&lt;/a&gt;&lt;br&gt;
Don't change anything just yet, but you should notice the following important points:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Trail logging&lt;/strong&gt;: This will be green and say &lt;strong&gt;Logging&lt;/strong&gt;, signifying that logging is enabled.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Last log file delivered:&lt;/strong&gt; This should get updated very shortly after Trail creation. If you don't see a date/timestamp entry, refresh your browser.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Next, you will examine the contents of the Amazon S3 bucket.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Note&lt;/em&gt;: Until you see a date/time stamp for &lt;strong&gt;Last log file delivered&lt;/strong&gt;, you will not see any JSON files in the S3 bucket. Refresh your browser a few times over a 2-3 minute period before going to the next instruction. CloudTrail delivers logs approximately every 5 minutes.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;In the top-left, right-click the &lt;strong&gt;aws&lt;/strong&gt; icon and open a new browser tab.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;A new AWS Management Console page will load in the new browser tab.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;In the new browser tab, in the search bar at the top, enter &lt;em&gt;S3&lt;/em&gt;, and under &lt;strong&gt;Services&lt;/strong&gt;, click the &lt;strong&gt;S3&lt;/strong&gt; result:&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6azp2yc59722u0dcd0in.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6azp2yc59722u0dcd0in.png" alt=" " width="800" height="110"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;In the Buckets table, click the name of your CloudTrail bucket:&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2w47g38avxndh0ezhcqd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2w47g38avxndh0ezhcqd.png" alt=" " width="387" height="123"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Continue navigating down the folder &lt;strong&gt;prefix/&lt;/strong&gt; structure until you see one or more compressed CloudTrail log JSON files (ending with &lt;strong&gt;.json.gz&lt;/strong&gt;).&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;It may take a few minutes and browser refreshes before you can navigate further down the structure. Eventually, CloudTrail will transfer log files even with little to no use in the Console. (For example, DescribeTrails and ListBuckets events.) Five minutes is the longest you should have to wait.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fr6hbgk3bs0aov1kwlgd5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fr6hbgk3bs0aov1kwlgd5.png" alt=" " width="800" height="211"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Look at the name of a JSON log file and notice that the file naming convention includes:&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;The Account ID&lt;/li&gt;
&lt;li&gt;The text CloudTrail&lt;/li&gt;
&lt;li&gt;The region&lt;/li&gt;
&lt;li&gt;A date/time stamp&lt;/li&gt;
&lt;li&gt;A unique string (generated by AWS)&lt;/li&gt;
&lt;li&gt;A .json.gz file name extension (JSON file type, compressed via gzip)&lt;/li&gt;
&lt;li&gt;Return to the CloudTrail console and setup CloudTrail to publish logs into Athena.
15.1. Select the Event history option in the left-hand side menu:&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6077es3su690783klxdw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6077es3su690783klxdw.png" alt=" " width="240" height="196"&gt;&lt;/a&gt;&lt;br&gt;
15.2. In the Event history pane click on the Create Athena table button:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1b3trd3cn4u2m61sihd7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1b3trd3cn4u2m61sihd7.png" alt=" " width="800" height="127"&gt;&lt;/a&gt;&lt;br&gt;
15.3. In the Create a table in Amazon Athena pop-up pane, set the Storage location to use the CloudTrail S3 bucket created earlier:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fie6t2676jjzlszwnclfk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fie6t2676jjzlszwnclfk.png" alt=" " width="795" height="978"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;15.4. Click the &lt;strong&gt;Create table&lt;/strong&gt; button to complete the CloudTrail and Athena integration.&lt;/p&gt;

&lt;p&gt;15.5 Confirm that the CloudTrail and Athena integration were completed successfully:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fy9jgcv46css0fhvz0hqb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fy9jgcv46css0fhvz0hqb.png" alt=" " width="800" height="38"&gt;&lt;/a&gt;&lt;br&gt;
&lt;strong&gt;Summary&lt;/strong&gt;&lt;br&gt;
In this lab step, you learned how to set up CloudTrail to easily and quickly capture and log S3 and Lambda data plane AWS API calls. You then completed the CloudTrail set up by establishing a new Athena database table, configured to read over the newly established CloudTrail logs. Later on in the lab, you'll use Athena to query the data captured in the new CloudTrail logs.&lt;br&gt;
&lt;strong&gt;3. Create Lambda Function&lt;/strong&gt;&lt;br&gt;
In this lab step, you'll deploy a simple Lambda function representing the business process spoken of in the lab introduction. The Lambda function will be configured to use Python 3 for the runtime. The business process implemented within the Lambda function creates randomly named files which are then saved into the provided Business Data S3 bucket. The Lambda Function will be configured to use a pre-provisioned IAM Role that has a relaxed set of permissions for writing files into S3. In the next lab step you'll use Athena to query the CloudTrail logs, allowing you to observe the various AWS API calls collected as a result of the Lambda function's execution. This will inform you as to whether the Lambda's IAM Role can be improved in terms of the permission set associated with it.&lt;br&gt;
Instructions&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;In the AWS Management Console search bar, enter Lambda, and click the Lambda result under Services:&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frnqzeh54fg05nlp5ik6e.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frnqzeh54fg05nlp5ik6e.png" alt=" " width="800" height="338"&gt;&lt;/a&gt;&lt;br&gt;
You will be taken to the Functions list page:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcnml2vs88lr370a0cbrj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcnml2vs88lr370a0cbrj.png" alt=" " width="800" height="182"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;No AWS Lambda functions exist at the moment.&lt;/p&gt;

&lt;p&gt;2. Click &lt;strong&gt;Create a function&lt;/strong&gt; to start creating your first AWS Lambda function.&lt;/p&gt;

&lt;p&gt;3. In the &lt;strong&gt;Create function&lt;/strong&gt; wizard, ensure &lt;strong&gt;Author from scratch&lt;/strong&gt;is selected and enter the following values in the bottom form:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Name&lt;/strong&gt;: &lt;em&gt;BusinessWorkflow&lt;/em&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Runtime&lt;/strong&gt;: Python 3.9&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Permissions&lt;/strong&gt;: Click &lt;strong&gt;Change default execution role&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Execution Role&lt;/strong&gt;: Select &lt;strong&gt;Use an existing role&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Existing role&lt;/strong&gt;: Select the role beginning with &lt;strong&gt;LambdaExecutionRole1&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;ol&gt;
&lt;li&gt;Click &lt;strong&gt;Create function&lt;/strong&gt;.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;You are taken to the function's details page:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frq4l9g7uxabwb0lydxn5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frq4l9g7uxabwb0lydxn5.png" alt=" " width="800" height="261"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Scroll down to the Code source section, double-click the lambda_function.py file on the left, and overwrite the contents of the file with the following code:
&lt;code&gt;import boto3
from random import choice
from string import ascii_uppercase
def lambda_handler(event, context):
data = 'business data...'
encoded_data = data.encode("utf-8")
bucket_name = 'business-data-2668be00'
file_name = f"file.{''.join(choice(ascii_uppercase) for i in range(5))}.txt"
s3_path = "data/" + file_name
s3 = boto3.resource("s3")
s3.Bucket(bucket_name).put_object(Key=s3_path, Body=encoded_data)
return "Success"&lt;/code&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnhtbw6f16z6f248fbxyl.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnhtbw6f16z6f248fbxyl.png" alt=" " width="800" height="200"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Click &lt;strong&gt;Deploy&lt;/strong&gt; at the top to save and deploy the Lambda function.&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;Test&lt;/strong&gt; (next to &lt;strong&gt;Deploy&lt;/strong&gt;):&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9az6c5o06owtkii1p7er.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9az6c5o06owtkii1p7er.png" alt=" " width="302" height="119"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;In the &lt;strong&gt;Configure test event&lt;/strong&gt; form, set the Event name to be &lt;code&gt;BusinessDataTestEvent&lt;/code&gt;. Leave the remaining settings as their provided defaults and proceed by clicking &lt;strong&gt;Save&lt;/strong&gt;:&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;: In practice, the event body comes from SNS or whatever event source you configure. For now, you will just use Lambda's testing functionality to send in sample event data.&lt;/p&gt;

&lt;p&gt;9. The &lt;strong&gt;BusinessWorkflow&lt;/strong&gt; Lambda function is now ready to be executed. Click the &lt;strong&gt;Test&lt;/strong&gt; button (next to the &lt;strong&gt;Deploy&lt;/strong&gt; button) and wait for the execution results to be displayed.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F17kyw9u9emro7jmruzcn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F17kyw9u9emro7jmruzcn.png" alt=" " width="302" height="119"&gt;&lt;/a&gt;&lt;br&gt;
Within a few seconds, you will see the Execution results tab load in the editor.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5voz5lmdyy3yp30lpvyt.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5voz5lmdyy3yp30lpvyt.png" alt=" " width="800" height="154"&gt;&lt;/a&gt;&lt;br&gt;
The &lt;strong&gt;BusinessWorkflow&lt;/strong&gt; Lambda function when executed creates a new file and saves it into the &lt;strong&gt;business-data-xxxxxx&lt;/strong&gt; S3 bucket.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Repeat the same &lt;strong&gt;BusinessWorkflow&lt;/strong&gt; Lambda function execution by clicking the &lt;strong&gt;Test&lt;/strong&gt; button multiple times after each previous execution completes successfully.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Navigate to the &lt;a href="https://s3.console.aws.amazon.com/s3/buckets?region=us-west-2" rel="noopener noreferrer"&gt;S3 console, opens in a new tab&lt;/a&gt; and confirm the presence of the new business data files within the &lt;strong&gt;business-data-xxxxxx&lt;/strong&gt; bucket:&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fapfhcnhab325sy2nozq0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fapfhcnhab325sy2nozq0.png" alt=" " width="800" height="289"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  &lt;strong&gt;Summary&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;In this lab step, you deployed a Lambda function representing the business process spoken of in the lab introduction. The Lambda function was configured to use Python 3 for the runtime. The business process implemented within the Lambda function creates randomly named files which are then saved into the provided Business Data S3 bucket. You configured the Lambda Function with a pre-provisioned IAM Role that has a relaxed set of permissions for writing files into S3. In the next lab step, you'll use Athena to query the CloudTrail logs, allowing you to observe the various AWS API calls collected as a result of the Lambda function's execution. This will inform you as to whether the Lambda's IAM Role can be improved in terms of the permission set associated with it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. **Use Athena to Query CloudTrail Events&lt;/strong&gt;**&lt;/p&gt;
&lt;h3&gt;
  
  
  &lt;strong&gt;Introduction&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;In this lab step, you'll learn how to use Athena to query and analyze the CloudTrail logs that you configured earlier. In particular, you'll learn how to write Athena SQL queries that allow you to drill into the AWS API calls made by the deployed Lambda function. The Athena queries you execute will provide various insights into the AWS API calls, their origin, the event data associated with the call, and the date and time of the call - amongst many other attributes. Learning how to use Athena effectively to analyze CloudTrail log files can help to highlight IAM policies that are too permissible etc.&lt;/p&gt;
&lt;h3&gt;
  
  
  &lt;strong&gt;Instructions&lt;/strong&gt;
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;In the AWS Management Console search bar, enter &lt;em&gt;Athena&lt;/em&gt;, and click the &lt;strong&gt;Athena&lt;/strong&gt; result under &lt;strong&gt;Services&lt;/strong&gt;:&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fj5xfd7oo3rd1cigdzby9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fj5xfd7oo3rd1cigdzby9.png" alt=" " width="800" height="116"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;On the Athena landing page, click the &lt;strong&gt;Explore the query editor&lt;/strong&gt; button to open the &lt;strong&gt;Editor&lt;/strong&gt; view:&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4jev7c4f8l0bfvi20w2h.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4jev7c4f8l0bfvi20w2h.png" alt=" " width="335" height="318"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;If the Workgroup primary settings pane is shown, click the Acknowledge button to accept and close:&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbig0p1fwqdjzukr29oju.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbig0p1fwqdjzukr29oju.png" alt=" " width="800" height="105"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Change the Athena Query result location to use the lab provided S3 bucket.
4.1. Click on the Settings tab:&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fu3acy8w0irr4gpxu59u5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fu3acy8w0irr4gpxu59u5.png" alt=" " width="800" height="88"&gt;&lt;/a&gt;&lt;br&gt;
4.2. Click on the Manage button with the Settings tab:&lt;br&gt;
4.3. In the Manage settings section, set the Location of query result field to be:&lt;br&gt;
&lt;code&gt;s3://athena-query-results-2668be00/query-results&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fog4zcjonoefkdwxtuqmk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fog4zcjonoefkdwxtuqmk.png" alt=" " width="800" height="264"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;4.4. Click the Save button to apply the changes. Confirm that the new settings have been successfully applied:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Navigate back to the Editor tab by clicking on it. An empty Query 1 worksheet should be presented:&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhlcv81vhaya63hmkmrgu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhlcv81vhaya63hmkmrgu.png" alt=" " width="800" height="322"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;In the left menu Tables area, click over the&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fihzm4v7xrdhu6jgor4l2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fihzm4v7xrdhu6jgor4l2.png" alt=" " width="20" height="50"&gt;&lt;/a&gt;&lt;br&gt;
icon next to the cloudtrail_logs_aws_cloudtrail_logs_xxxxxx_xxxxxx table and and select the Preview Table option:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkkd31spvmol6ew6ges9i.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkkd31spvmol6ew6ges9i.png" alt=" " width="606" height="469"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Confirm that the &lt;strong&gt;Query 2&lt;/strong&gt; worksheet has been opened, and pre-populated with a SQL query that has been executed automatically. The &lt;strong&gt;Results&lt;/strong&gt; section should display the rows returned by the SQL query:&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;: CloudTrail sends new log files approximately every &lt;strong&gt;5 minutes&lt;/strong&gt; - there might be a delay before the new logging data arrives.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fq38n58dhu4lhk3k9ybl4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fq38n58dhu4lhk3k9ybl4.png" alt=" " width="800" height="297"&gt;&lt;/a&gt;&lt;br&gt;
8. Click the + icon to add a worksheet Query 3. In the new worksheet copy and paste the following SQL query and then click the Run button to execute:&lt;br&gt;
&lt;br&gt;
 &lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;SELECT
DISTINCT eventname
FROM "REPLACE_WITH_YOUR_CLOUDTRAIL_TABLE_NAME"
ORDER BY eventname; 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;&lt;strong&gt;Notes&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You need to update the &lt;strong&gt;REPLACE_WITH_YOUR_CLOUDTRAIL_TABLE_NAME&lt;/strong&gt; with the CloudTrail table name specific to your lab environment. This can be copied over from the query in the &lt;strong&gt;Query 2&lt;/strong&gt; worksheet.&lt;/li&gt;
&lt;li&gt;This SQL query displays and orders all distinct AWS API actions that have been collected so far.&lt;/li&gt;
&lt;li&gt;CloudTrail sends new log files approximately every &lt;strong&gt;5 minutes&lt;/strong&gt; - there might be a delay before the new logging data arrives.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fk1bvtt10mgcnw6a3lru0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fk1bvtt10mgcnw6a3lru0.png" alt=" " width="800" height="376"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;9. Click the + icon to add a worksheet Query 4. In the new worksheet copy and paste the following SQL query and then click the Run button to execute:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;SELECT
json_extract(json_parse(requestparameters), '$.bucketName') AS bucketName,
json_extract(json_parse(requestparameters), '$.key') AS bucketKey,
*
FROM "REPLACE_WITH_YOUR_CLOUDTRAIL_TABLE_NAME"
where eventname = 'PutObject'
AND eventsource = 's3.amazonaws.com'
AND CAST(json_extract(json_parse(requestparameters), '$.bucketName') AS VARCHAR) = 'business-data-2668be00' 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Notes&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You need to update the &lt;strong&gt;REPLACE_WITH_YOUR_CLOUDTRAIL_TABLE_NAME&lt;/strong&gt; with the CloudTrail table name specific to your lab environment. This can be copied over from the query in the &lt;strong&gt;Query 2&lt;/strong&gt; worksheet.&lt;/li&gt;
&lt;li&gt;This SQL query drills into the JSON data embedded within each row and pulls out the S3 bucket name and key for PutObject events on the Business Data s3 bucket (the bucket that the Lambda Function writes to).&lt;/li&gt;
&lt;li&gt;CloudTrail sends new log files approximately every &lt;strong&gt;5 minutes&lt;/strong&gt; - there might be a delay before the new logging data arrives.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsn66nswp4ks14k0cmfor.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsn66nswp4ks14k0cmfor.png" alt=" " width="800" height="370"&gt;&lt;/a&gt;&lt;br&gt;
10. Click the + icon to add a worksheet Query 5. In the new worksheet copy and paste the following SQL query and then click the Run button to execute:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;SELECT
json_extract(json_parse(requestparameters), '$.bucketName') AS bucketName,
json_extract(json_parse(requestparameters), '$.key') AS bucketKey,
useridentity.arn
FROM "REPLACE_WITH_YOUR_CLOUDTRAIL_TABLE_NAME"
where eventname = 'PutObject'
AND eventsource = 's3.amazonaws.com'
AND CAST(json_extract(json_parse(requestparameters), '$.bucketName') AS VARCHAR) = 'business-data-2668be00'
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Notes&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You need to update the &lt;strong&gt;REPLACE_WITH_YOUR_CLOUDTRAIL_TABLE_NAME&lt;/strong&gt; with the CloudTrail table name specific to your lab environment. This can be copied over from the query in the &lt;strong&gt;Query 2&lt;/strong&gt; worksheet.&lt;/li&gt;
&lt;li&gt;This SQL query drills into the JSON data embedded within each row and pulls out the S3 bucket name and key for PutObject events on the Business Data s3 bucket (the bucket that the Lambda Function writes to) - it also pulls out the ARN for the caller of the PutObject event.&lt;/li&gt;
&lt;li&gt;CloudTrail sends new log files approximately every &lt;strong&gt;5 minutes&lt;/strong&gt; - there might be a delay before the new logging data arrives.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsaemu2d8uztbuu7vkasi.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsaemu2d8uztbuu7vkasi.png" alt=" " width="800" height="381"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Summary&lt;/strong&gt;&lt;br&gt;
In this lab step, you learned how to use Athena to query and analyze CloudTrail logs stored in an S3 bucket. In particular, you learned how to write Athena SQL queries that allowed you to drill into the various AWS API calls made by the deployed Lambda function. The Athena queries you executed provided you with various insights into the AWS API calls, their origin, the event data associated with the call, and the date and time of the call - amongst many other attributes. Specifically, you were able to reveal detailed information about the S3 bucket name and the S3 bucket keys being used to store the business data files generated by the execution of the Lambda function.&lt;br&gt;
&lt;strong&gt;5. Review Full IAM Actions List&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;Introduction&lt;/strong&gt;&lt;br&gt;
When creating and refining IAM policies, it's useful to access all possible IAM actions in one place, such that you can quickly query and filter over them.&lt;br&gt;
In this lab step, you'll be shown how to easily gather all possible IAM actions from the AWS Policy Generator, opens in a new tab website into a single file which you can then filter over offline using utilities such as grep.&lt;br&gt;
&lt;strong&gt;Instructions&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Navigate to the Instances, opens in a new tab page, right-click the row of the instance beginning with ops, click Connect, and ensure ec2-user is set as the Username before clicking Connect:&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjypvpticlxkr8gncps4g.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjypvpticlxkr8gncps4g.png" alt=" " width="800" height="245"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Install the jq utility to support the parsing of JSON data: In the terminal execute the following command:
&lt;code&gt;sudo yum install -y jq&lt;/code&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fuz2hf8k8q5vwg1w78rzv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fuz2hf8k8q5vwg1w78rzv.png" alt=" " width="800" height="330"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Extract the full set of IAM policy actions from the awspolicygen.s3.amazonaws.com, opens in a new tab public website using curl , saving them into the file aws.iam.actions.txt locally. In the terminal execute the following command:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;curl --header 'Connection: keep-alive' \
--header 'Pragma: no-cache' \
--header 'Cache-Control: no-cache' \
--header 'Accept: */*' \
--header 'Referer: https://awspolicygen.s3.amazonaws.com/policygen.html' \
--header 'Accept-Language: en-US,en;q=0.9' \
--silent \
--compressed \
'https://awspolicygen.s3.amazonaws.com/js/policies.js' |
cut -d= -f2 |
jq -r '.serviceMap[] | .StringPrefix as $prefix | .Actions[] | "\($prefix):\(.)"' |
sort |
uniq &amp;gt; aws.iam.actions.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5whnupap35b07a0ety8t.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5whnupap35b07a0ety8t.png" alt=" " width="698" height="218"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Examine the count of all IAM actions stored in the aws.iam.actions.txt file. In the terminal execute the following command:
&lt;code&gt;cat aws.iam.actions.txt | wc -l&lt;/code&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffz64w5au9jmjyat559g9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffz64w5au9jmjyat559g9.png" alt=" " width="635" height="59"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;We now have access to all of the available IAM actions - let's perform an example search for all Lambda actions using grep. In the terminal execute the following command:
&lt;code&gt;grep ^lambda: aws.iam.actions.txt&lt;/code&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F946x8lc6b6k31opzx45e.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F946x8lc6b6k31opzx45e.png" alt=" " width="614" height="606"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Let's try another example - this time let's search for all Lambda and S3 Get actions using grep. In the terminal execute the following command:
&lt;code&gt;grep '^lambda:Get\|^s3:Get' aws.iam.actions.txt&lt;/code&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvqwyuso59k2bbhlifhyl.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvqwyuso59k2bbhlifhyl.png" alt=" " width="695" height="790"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Summary&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;In this lab step, you learned how to easily extract all possible IAM policy actions from the &lt;a href="https://awspolicygen.s3.amazonaws.com/policygen.html" rel="noopener noreferrer"&gt;AWS Policy Generator, opens in a new tab&lt;/a&gt; website and store them locally into a single file. You then used &lt;strong&gt;grep&lt;/strong&gt; to perform several searches to quickly find various IAM policy actions. Understanding how to navigate and quickly filter of the full set of IAM policy actions is useful when creating and updating IAM policies. In the next lab step, you'll take the insights gathered from the Athena queries and the techniques learned in this lab step to refine the deployed Lambda function's execution IAM role.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;6. **Review and Update Lambda Execution Role Policy&lt;/strong&gt;**&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Introduction&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;In this lab step, you'll leverage the insights that you derived from the Athena SQL queries earlier performed over the collected CloudTrail log files to update the existing IAM Role policy assigned to the &lt;strong&gt;BusinessWorkflow&lt;/strong&gt; Lambda function.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;: For security reasons, the lab platform prevents you from creating or modifying custom IAM policies, therefore a second IAM Role (with updated policy) has already been created for you for the purposes of completing this lab.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Instructions&lt;/strong&gt;
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;In the AWS Management Console search bar, enter &lt;em&gt;IAM&lt;/em&gt;, and click the &lt;strong&gt;IAM&lt;/strong&gt; result under &lt;strong&gt;Services&lt;/strong&gt;:&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1ztvmojse945vf44s3so.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1ztvmojse945vf44s3so.png" alt=" " width="800" height="109"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Ignore all permission warnings on the &lt;strong&gt;IAM dashboard&lt;/strong&gt; page (the lab is a controlled environment and many IAM operations are purposely blocked).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Under the left-hand side &lt;strong&gt;Access management&lt;/strong&gt; menu, click the &lt;strong&gt;Roles&lt;/strong&gt; link:&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftajxouxhi9xw0xs8ujli.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftajxouxhi9xw0xs8ujli.png" alt=" " width="268" height="379"&gt;&lt;/a&gt;&lt;br&gt;
4. In the &lt;strong&gt;Roles&lt;/strong&gt; search field, search for &lt;code&gt;*LambdaExecution*&lt;/code&gt;. The search results should contain 2 roles, &lt;code&gt;LambdaExecutionRole1-xxxxxx&lt;/code&gt; and &lt;code&gt;ambdaExecutionRole2-xxxxxx&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;4.1. The deployed Lambda function is currently configured to execute with the first of the 2 roles. Open the &lt;code&gt;LambdaExecutionRole1-xxxxxx&lt;/code&gt; role in a new browser tab and expand the attached &lt;code&gt;S3BucketBusinessData1&lt;/code&gt; inline policy to view its permissions:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhnmzb19b12jpxmka8bjn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhnmzb19b12jpxmka8bjn.png" alt=" " width="800" height="322"&gt;&lt;/a&gt;&lt;br&gt;
4.2. Open the second role cloudacademylabs-LambdaExecutionRole2-xxxxxx role in a new browser tab and expand the attached S3BucketBusinessData2 inline policy to view its permissions. This IAM Role and Policy represents the updates that you as the security reviewer would have created in response to the insights you derived from the Athena SQL queries you previously executed. This IAM Role has been created for you (since the lab platform prevents you from creating/modifying policies). &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjz7ktndhpcvs8aucqqvh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjz7ktndhpcvs8aucqqvh.png" alt=" " width="800" height="398"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;5. Modify the existing &lt;strong&gt;BusinessWorkflow&lt;/strong&gt;Lambda function to use the updated IAM Role (&lt;code&gt;LambdaExecutionRole2-xxxxxx)&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;5.1. Return to the Lambda console and navigate to the &lt;strong&gt;BusinessWorkflow&lt;/strong&gt; Lambda function. Click on the &lt;strong&gt;Configuration&lt;/strong&gt; tab and select the &lt;strong&gt;Permissions&lt;/strong&gt; option:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ff2rqb4sxohnl3m69kek7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ff2rqb4sxohnl3m69kek7.png" alt=" " width="800" height="183"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;5.2. Within the &lt;strong&gt;Execution role&lt;/strong&gt; pane click the &lt;strong&gt;Edit&lt;/strong&gt; button. This will display the &lt;strong&gt;Basic settings&lt;/strong&gt; view for the Lambda function. Under the &lt;strong&gt;Existing role&lt;/strong&gt; option, click the drop-down and select the alternate second role (&lt;code&gt;LambdaExecutionRole2-xxxxxx).&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;5.3 Click the &lt;strong&gt;Save&lt;/strong&gt; to apply the Lambda function's Execution IAM Role change.&lt;/p&gt;

&lt;p&gt;6. The &lt;strong&gt;BusinessWorkflow&lt;/strong&gt; Lambda function is now ready to be executed again with a more secure IAM Role for performing &lt;code&gt;s3:*&lt;/code&gt; operations on a narrower set of buckets. Confirm that the &lt;strong&gt;BusinessWorkflow&lt;/strong&gt; Lambda function remains fully functional. Return to the &lt;strong&gt;Code&lt;/strong&gt; tab, and then click the &lt;strong&gt;Test&lt;/strong&gt; button multiple times (next to the &lt;strong&gt;Deploy&lt;/strong&gt; button) and wait for the execution results to be displayed each time.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F39zens37c4j97yofutss.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F39zens37c4j97yofutss.png" alt=" " width="246" height="106"&gt;&lt;/a&gt;&lt;br&gt;
Within a few seconds, you will see the &lt;strong&gt;Execution results&lt;/strong&gt; tab load in the editor:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Return to the S3 console and navigate to the &lt;strong&gt;business-data-2668be00&lt;/strong&gt; S3 bucket and navigate into the &lt;strong&gt;data&lt;/strong&gt; folder. Confirm that the updated Lambda function has successfully been able to write into the configured S3 bucket:&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;8. &lt;strong&gt;Bonus step&lt;/strong&gt; - Return to the Athena console and execute the following SQL query to confirm the presence of new logging data:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Notes&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You need to update the &lt;strong&gt;REPLACE_WITH_YOUR_CLOUDTRAIL_TABLE_NAME&lt;/strong&gt; with the CloudTrail table name specific to your lab environment. This can be copied over from the query in the &lt;strong&gt;Query 2&lt;/strong&gt; worksheet.&lt;/li&gt;
&lt;li&gt;CloudTrail sends new log files approximately every &lt;strong&gt;5 minutes&lt;/strong&gt; - there might be a delay before the new logging data arrives.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;SELECT
json_extract(json_parse(requestparameters), '$.bucketName') AS bucketName,
json_extract(json_parse(requestparameters), '$.key') AS bucketKey,
eventtime,
useridentity.arn,
*
FROM "REPLACE_WITH_YOUR_CLOUDTRAIL_TABLE_NAME"
where eventname = 'PutObject'
AND eventsource = 's3.amazonaws.com'
AND CAST(json_extract(json_parse(requestparameters), '$.bucketName') AS VARCHAR) = 'business-data-2668be00'
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F06o2rw6b36bnjhcwf3le.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F06o2rw6b36bnjhcwf3le.png" alt=" " width="800" height="359"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Summary&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;In this lab step, you completed the IAM Role policy security review, applying the insights derived from the Athena SQL queries previously evaluated over the collected CloudTrail data. You then confirmed the &lt;strong&gt;BusinessWorkflow&lt;/strong&gt; Lambda function remained functional after the improved least privilege security updates had been applied.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Conclusion&lt;/strong&gt;&lt;br&gt;
This lab demonstrated a comprehensive, evidence-based approach to implementing IAM least privilege security policies for AWS Lambda functions through systematic API activity analysis. By establishing a robust observability pipeline using CloudTrail and Athena, you successfully transformed broad, permissive IAM policies into narrowly scoped, security-hardened permissions that precisely match actual operational requirements.&lt;br&gt;
&lt;strong&gt;Technical Achievements and Key Outcomes&lt;/strong&gt;&lt;br&gt;
Throughout this lab scenario, you accomplished several critical security engineering objectives:&lt;br&gt;
&lt;strong&gt;1. Established Comprehensive AWS API Auditing Infrastructure&lt;/strong&gt;&lt;br&gt;
You configured CloudTrail to capture Lambda and S3 data plane events, creating a continuous audit trail of all API operations. This logging infrastructure serves dual purposes: immediate security analysis and long-term compliance auditing. The integration with Athena transformed raw CloudTrail logs into a queryable dataset, enabling SQL-based forensic analysis of AWS API activity. This architecture provides the foundation for ongoing security monitoring, incident investigation, and compliance reporting required in production environments.&lt;br&gt;
&lt;strong&gt;2. Implemented Data-Driven Security Policy Analysis&lt;/strong&gt;&lt;br&gt;
Rather than relying on assumptions or documentation, you employed empirical analysis to understand the Lambda function's actual AWS API usage patterns. The Athena SQL queries you executed revealed precise details about:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Specific S3 operations performed (PutObject)&lt;/li&gt;
&lt;li&gt;Target bucket names and object keys&lt;/li&gt;
&lt;li&gt;Identity and ARN of the calling principal&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Temporal patterns of API invocations&lt;br&gt;
This data-driven methodology eliminates guesswork from IAM policy creation and ensures policies are based on observed behavior rather than projected requirements.&lt;br&gt;
&lt;strong&gt;3. Applied Least Privilege Security Principles&lt;/strong&gt;&lt;br&gt;
The transition from LambdaExecutionRole1 to LambdaExecutionRole2 exemplifies the principle of least privilege in practice. The initial policy granted overly broad S3 permissions (s3:* on * or multiple buckets), creating unnecessary attack surface and violating security best practices. Through CloudTrail analysis, you identified that the Lambda function required only s3:PutObject permissions on a single specific bucket (business-data-2668be00) within a specific prefix (data/*). This reduction in permission scope significantly minimizes:&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Blast radius of potential security breaches or compromised credentials&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Lateral movement opportunities for attackers&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Accidental data exposure or modification risks&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Compliance audit findings related to excessive permissions&lt;br&gt;
&lt;strong&gt;4. Validated Functional Equivalence Post-Hardening&lt;/strong&gt;&lt;br&gt;
A critical aspect of security hardening is ensuring operational continuity. You verified that the Lambda function maintained full functionality after the IAM policy restrictions were applied, demonstrating that security improvements need not compromise business operations. This validation step is essential in production environments where availability and reliability requirements must be balanced with security controls.&lt;br&gt;
&lt;strong&gt;Security and Compliance Benefits&lt;/strong&gt;&lt;br&gt;
The methodologies practiced in this lab deliver substantial security and compliance advantages in production AWS environments:&lt;br&gt;
&lt;strong&gt;Enhanced Security Posture:&lt;/strong&gt; By restricting IAM permissions to only those actions and resources demonstrably required, you reduce the attack surface available to malicious actors. If credentials were compromised or the Lambda function contained a vulnerability, the restricted permissions limit what an attacker could access or modify.&lt;br&gt;
&lt;strong&gt;Improved Compliance Readiness:&lt;/strong&gt; Many regulatory frameworks (PCI-DSS, HIPAA, SOC 2, ISO 27001) mandate least privilege access controls. The CloudTrail audit trail provides evidence of API activity for compliance audits, while the refined IAM policies demonstrate adherence to access control requirements.&lt;br&gt;
&lt;strong&gt;Operational Transparency:&lt;/strong&gt; The CloudTrail and Athena pipeline provides complete visibility into Lambda function behavior, enabling security teams to detect anomalies, investigate incidents, and generate compliance reports without requiring access to application logs or code.&lt;br&gt;
&lt;strong&gt;Defense in Depth:&lt;/strong&gt; This approach adds multiple security layers—restrictive IAM policies, comprehensive logging, and queryable audit trails—creating resilience against various attack vectors and failure modes.&lt;br&gt;
&lt;strong&gt;Architectural Patterns and Best Practices&lt;/strong&gt;&lt;br&gt;
This lab reinforced several AWS security architecture patterns applicable to production environments:&lt;br&gt;
Separation of Data and Management Planes: By configuring CloudTrail to capture data events (actual S3 and Lambda operations) rather than only management events (AWS Console or API configuration changes), you gained visibility into the runtime behavior of your application, not just its configuration.&lt;br&gt;
&lt;strong&gt;Infrastructure as Code Considerations:&lt;/strong&gt; In production environments, the IAM role refinement process demonstrated here should be codified in Infrastructure as Code (IaC) tools such as AWS CloudFormation, Terraform, or AWS CDK. This ensures IAM policies remain under version control and can be reviewed, tested, and deployed through CI/CD pipelines.&lt;br&gt;
&lt;strong&gt;Iterative Security Hardening:&lt;/strong&gt; The workflow established—deploy with initial permissions, observe actual behavior, refine policies, validate functionality—represents an iterative security improvement cycle. This pattern should be applied continuously as application requirements evolve, ensuring IAM policies remain aligned with actual operational needs.&lt;br&gt;
&lt;strong&gt;Automated Policy Analysis:&lt;/strong&gt; While this lab used manual Athena queries, production environments can benefit from automated analysis using AWS services like Amazon Detective, AWS Security Hub, or custom Lambda functions that periodically analyze CloudTrail data and recommend IAM policy optimizations.&lt;br&gt;
&lt;strong&gt;Ongoing Security Considerations&lt;/strong&gt;&lt;br&gt;
Implementing least privilege IAM policies is not a one-time activity but an ongoing security practice:&lt;br&gt;
&lt;strong&gt;Policy Drift Detection:&lt;/strong&gt; As application functionality evolves, IAM policies must be reviewed and updated. Regular CloudTrail analysis can identify when Lambda functions begin making API calls not covered by their current policies, signaling either unauthorized activity or the need for policy updates.&lt;br&gt;
&lt;strong&gt;Access Denial Monitoring:&lt;/strong&gt; CloudTrail logs capture both successful and denied API calls. Monitoring for AccessDenied errors can reveal either overly restrictive policies that impede legitimate functionality or potential reconnaissance activities by attackers testing permission boundaries.&lt;br&gt;
&lt;strong&gt;Cross-Account and Cross-Service Analysis:&lt;/strong&gt; In complex AWS environments, Lambda functions may interact with resources across multiple AWS accounts or services. The CloudTrail and Athena analysis techniques demonstrated here can be extended to include cross-account trails and multi-service API analysis, providing comprehensive visibility into distributed application behavior.&lt;br&gt;
&lt;strong&gt;Automated Remediation:&lt;/strong&gt; Advanced implementations can use AWS services like AWS Config Rules, AWS Lambda, and Amazon EventBridge to automatically detect IAM policy violations and either alert security teams or automatically apply corrective actions.&lt;br&gt;
&lt;strong&gt;Scalability and Production Considerations&lt;/strong&gt;&lt;br&gt;
When implementing this approach at scale in production environments, consider:&lt;br&gt;
&lt;strong&gt;CloudTrail Log Volume Management:&lt;/strong&gt; Data events generate significantly higher log volumes than management events. Implement S3 lifecycle policies to archive older logs to lower-cost storage tiers (S3 Glacier) while maintaining recent logs in S3 Standard for Athena queries.&lt;br&gt;
&lt;strong&gt;Athena Query Optimization:&lt;/strong&gt; For large-scale deployments, partition CloudTrail logs by date, region, and service to improve Athena query performance and reduce costs. Use table partitioning and predicate pushdown in SQL queries to minimize data scanned.&lt;br&gt;
&lt;strong&gt;Cost Management:&lt;/strong&gt; CloudTrail data events incur per-event charges. Carefully scope CloudTrail configuration to capture only the events required for security analysis rather than all possible data events across all services.&lt;br&gt;
&lt;strong&gt;Integration with SIEM and Security Tools:&lt;/strong&gt; CloudTrail logs should be integrated with Security Information and Event Management (SIEM) systems, AWS Security Hub, or third-party security platforms to enable real-time threat detection and automated incident response.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>awscommunitybuilder</category>
      <category>aws</category>
      <category>iam</category>
      <category>amazonathena</category>
    </item>
    <item>
      <title>Becoming an AWS Community Builder</title>
      <dc:creator>Wilklins Nyatteng</dc:creator>
      <pubDate>Wed, 25 Dec 2024 04:47:47 +0000</pubDate>
      <link>https://forem.com/aws-builders/becoming-an-aws-community-builder-3je3</link>
      <guid>https://forem.com/aws-builders/becoming-an-aws-community-builder-3je3</guid>
      <description>&lt;p&gt;Becoming an AWS Community Builder is an exciting opportunity for professionals who are passionate about cloud computing and want to share their knowledge and expertise with others. Whether you're interested in security and identity like me or any other area of AWS, being a Community Builder allows you to contribute to the AWS community, collaborate with like-minded individuals, and help others on their cloud journey. In this article, we'll explore the steps to becoming an AWS Community Builder and provide valuable advice to those who aspire to join the program.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Understanding the AWS Community Builder Program:&lt;/strong&gt;&lt;br&gt;
The first step is to familiarize yourself with the AWS Community Builder Program. Visit the official AWS Community Builder website &lt;a href="https://aws.amazon.com/developer/community/community-builders/" rel="noopener noreferrer"&gt;https://aws.amazon.com/developer/community/community-builders/&lt;/a&gt; to learn about its objectives, benefits, and the responsibilities associated with the role. Gain a clear understanding of what it means to be a Community Builder and the expectations that come with it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Develop Your AWS Expertise:&lt;/strong&gt;&lt;br&gt;
It's crucial to have an understanding of AWS services, features, and best practices. Continue expanding your knowledge by exploring the extensive AWS documentation &lt;a href="https://docs.aws.amazon.com/" rel="noopener noreferrer"&gt;https://docs.aws.amazon.com/&lt;/a&gt; and studying relevant whitepapers &lt;a href="https://aws.amazon.com/whitepapers/" rel="noopener noreferrer"&gt;https://aws.amazon.com/whitepapers/&lt;/a&gt;. Consider pursuing AWS certifications to showcase your expertise and commitment to AWS. The AWS Training and Certification website &lt;a href="https://aws.amazon.com/training/" rel="noopener noreferrer"&gt;https://aws.amazon.com/training/&lt;/a&gt; offers a comprehensive range of resources and courses to help you prepare for certification exams.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Engage with the AWS Community:&lt;/strong&gt;&lt;br&gt;
Active engagement within the AWS community is essential for becoming a Community Builder. Start by attending local AWS user groups, meetups, and events. Participate in online forums, such as the AWS Developer Forums (&lt;a href="https://forums.aws.amazon.com/index.jspa" rel="noopener noreferrer"&gt;https://forums.aws.amazon.com/index.jspa&lt;/a&gt;), Reddit's /r/aws subreddit (&lt;a href="https://www.reddit.com/r/aws/" rel="noopener noreferrer"&gt;https://www.reddit.com/r/aws/&lt;/a&gt;), and the AWS Community Forum (&lt;a href="https://forums.aws.amazon.com/forum.jspa?forumID=30" rel="noopener noreferrer"&gt;https://forums.aws.amazon.com/forum.jspa?forumID=30&lt;/a&gt;), where you can contribute to discussions, ask questions, and provide solutions to fellow community members.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. Share Your Knowledge:&lt;/strong&gt;&lt;br&gt;
Demonstrate your expertise and passion for AWS by sharing your knowledge through blog posts, tutorials, or video content. Publish your content on platforms like Medium (&lt;a href="https://medium.com/" rel="noopener noreferrer"&gt;https://medium.com/&lt;/a&gt;), Dev.to (&lt;a href="https://dev.to/"&gt;https://dev.to/&lt;/a&gt;), or your personal website. Leverage social media platforms like Twitter and LinkedIn to share your content and engage with the AWS community. Consider writing guest articles for established AWS-focused blogs and publications to increase your visibility.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;5. Contribute to Open Source Projects:&lt;/strong&gt;&lt;br&gt;
Engaging with open source projects related to AWS can be an excellent way to showcase your skills and demonstrate your commitment to the community. Explore projects on GitHub (&lt;a href="https://github.com/topics/aws" rel="noopener noreferrer"&gt;https://github.com/topics/aws&lt;/a&gt;) and actively contribute by submitting pull requests, opening issues, or creating your own projects. Collaborating with other developers on open source projects can help you establish yourself as an active and valuable member of the community.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Apply to Become an AWS Community Builder:
Once you have developed a strong AWS skill set, actively engaged with the community, and shared your knowledge, it's time to apply to become an AWS Community Builder. Visit the AWS Community Builder website (&lt;a href="https://aws.amazon.com/developer/community/community-builders/" rel="noopener noreferrer"&gt;https://aws.amazon.com/developer/community/community-builders/&lt;/a&gt;) and follow the instructions provided to submit your application. Be prepared to showcase your contributions, share your experiences, and explain how you plan to contribute to the AWS community as a Community Builder.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Conclusion&lt;/strong&gt;&lt;br&gt;
Becoming an AWS Community Builder is an exciting journey that allows you to connect with a vibrant community of cloud professionals, share your expertise, and contribute to the growth of AWS. By following the steps outlined in this article, including understanding the program, developing your AWS skills, engaging with the community, sharing your knowledge, contributing to open source projects, and applying to become a Community Builder, you can position yourself as a valuable member of the AWS community and make a meaningful impact on the cloud computing industry.&lt;/p&gt;

&lt;p&gt;REMEMBER, the AWS Community Builder Program is not limited to security and identity—it encompasses various areas of AWS expertise. Adapt the steps mentioned here to align with your specific interests and specialization. Good luck on your journey to becoming an AWS Community Builder!&lt;/p&gt;

</description>
      <category>awscommunitybuilder</category>
      <category>awscommunity</category>
    </item>
    <item>
      <title>IAM for Amazon ECS on AWS Fargate</title>
      <dc:creator>Wilklins Nyatteng</dc:creator>
      <pubDate>Thu, 29 Aug 2024 10:37:00 +0000</pubDate>
      <link>https://forem.com/aws-builders/iam-for-amazon-ecs-on-aws-fargate-2bk8</link>
      <guid>https://forem.com/aws-builders/iam-for-amazon-ecs-on-aws-fargate-2bk8</guid>
      <description>&lt;p&gt;AWS Identity and Access Management (IAM) helps you securely control access to AWS resources, and Amazon ECS is no exception. IAM controls what can access ECS resources in your AWS accounts. IAM also controls which AWS resources ECS and tasks running in ECS can access. This will be the focus of this lab.&lt;/p&gt;

&lt;p&gt;Two types of IAM roles are used by ECS:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;ECS task execution role: This role is used by the ECS agent to pull container images and send logs to CloudWatch.&lt;/li&gt;
&lt;li&gt;ECS task role: This role is used by the containers to access other AWS services they depend on at runtime.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;In this lab, you will learn about the ECS IAM roles first-hand and diagnose and troubleshoot related issues.&lt;/p&gt;

&lt;h3&gt;
  
  
  Learning objectives
&lt;/h3&gt;

&lt;p&gt;Upon completion, you will be able to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Explain ECS task execution roles and task roles&lt;/li&gt;
&lt;li&gt;Diagnose and debug IAM issues in ECS&lt;/li&gt;
&lt;li&gt;Resolve IAM issues in ECS running&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Prerequisites
&lt;/h3&gt;

&lt;p&gt;Familiarity with the following topics is required to get the most out of this lab:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;AWS Identity and Access Management (IAM) fundamentals (roles and policies)&lt;/li&gt;
&lt;li&gt;Amazon Elastic Container Service (ECS) on AWS Fargate fundamentals&lt;/li&gt;
&lt;li&gt;Terraform fundamentals, with experience deploying on AWS&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Environment Before&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;ECS cluster that resembles the following diagram.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcn0rlziaq0bgdoczyrb0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcn0rlziaq0bgdoczyrb0.png" alt=" " width="745" height="470"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The ECS cluster contains three services that run a stock charting application:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Frontend: React frontend that displays stock charts.&lt;/li&gt;
&lt;li&gt;API: RESTful API that provides stock data. The API is written in Java and uses the Spring Boot framework.&lt;/li&gt;
&lt;li&gt;Database: Persistence layer for (simulated) stock data. It is not usually advisable to run a database in a container, but for this lab, it is used to reduce the time needed to provision the lab compared to using RDS.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Each service has an auto-scaling group that maintains a desired task count of containers.&lt;/p&gt;

&lt;p&gt;The frontend and API services sit in public subnets behind a public-facing application load balancer (ALB), while the database service resides in a private subnet behind an internal-facing ALB. To access the application, you can navigate to the following ALB public URL once the lab has been setup completely.&lt;/p&gt;

&lt;p&gt;The application works fine, but a new feature is being developed that requires the API service to have access to S3. The initial code checks if a given S3 bucket exists and creates it if not. This will be the focus of your investigation into IAM in ECS.&lt;/p&gt;

&lt;p&gt;These ECS resources are deployed using Terraform. This lab step will briefly highlight the resource configurations and Java application code related to IAM and will be referenced throughout this lab.&lt;/p&gt;

&lt;p&gt;Reviewing the Sample Application Deployed on Amazon ECS With AWS Fargate&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Instructions&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;I opened the lab’s development environment then launched the &lt;strong&gt;template.tf&lt;/strong&gt; file  in the editor&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Abbreviated template emphasizing IAM resources

resource "aws_ecs_cluster" "ecs_cluster" {
  name = "lab-cluster"
}

resource "aws_ecs_task_definition" "api_task_definition" {
  family                   = "lab-api"
  execution_role_arn       = aws_iam_role.ecs_task_execution_role.arn
  task_role_arn            = aws_iam_role.ecs_task_role.arn
  requires_compatibilities = ["FARGATE"]
  network_mode             = "awsvpc"
  ...

  container_definitions = jsonencode([
    {
      ...
      environment = [
        { name = "BUCKET_NAME", value = "lab-experimental-${data.aws_caller_identity.current.id}" } # e.g. lab-experimental-123456789012
      ]
      ...
    }
  ])
}

# IAM

data "aws_iam_policy_document" "assume_role_policy" {
  statement {
    actions = ["sts:AssumeRole"]

    principals {
      type        = "Service"
      identifiers = ["ecs-tasks.amazonaws.com"]
    }
  }
}

data "aws_iam_policy_document" "ecs_task_policy" {
  statement {
    effect = "Allow"
    resources = [
      "arn:aws:s3:::${local.bucket_name}",
    ]
    actions = [
      "s3:GetBucketAcl",
    ]
  }
}

data "aws_iam_policy_document" "ecs_task_create_bucket_policy" {
  statement {
    effect = "Allow"
    resources = [
      "arn:aws:s3:::${local.bucket_name}",
    ]
    actions = [
      "s3:CreateBucket",
    ]
  }
}

resource "aws_iam_role" "ecs_task_execution_role" {
  name               = "lab-ecs-task-execution-role"
  assume_role_policy = data.aws_iam_policy_document.assume_role_policy.json
}

resource "aws_iam_role" "ecs_task_role" {
  name               = "lab-ecs-task-role"
  assume_role_policy = data.aws_iam_policy_document.assume_role_policy.json

  inline_policy {
    name   = "task-role-policy"
    policy = data.aws_iam_policy_document.ecs_task_policy.json
  }
}

resource "aws_iam_role_policy_attachment" "ecs_task_execution_role_policy" {
  role       = aws_iam_role.ecs_task_execution_role.name
  policy_arn = "arn:aws:iam::aws:policy/service-role/AmazonECSTaskExecutionRolePolicy"
}

resource "aws_iam_policy" "ecs_task_create_bucket_policy" {
  name        = "lab-ecs-s3-task-policy"
  description = "Allows S3 actions for ECS tasks"
  policy      = data.aws_iam_policy_document.ecs_task_create_bucket_policy.json
}

...
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To get an overview of the relevant Terraform resource configurations:&lt;/p&gt;

&lt;p&gt;Starting with the &lt;code&gt;aws_ecs_task_definition.api_task_definition&lt;/code&gt; on line 7, the two arguments for configuring the roles are &lt;code&gt;execution_role_arn&lt;/code&gt; and &lt;code&gt;task_role_arn&lt;/code&gt;:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftgauzg6r57xq3j62g78a.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftgauzg6r57xq3j62g78a.png" alt=" " width="800" height="94"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;task_role_arn&lt;/code&gt; provides the task's containers access to other AWS services. The &lt;code&gt;execution_role_arn&lt;/code&gt; is used by the ECS container agent to pull container images from ECR and send logs to CloudWatch.&lt;/p&gt;

&lt;p&gt;On line 19, an environment variable is set to configure the name of the S3 bucket that the API service will use:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmj1lkwv6tw7alhukknrr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmj1lkwv6tw7alhukknrr.png" alt=" " width="800" height="16"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The assume role policy, or trust policy, for both task execution and task roles, is configured beginning on line 28:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flbpqw3eq89ev077u4o50.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flbpqw3eq89ev077u4o50.png" alt=" " width="733" height="169"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Feju1qro0w5rhhvafq1f0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Feju1qro0w5rhhvafq1f0.png" alt=" " width="733" height="169"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The trust policy allows the ECS service to assume the role. Notice that both types or roles are assumed by the &lt;code&gt;ecs-tasks.amazonaws.com&lt;/code&gt; service principal, so only one trust policy is needed.&lt;/p&gt;

&lt;p&gt;Below that, from lines 39-61, are two data IAM policy document sources that store simple single-action policy statements for S3:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxmmwl1fjr0o6bejod78k.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxmmwl1fjr0o6bejod78k.png" alt=" " width="765" height="601"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fq8th1825bxx9ozcxm8x9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fq8th1825bxx9ozcxm8x9.png" alt=" " width="765" height="601"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;ecs_task_policy&lt;/code&gt; grants the &lt;code&gt;s3:GetBucketAcl&lt;/code&gt; action on the API's S3 bucket while the &lt;code&gt;ecs_task_create_bucket_policy&lt;/code&gt; grants &lt;code&gt;s3:CreateBucket&lt;/code&gt;. These two policies allow checking if a bucket exists and creating it if not.&lt;/p&gt;

&lt;p&gt;The task execution role (&lt;code&gt;ecs_task_execution_role&lt;/code&gt;) and task role (&lt;code&gt;ecs_task_role&lt;/code&gt;) are configured on lines 63-76, respectively:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsk8f63eisrqtvjqets5k.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsk8f63eisrqtvjqets5k.png" alt=" " width="800" height="275"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Both roles configure the same trust policy with the &lt;code&gt;assume_role_policy&lt;/code&gt; argument. The &lt;code&gt;ecs_task_role&lt;/code&gt; also has an &lt;code&gt;inline_policy&lt;/code&gt; argument referencing the &lt;code&gt;ecs_task_policy&lt;/code&gt; data source. This policy grants the API service initial access to check if S3 buckets exist.&lt;/p&gt;

&lt;p&gt;On lines 78-81, the task execution role has an AWS-managed policy attached to it:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fr8egzbjsds9ix155y27y.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fr8egzbjsds9ix155y27y.png" alt=" " width="800" height="76"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This policy grants the ECS container agent access to pull container images from ECR and send logs to CloudWatch. You can view the &lt;a href="https://us-east-1.console.aws.amazon.com/iamv2/home?region=us-west-2#/policies/details/arn%3Aaws%3Aiam%3A%3Aaws%3Apolicy%2Fservice-role%2FAmazonECSTaskExecutionRolePolicy?section=policy_permissions" rel="noopener noreferrer"&gt;AWS-managed AmazonECSTaskExecutionRolePolicy here&lt;/a&gt;. AWS-managed policies are a convenient way to grant common permissions to a role, but you should use them with caution in production where least-privilege policies are preferred. For example, you may want to specify a specific ECR registry where container images are allowed to be pulled.&lt;/p&gt;

&lt;p&gt;Lastly, a custom IAM policy is created using the &lt;code&gt;ecs_task_create_bucket_policy&lt;/code&gt; data source policy document for use later on in the lab:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fesz3308ihmin6up78xp3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fesz3308ihmin6up78xp3.png" alt=" " width="800" height="102"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Next we check the java file to view the relevant source code for accessing S3&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;package com.cloudacademy.stocks.utils;

import com.amazonaws.services.s3.AmazonS3;
import com.amazonaws.services.s3.model.AmazonS3Exception;
import com.amazonaws.services.s3.model.Bucket;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class S3Initializer {

    private final AmazonS3 amazonS3;

    @Autowired
    public S3Initializer(AmazonS3 amazonS3) {
        this.amazonS3 = amazonS3;
    }

    public void init(String bucketName) {
        while (true) {
            try {
                try {
                    if (!amazonS3.doesBucketExistV2(bucketName)) {
                        Bucket bucket = amazonS3.createBucket(bucketName);
                        System.out.println("Bucket created: " + bucketName);
                        break;
                    } else {
                        System.out.println("Bucket already exists: " + bucketName);
                        break;
                    }
                } catch (AmazonS3Exception e) {
                    System.err.println("Error creating bucket: " + e.getMessage());
                } 
                Thread.sleep(5000);
            } catch (InterruptedException ex) {
                Thread.currentThread().interrupt();
                System.err.println("Thread interrupted");
            }
        }
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;The application uses the aws-java-sdk-s3 library to interact with S3&lt;/li&gt;
&lt;li&gt;The &lt;code&gt;init&lt;/code&gt; method checks if the S3 bucket exists (line 24) and creates it if not (line 25)

&lt;ul&gt;
&lt;li&gt;The process is repeated every 5 seconds until the bucket is created 
or found to exist. This ensures a steady stream of log error 
messages if there are any IAM permission issues.&lt;/li&gt;
&lt;li&gt;The &lt;code&gt;doesBucketExistV2&lt;/code&gt; uses the getBucketAcl API action as seen in the &lt;a href="https://github.com/aws/aws-sdk-java/blob/50e666cd4838afaed318954a23193acc09c5c74c/aws-java-sdk-s3/src/main/java/com/amazonaws/services/s3/AmazonS3Client.java#L1407" rel="noopener noreferrer"&gt;aws-java-sdk source code on GitHub&lt;/a&gt; and also explained in the &lt;a href="https://docs.aws.amazon.com/AWSJavaSDK/latest/javadoc/com/amazonaws/services/s3/AmazonS3.html#doesBucketExistV2-java.lang.String-" rel="noopener noreferrer"&gt;AWS SDK for Java API Reference&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;p&gt;In practice, it may be preferred to create the bucket using Terraform. However, this application code is a convenient way to demonstrate IAM concepts in ECS on Fargate.&lt;/p&gt;

&lt;p&gt;Up next, you will configure AWS credentials in this IDE's terminal to provide access to the AWS CLI used in the next lab step.&lt;/p&gt;

&lt;p&gt;So we configure  the AWS CLI:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;aws configure set aws_access_key_id {REDACTED} &amp;amp;&amp;amp;
aws configure set aws_secret_access_key {REDACTED} &amp;amp;&amp;amp;
aws configure set default.region us-west-2
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Detecting the Task's IAM Issue&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A solid understanding of the differences between the task execution role and task role is essential to understanding the IAM issue in ECS.&lt;/p&gt;

&lt;p&gt;The &lt;em&gt;task execution role&lt;/em&gt; grants permissions to the Fargate container agent. Typical examples of what permissions are provided by the task execution role include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Permission to pull container images from private Amazon Elastic Container Registry (ECR)&lt;/li&gt;
&lt;li&gt;Sending logs to Amazon CloudWatch&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These two use cases are what the AWS-managed policy &lt;code&gt;AmazonECSTaskExecutionRolePolicy&lt;/code&gt; allow. Other use cases may require accessing AWS Secrets Manager, for example. In this case, you must create a custom task execution role with a custom policy attached to it. More details are provided in the &lt;a href="https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task_execution_IAM_role.html" rel="noopener noreferrer"&gt;official documentation&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The &lt;em&gt;task role&lt;/em&gt; is also used by the task's containers to access other AWS services they depend on at runtime, such as Amazon Simple Storage Service (S3), Amazon Relational Database Service (RDS), and Amazon DynamoDB.&lt;/p&gt;

&lt;p&gt;This lab step inspects the lab environment to identify an IAM issue.&lt;/p&gt;

&lt;p&gt;Instructions&lt;/p&gt;

&lt;p&gt;In the AWS Management Console, navigate to the &lt;a href="https://us-west-2.console.aws.amazon.com/ecs/v2/clusters/lab-cluster/services?region=us-west-2" rel="noopener noreferrer"&gt;lab's ECS cluster&lt;/a&gt;:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6f2wu2c9u3lx5c6v5ybw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6f2wu2c9u3lx5c6v5ybw.png" alt=" " width="800" height="92"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;All the services should be &lt;strong&gt;Active&lt;/strong&gt;. If not, try periodically refreshing the &lt;strong&gt;Services&lt;/strong&gt; table every minute until they are.&lt;/p&gt;

&lt;p&gt;Click &lt;strong&gt;api-Service&lt;/strong&gt; to view the API service's details.&lt;br&gt;
On the &lt;strong&gt;Logs&lt;/strong&gt; tab, note that logs are displayed.&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;The fact that log messages are present indicates that the task 
execution role allows the creation of CloudWatch log streams and 
putting log events. In fact, insufficient permissions on the task 
execution role often result in the task failing to start.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;p&gt;Click the &lt;strong&gt;Deployments and events&lt;/strong&gt; tab and scroll down to the events table:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkdkwqnp8x4neprux5psx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkdkwqnp8x4neprux5psx.png" alt=" " width="800" height="273"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In case of task execution role issues, you can click on the task IDs presented in the events table to view error messages in the task overview panel that caused the task to fail.&lt;/p&gt;

&lt;p&gt;Return to the API service's &lt;strong&gt;Logs&lt;/strong&gt; tab and observe what log messages are displayed:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5kcyb834u91sr5fo1dfx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5kcyb834u91sr5fo1dfx.png" alt=" " width="800" height="204"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The log messages indicate that the application is unable to create the S3 bucket. The message is printed in the application code that catches the &lt;code&gt;AmazonS3Exception&lt;/code&gt; within the retry loop. When errors aren't so obvious, you can search for errors directly from the logs view or open the logs in CloudWatch Logs for more advanced search capabilities.&lt;/p&gt;

&lt;p&gt;Because the &lt;code&gt;createBucket&lt;/code&gt; method is attempted, the &lt;code&gt;doesBucketExistV2&lt;/code&gt; method succeeded and returned &lt;code&gt;false.&lt;/code&gt; This confirms that the Task container was successfully authenticated to the S3 service using the task role. Recall the task role initially only has permission to check if the bucket exists.&lt;/p&gt;

&lt;p&gt;Observe in the &lt;strong&gt;Task&lt;/strong&gt; column that more than one task ID is displayed:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyyamds27v54d3oj2bxkn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyyamds27v54d3oj2bxkn.png" alt=" " width="600" height="259"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;By default, all task logs are merged and displayed. You can click on one of the task IDs to view the logs for that specific task when needed.&lt;/p&gt;

&lt;p&gt;When the logs don't clearly indicate an IAM issue, you can use CloudTrail to identify failed AWS API calls. Note that there can be several minutes delay between a failed API call and when its corresponding event appears in CloudTrail.&lt;/p&gt;

&lt;p&gt;Navigate to the &lt;a href="https://us-west-2.console.aws.amazon.com/cloudtrail/home?region=us-west-2#/events?ReadOnly=false" rel="noopener noreferrer"&gt;CloudTrail event history&lt;/a&gt;:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwqxjyxctkonyuv392xmb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwqxjyxctkonyuv392xmb.png" alt=" " width="800" height="209"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The application code's attempts to create the S3 bucket are visible in the event history. By default, you can't tell from the table view if an API failed. The errorCode field indicates if a failure occurred and its column can be added to the table.&lt;/p&gt;

&lt;p&gt;Click the cog to the upper-right of the table:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzztwybmwjbi7xe7faf6y.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzztwybmwjbi7xe7faf6y.png" alt=" " width="800" height="82"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;It brings preferences&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9dqflnxusdp4ypn3qsvd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9dqflnxusdp4ypn3qsvd.png" alt=" " width="800" height="749"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Toggle the Error Code column on and click Confirm:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkx569eyxj2xw8ggzdqy4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkx569eyxj2xw8ggzdqy4.png" alt=" " width="403" height="52"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now the &lt;strong&gt;AccessDenied&lt;/strong&gt; errors are visible in the last column of the table.&lt;/p&gt;

&lt;p&gt;You may be wondering why the API calls for checking if the bucket exists are not included in the table. By default, read-only events are excluded, but you can view them by changing the &lt;strong&gt;Read-only&lt;/strong&gt; lookup attribute to &lt;em&gt;true&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;In your IDE terminal, enter the following command to view the last event from CloudTrail:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;aws cloudtrail lookup-events --max-results 1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1invkiptmcmo7semjsaf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1invkiptmcmo7semjsaf.png" alt=" " width="800" height="134"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In the above example, the last event was a &lt;strong&gt;CreateBucket&lt;/strong&gt; API call. The &lt;strong&gt;CloudTrailEvent&lt;/strong&gt; event field contains the errorCode field, but it cannot be filtered using the AWS CLI alone. You may have CloudTrail configured to send events to other services with more advanced filtering capabilities. If not, you could use &lt;code&gt;jq&lt;/code&gt; to filter the JSON output.&lt;/p&gt;

&lt;p&gt;You learned how to identify an IAM issue in ECS. You learned how to view logs and events in the ECS console and how to use CloudTrail to identify failed API calls.&lt;/p&gt;

&lt;p&gt;You learned how to identify an IAM issue in ECS. You learned how to view logs and events in the ECS console and how to use CloudTrail to identify failed API calls.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Resolving the Task's IAM Issue&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;To correct the IAM issue causing the application to fail to create the S3 bucket, you will update the task role in this lab step. Recall that an IAM least-privilege policy (lab-ecs-s3-task-policy) with permission to create the lab S3 bucket has already been created in the lab's terraform template.&lt;br&gt;
In  your IDE terminal, enter the following to attach the lab-ecs-s3-task-policy to the task role:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;account_id=$(aws sts get-caller-identity --query Account --output text)
aws iam attach-role-policy --role-name lab-ecs-task-role --policy-arn arn:aws:iam::$account_id:policy/lab-ecs-s3-task-policy
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Similarly, you could use the aws_iam_role_policy_attachment terraform resource to attach the policy to the task role. In practice, you may also consider merging the s3:CreateBucket permission into the existing role policy.&lt;/p&gt;

&lt;p&gt;Return to the ECS API service's task role and periodically refresh the logs until you observe the following logs:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F944412unqdpn1zzsrg9q.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F944412unqdpn1zzsrg9q.png" alt=" " width="800" height="246"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;It can take a minute or two for the new permissions to propagate to the task's container. Once the permissions have propagated, the first task will successfully create the S3 bucket, and the second task will detect it exists.&lt;/p&gt;

&lt;p&gt;You resolved the IAM issue by attaching a policy to the ECS task role.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Environment After&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fomu9w0uphu2cmieou8wt.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fomu9w0uphu2cmieou8wt.png" alt=" " width="745" height="471"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Conclusion&lt;/strong&gt;&lt;br&gt;
Properly configuring IAM for Amazon ECS on AWS Fargate is crucial for maintaining the security and compliance of your containerized applications.&lt;/p&gt;

&lt;p&gt;By carefully defining task execution and task IAM roles, you can grant your containers the necessary permissions to access AWS resources while minimizing exposure.   &lt;/p&gt;

&lt;p&gt;This article has explored the fundamental concepts of IAM in the context of Fargate, including:&lt;/p&gt;

&lt;p&gt;Understanding the difference between task execution and task IAM roles.   &lt;br&gt;
Creating IAM policies to grant specific permissions.&lt;br&gt;
Best practices for managing IAM roles and policies.   &lt;br&gt;
By following these guidelines and tailoring them to your specific application requirements, you can establish a robust IAM strategy that protects your sensitive data and ensures the security of your containerized workloads on AWS Fargate.&lt;/p&gt;

&lt;p&gt;Remember, the principle of least privilege should always guide your IAM decisions. Granting only the necessary permissions to your containers will reduce the potential attack surface and enhance overall security.   &lt;/p&gt;

</description>
    </item>
    <item>
      <title>Connecting to Private EC2 Instances Using an Amazon EC2 Instance Connect Endpoint</title>
      <dc:creator>Wilklins Nyatteng</dc:creator>
      <pubDate>Tue, 13 Aug 2024 10:37:00 +0000</pubDate>
      <link>https://forem.com/aws-builders/connecting-to-private-ec2-instances-using-an-amazon-ec2-instance-connect-endpoint-chl</link>
      <guid>https://forem.com/aws-builders/connecting-to-private-ec2-instances-using-an-amazon-ec2-instance-connect-endpoint-chl</guid>
      <description>&lt;p&gt;Amazon EC2 Instance Connect (EIC) Endpoints provide a secure and seamless option for connecting to private EC2 instances. EIC endpoints can be configured using identity-based and network-based access controls, which provides more flexibility and control over the security of your VPC resources. These endpoints can also reduce administrative overhead and improve security by removing the need for a bastion host.&lt;/p&gt;

&lt;p&gt;In this lab, you will replace a bastion host with an Amazon EC2 Instance Connect Endpoint to access a private EC2 instance. You will connect to the private instance using the AWS Management Console and the AWS CLI.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Learning objectives&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Upon completion of this intermediate-level lab, you will be able to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Configure an Amazon EC2 Instance Connect Endpoint&lt;/li&gt;
&lt;li&gt;Access a private instance using an EC2 Instance Connect Endpoint&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Familiarity with the following will be beneficial but is not required:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Amazon Virtual Private Cloud (VPC)&lt;/li&gt;
&lt;li&gt;Amazon Elastic Compute Cloud (EC2)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;&lt;u&gt;Introducing Amazon EC2 Instance Connect Endpoints&lt;/u&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Before EC2 Instance Connect Endpoints, you would need to connect to instances using a bastion host with a public IP address that could be accessed from the internet. To accomplish this, the VPC would also require an Internet Gateway (IGW) and the use of port forwarding to reach the private instance.&lt;/p&gt;

&lt;p&gt;The diagram below illustrates a typical bastion host configuration and the starting infrastructure of this lab:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fciqfylslf69wmhbaczq7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fciqfylslf69wmhbaczq7.png" alt=" " width="800" height="336"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;A user  would connect to the bastion host via the IGW using a terminal or the EC2 Instance Connect service. The bastion host resides in a public subnet and is configured with the SSH keys needed to connect to the private instance. The bastion host would then connect to the private instance using SSH.&lt;/p&gt;

&lt;p&gt;Not pictured in the diagram are the security groups that allow these instances to communicate with each other.&lt;/p&gt;

&lt;p&gt;A client instance, or separate host machine, would not be able to connect to the private instance without additional configurations and SSH keys.&lt;/p&gt;

&lt;h3&gt;
  
  
  EC2 Instance Connect Endpoints
&lt;/h3&gt;

&lt;p&gt;EC2 Instance Connect Endpoints offer the following benefits:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;No requirement for a Bastion host&lt;/li&gt;
&lt;li&gt;IAM-based authentication and authorization&lt;/li&gt;
&lt;li&gt;Simplified management and administration&lt;/li&gt;
&lt;li&gt;Compatible with existing SSH-based tools and workflows&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Faru23gx5lyb6hs36c7lz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Faru23gx5lyb6hs36c7lz.png" alt=" " width="788" height="578"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The EIC endpoint will replace the Bastion Host and allow you to connect to the instance in the private subnet. This lab will demonstrate how to connect to the private instance using the AWS Management Console and the AWS CLI.&lt;/p&gt;

&lt;p&gt;The &lt;strong&gt;client&lt;/strong&gt; EC2 instance depicted in the diagrams will simulate a separate host machine with no SSH keys configured. This instance has the &lt;strong&gt;latest AWS CLI&lt;/strong&gt; version installed.&lt;/p&gt;

&lt;p&gt;This lab is meant to serve as an introduction to EC2 Instance Connect Endpoints. For additional benefits and configuration options, see the &lt;a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/connect-with-ec2-instance-connect-endpoint.html" rel="noopener noreferrer"&gt;EC2 Instance Connect Endpoint documentation&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Connecting to the Virtual Machine using EC2 Instance Connect&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This lab will use the EC2 Instance Connect console to connect to two EC2 instances. Both instances will attempt to connect to a private EC2 instance. Once you have completed this lab step for the &lt;strong&gt;bastion&lt;/strong&gt; instance, repeat the process for the &lt;strong&gt;client&lt;/strong&gt; instance.&lt;/p&gt;

&lt;p&gt;In this lab step, you will connect to an EC2 instance using EC2 Instance Connect named &lt;strong&gt;bastion&lt;/strong&gt; and access a shell.&lt;br&gt;
&lt;strong&gt;Instructions&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In the AWS Management Console search bar, enter &lt;em&gt;EC2&lt;/em&gt;, and click the &lt;strong&gt;EC2&lt;/strong&gt; result under &lt;strong&gt;Services&lt;/strong&gt;:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8uurrvzo8u4e46uzwmq6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8uurrvzo8u4e46uzwmq6.png" alt=" " width="800" height="205"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To see available instances, click Instances in the left-hand menu:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fr942zvh7notpm6qrtfs1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fr942zvh7notpm6qrtfs1.png" alt=" " width="800" height="206"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The instances list page will open, and you will see an instance named bastion in the Running state:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fisunkaxqnf3iwk9p6o45.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fisunkaxqnf3iwk9p6o45.png" alt=" " width="169" height="94"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you don't see a running instance then the lab environment is still loading. Wait until the&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Instance state&lt;/strong&gt; is &lt;strong&gt;Running&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Right-click the &lt;strong&gt;bastion&lt;/strong&gt; instance, and click &lt;strong&gt;Connect&lt;/strong&gt;:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6fjsmknk4re4sfiguog0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6fjsmknk4re4sfiguog0.png" alt=" " width="521" height="151"&gt;&lt;/a&gt;&lt;br&gt;
The Connect to your instance form will load.&lt;/p&gt;

&lt;p&gt;In the form, ensure the EC2 Instance Connect tab is selected:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzia2pl4d8n73sr3bmaqt.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzia2pl4d8n73sr3bmaqt.png" alt=" " width="203" height="56"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You will see the instance's Instance ID and Public IP address displayed.&lt;br&gt;
In the User name textbox, enter ec2-user:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftot2pt8mdpqbu7r324ro.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftot2pt8mdpqbu7r324ro.png" alt=" " width="218" height="43"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To open a browser-based shell, click Connect:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4s8x72yr3b57jqgp2yhp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4s8x72yr3b57jqgp2yhp.png" alt=" " width="800" height="294"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Accessing Private Instances Using a Bastion Host&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In this lab step, you will connect to a private EC2 instance from a bastion host.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Important&lt;/em&gt;&lt;/strong&gt;: Ensure that you have an EC2 Instance Connect session open to both the &lt;strong&gt;bastion&lt;/strong&gt; and &lt;strong&gt;client&lt;/strong&gt; EC2 instances. You will need to switch between these sessions throughout this lab step.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Instructions&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In the instance connect window for the &lt;strong&gt;bastion&lt;/strong&gt; EC2 instance, enter the following command to connect to the &lt;strong&gt;private&lt;/strong&gt; instance:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ssh -A ec2-user@10.0.2.40(my instance ips)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Enter yes to the prompt:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7l0ee7iffdr7blqf3n9s.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7l0ee7iffdr7blqf3n9s.png" alt=" " width="718" height="69"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The &lt;strong&gt;bastion&lt;/strong&gt; EC2 instance has been configured with the SSH keys needed to connect to the &lt;strong&gt;private&lt;/strong&gt; EC2 instance. The &lt;code&gt;-A&lt;/code&gt; flag enables SSH agent forwarding, which allows the &lt;strong&gt;bastion&lt;/strong&gt; EC2 instance to use the SSH keys to connect to the &lt;strong&gt;private&lt;/strong&gt; EC2 instance.&lt;/p&gt;

&lt;p&gt;The &lt;strong&gt;bastion&lt;/strong&gt; instance also uses a public IP address, which enables it to be accessed from the internet, and in this case, the EC2 Instance Connect service.&lt;/p&gt;

&lt;p&gt;Once a connection is established, you will notice the IP address in the prompt changes to the private IP address of the &lt;strong&gt;private&lt;/strong&gt; EC2 instance:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdg5mprx2hk6z16sdg6es.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdg5mprx2hk6z16sdg6es.png" alt=" " width="736" height="331"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can enter &lt;code&gt;exit&lt;/code&gt; into the terminal to disconnect from the instance.&lt;/p&gt;

&lt;p&gt;You will now attempt to connect to the &lt;strong&gt;private&lt;/strong&gt; EC2 instance from the &lt;strong&gt;client&lt;/strong&gt; EC2 instance.&lt;/p&gt;

&lt;p&gt;Switch to the browser tab for the client EC2 instance and enter the following command, then enter yes to the prompt:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;aws ec2-instance-connect ssh --instance-id i-0564c1e98b952434d
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fd5f71pnklx5rw6wvl7gw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fd5f71pnklx5rw6wvl7gw.png" alt=" " width="800" height="51"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The &lt;strong&gt;client&lt;/strong&gt; EC2 instance simulates a separate host machine that does not have the SSH keys needed to connect to the &lt;strong&gt;private&lt;/strong&gt; EC2 instance. The &lt;code&gt;aws ec2-instance-connect ssh&lt;/code&gt; command attempts to use the EC2 Instance Connect service to establish a connection to the &lt;strong&gt;private&lt;/strong&gt; EC2 instance.&lt;/p&gt;

&lt;p&gt;This command is only available in the &lt;a href="https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html" rel="noopener noreferrer"&gt;latest version of the AWS CLI&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The &lt;strong&gt;private&lt;/strong&gt; instance does not have a public IP address, so the connection fails with a &lt;code&gt;There are no available instance connect endpoints.&lt;/code&gt; error.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Note&lt;/em&gt;: If the error &lt;code&gt;aws: error: argument operation: Invalid choice, valid choices are: send-ssh-public-key&lt;/code&gt; appears, ensure that you are accessing the &lt;strong&gt;client&lt;/strong&gt; instance. This error will appear if you are attempting to run the &lt;code&gt;ec2-instance-connect ssh&lt;/code&gt; command on the &lt;strong&gt;bastion&lt;/strong&gt; instance.&lt;/p&gt;

&lt;p&gt;After you create an endpoint in the next lab step, you will return to this window to attempt a connection again.&lt;/p&gt;

&lt;p&gt;We verified that the &lt;strong&gt;bastion&lt;/strong&gt; EC2 instance can connect to the &lt;strong&gt;private&lt;/strong&gt; EC2 instance, but the &lt;strong&gt;client&lt;/strong&gt; EC2 instance cannot.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Creating an Amazon EC2 Instance Connect Endpoint&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;We will create an Amazon EC2 Instance Connect Endpoint in a VPC and replace the existing bastion host.&lt;/p&gt;

&lt;h3&gt;
  
  
  Instructions
&lt;/h3&gt;

&lt;p&gt;In the AWS Management Console, in the search bar at the top, enter &lt;em&gt;vpc&lt;/em&gt;, and under &lt;strong&gt;Services&lt;/strong&gt;, click the &lt;strong&gt;VPC&lt;/strong&gt; result:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fuwd1wmovfcidmqck2jqb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fuwd1wmovfcidmqck2jqb.png" alt=" " width="800" height="196"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;From the VPC dashboard, in the left navigation pane, click Endpoints below Virtual private cloud:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fawmrfu4auqcldisbgepf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fawmrfu4auqcldisbgepf.png" alt=" " width="217" height="554"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Click Create endpoint:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftxco2rxaezmyja0ldnuv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftxco2rxaezmyja0ldnuv.png" alt=" " width="800" height="63"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The Create endpoint wizard will display.&lt;br&gt;
Below Endpoint settings, enter lab-endpoint in the Name tag field:&lt;br&gt;
Select EC2 Instance Connect Endpoint option below Service category:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fo70omzc17yzhwrkshi32.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fo70omzc17yzhwrkshi32.png" alt=" " width="800" height="217"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The form will update with additional options to configure your endpoint.&lt;/p&gt;

&lt;p&gt;For the endpoint VPC, select lab-vpc from the dropdown menu:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fy2qc4hhwdu0mrflo3aie.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fy2qc4hhwdu0mrflo3aie.png" alt=" " width="346" height="146"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2pzevtmsp7umlccm5853.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2pzevtmsp7umlccm5853.png" alt=" " width="800" height="60"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Client IP preservation allows the endpoint to preserve the IP address of the client when connecting to the instance. This is useful for logging and auditing purposes. Security groups and IAM policies can be configured to allow or deny connections based on the client IP address instead of the endpoint IP address.&lt;br&gt;
Under Security groups, select the endpoint-sg security group:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fx55fyt5jyx6t4xujj0s6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fx55fyt5jyx6t4xujj0s6.png" alt=" " width="800" height="157"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can use IAM policies to control which users can connect to instances and security groups to control the traffic that can access the endpoint.&lt;/p&gt;

&lt;p&gt;In this example, the &lt;strong&gt;endpoint-sg&lt;/strong&gt; security group allows all outbound traffic to the &lt;strong&gt;private-sg&lt;/strong&gt; security group. The &lt;strong&gt;private-sg&lt;/strong&gt; security group allows inbound traffic from within the VPC CIDR block.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;In the Subnet section, select public-subnet from the dropdown menu:&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F09le9fj8h7wbm9xgnr0k.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F09le9fj8h7wbm9xgnr0k.png" alt=" " width="430" height="83"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Click Create endpoint:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fges455sr6qmkz2r4b4w5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fges455sr6qmkz2r4b4w5.png" alt=" " width="268" height="118"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The endpoint will be created and displayed in the Endpoints list:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fl3hl2fgzkx38szzc3hmd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fl3hl2fgzkx38szzc3hmd.png" alt=" " width="800" height="15"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;It may take up to 5 minutes for the endpoint to become available. The Status will change from Pending to Available when it is ready. After a few minutes, you may need to refresh the page to see the updated status.&lt;/p&gt;

&lt;p&gt;We created an Amazon EC2 Instance Connect Endpoint.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgiitogiqfp37fu0hi39s.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgiitogiqfp37fu0hi39s.png" alt=" " width="800" height="34"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Connecting to an Amazon EC2 Instance Connect Endpoint&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In this lab step, you will connect to a private instance using an EC2 Instance Connect Endpoint. You will connect to the instance using the EC2 Instance Connect console and the AWS CLI.&lt;/p&gt;
&lt;h3&gt;
  
  
  Instructions
&lt;/h3&gt;

&lt;p&gt;Return to the &lt;a href="https://us-west-2.console.aws.amazon.com/ec2/home?region=us-west-2#Instances:instanceState=running" rel="noopener noreferrer"&gt;EC2 Instances&lt;/a&gt; table in the AWS Management Console.&lt;/p&gt;

&lt;p&gt;Select the &lt;strong&gt;private&lt;/strong&gt; EC2 instance, then select &lt;strong&gt;Connect&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5q71g7hgqcgu8gpwjnk8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5q71g7hgqcgu8gpwjnk8.png" alt=" " width="438" height="204"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Configure the following connection settings in the EC2 Instance Connect tab:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Connection Type&lt;/strong&gt;: Select &lt;strong&gt;Connect using EC2 Instance Connect Endpoint&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;EC2 Instance Connect Endpoint&lt;/strong&gt;: Select the &lt;strong&gt;lab-endpoint&lt;/strong&gt; endpoint from the dropdown menu&lt;/li&gt;
&lt;li&gt;Leave the default values of the remaining fields.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The Max tunnel duration field specifies the maximum amount of time that the connection will remain open. The default value is 1 hour. When configuring the IAM policy for the EC2 Instance Connect service, you can apply a condition to only allow connections with a specified maximum duration.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnuwn3qbkxwqwx69pv5sj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnuwn3qbkxwqwx69pv5sj.png" alt=" " width="800" height="780"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Click Connect:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5j138hez5yu3nl3dms4a.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5j138hez5yu3nl3dms4a.png" alt=" " width="352" height="89"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;An instance connect session will open in a new browser tab:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F746p1blzoa4p0edyrqik.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F746p1blzoa4p0edyrqik.png" alt=" " width="721" height="221"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The &lt;strong&gt;Last login&lt;/strong&gt; message at the top of the terminal displays the last connection to the instance, which was from the &lt;strong&gt;bastion&lt;/strong&gt; EC2 instance. Your IP addresses may differ from the example above.&lt;/p&gt;

&lt;p&gt;You are now connected to the &lt;strong&gt;private&lt;/strong&gt; instance using the instance connect console.&lt;/p&gt;

&lt;p&gt;Return to the &lt;strong&gt;client&lt;/strong&gt; EC2 instance instance connect tab:&lt;/p&gt;

&lt;p&gt;Enter the following command to connect to the private instance:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;aws ec2-instance-connect ssh --instance-id i-0564c1e98b952434d
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F12qhg2tblcspk4sz6xmw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F12qhg2tblcspk4sz6xmw.png" alt=" " width="800" height="320"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The IP address in the prompt changes to the private IP address of the &lt;strong&gt;private&lt;/strong&gt; EC2 instance, indicating that you are connected to the instance.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Summary&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;By completing this lab, you have:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Configured an Amazon EC2 Instance Connect Endpoint&lt;/li&gt;
&lt;li&gt;Accessed a private instance using an EC2 Instance Connect Endpoint&lt;/li&gt;
&lt;li&gt;Replaced a bastion host with an EC2 Instance Connect Endpoint&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Conclusion&lt;/strong&gt;&lt;br&gt;
EC2 Instance Connect Endpoint revolutionizes the way we access private EC2 instances. By eliminating the need for public IP addresses, bastion hosts, or agents, it significantly enhances security and simplifies management. This service provides a robust, efficient, and cost-effective solution for securely connecting to your instances. By implementing EC2 Instance Connect Endpoint and adhering to best practices, organizations can strengthen their overall security posture and streamline operations.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Detecting EC2 Threats with Amazon GuardDuty</title>
      <dc:creator>Wilklins Nyatteng</dc:creator>
      <pubDate>Tue, 30 Jul 2024 12:35:01 +0000</pubDate>
      <link>https://forem.com/aws-builders/detecting-ec2-threats-with-amazon-guardduty-4c7e</link>
      <guid>https://forem.com/aws-builders/detecting-ec2-threats-with-amazon-guardduty-4c7e</guid>
      <description>&lt;p&gt;Amazon GuardDuty continuously monitors and identifies threats by analyzing several types of activity in your AWS account and any invited member accounts that you link to. GuardDuty can notify you of a wide variety of threats including unauthorized access, trojans, communication with Tor anonymizing, or cryptocurrency networks.&lt;/p&gt;

&lt;p&gt;GuardDuty uses the following data sources to make its threat findings: VPC Flow Logs, AWS CloudTrail event logs, and DNS logs.&lt;/p&gt;

&lt;p&gt;To start using GuardDuty, you must first enable it for your account. You will enable GuardDuty in this lab step. You will enable GuardDuty in a single AWS region. In practice, it is highly recommended that you enable GuardDuty in all supported AWS regions. This allows GuardDuty to generate findings of threats even in regions that you are not actively using.&lt;/p&gt;

&lt;p&gt;You will learn how to use Amazon GuardDuty to automatically uncover malicious EC2 activity, and configure threat lists to improve the security of an AWS Lab environment.&lt;/p&gt;

&lt;p&gt;&lt;u&gt;&lt;strong&gt;Learning Objectives&lt;/strong&gt;&lt;/u&gt;&lt;/p&gt;

&lt;p&gt;Upon completion of this lab, we will be able to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Enable, disable, and suspend Amazon GuardDuty for AWS accounts&lt;/li&gt;
&lt;li&gt;Activate threat lists and trusted IP lists, and understand when to use each&lt;/li&gt;
&lt;li&gt;Understand the types of security findings GuardDuty can detect&lt;/li&gt;
&lt;li&gt;Prioritize and interpret GuardDuty findings in a live environment&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You should be familiar with: Core AWS services, particularly EC2, VPC, and S3.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;u&gt;Enabling Amazon GuardDuty&lt;/u&gt;&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;Instructions&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In the AWS Management Console search bar, enter &lt;em&gt;GuardDuty&lt;/em&gt;, and click the &lt;strong&gt;GuardDuty&lt;/strong&gt; result under &lt;strong&gt;Services&lt;/strong&gt;:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5v8objwft9ajwd2jk1ev.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5v8objwft9ajwd2jk1ev.png" alt=" " width="565" height="138"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Click Get Started on the welcome page:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxkedn8r8stsxn3n27opb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxkedn8r8stsxn3n27opb.png" alt=" " width="800" height="253"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Click Enable GuardDuty to have GuardDuty start monitoring your AWS environment:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0v39bfx04d6gm7z7zez7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0v39bfx04d6gm7z7zez7.png" alt=" " width="800" height="548"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Enabling GuardDuty automatically creates a service-linked role to allow GuardDuty to gather metadata about EC2 instances in your environment. After you enable GuardDuty, it immediately begins pulling and analyzing streams of data from AWS CloudTrail, VPC Flow Logs, and DNS logs to generate security findings. This all happens automatically behind the scenes. For example, you do not need to create VPC Flow Logs to have GuardDuty monitor network activity in your VPCs.&lt;/p&gt;

&lt;p&gt;We have enabled Amazon GuardDuty, so that security findings for your AWS environment can automatically be discovered.&lt;/p&gt;

&lt;p&gt;&lt;u&gt;&lt;strong&gt;Activating a GuardDuty Threat List&lt;/strong&gt;&lt;/u&gt;&lt;/p&gt;

&lt;p&gt;Amazon GuardDuty analyzes its data sources to find potential security threats. You can influence the security findings that GuardDuty reports through trusted IP lists and threat lists. Trusted IP lists whitelist IP addresses from being included in GuardDuty's findings to reduce false positives. Threat lists include known malicious IP addresses. GuardDuty reports additional findings for IP addresses in threat lists.&lt;/p&gt;

&lt;p&gt;We will activate a threat list that includes the IP address of an EC2 instance that is part of the Cloud Academy Lab environment. The environment consists of two EC2 instances in different VPCs. The instances are configured to communicate with each other. You will see the findings GuardDuty discovers regarding communicating with malicious instances in a later lab step.&lt;br&gt;
&lt;strong&gt;Instructions&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://us-east-2.console.aws.amazon.com/ec2/v2/home?region=us-east-2#Instances:sort=instanceId" rel="noopener noreferrer"&gt;Open the EC2 console&lt;/a&gt; to view the instances in the Lab environment.&lt;/p&gt;

&lt;p&gt;There are two EC2 instances to focus on for this lab: &lt;strong&gt;Malicious Instance&lt;/strong&gt;, and &lt;strong&gt;App Server&lt;/strong&gt;:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0uprbsy113aunyq97u9d.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0uprbsy113aunyq97u9d.png" alt=" " width="489" height="68"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I select Malicious Instance and copied its IPv4 Public IP:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F57vbyiqybxjyf2slzdrs.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F57vbyiqybxjyf2slzdrs.png" alt=" " width="800" height="131"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The Public IP address is what is needed for GuardDuty's threat list. DNS names and private IP addresses are ignored in threat lists.&lt;br&gt;
Save the IP address in a plain text file named threat-list.txt.&lt;/p&gt;

&lt;p&gt;GuardDuty requires a file on Amazon S3 to create a threat list. As an example on Windows, you could use Notepad and the file contents would look similar to the following:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F50zuue50ocwganntes0d.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F50zuue50ocwganntes0d.png" alt=" " width="323" height="152"&gt;&lt;/a&gt;&lt;br&gt;
Open the Amazon S3 console&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fskldfalw5d39s94om5s9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fskldfalw5d39s94om5s9.png" alt=" " width="440" height="205"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Click on the bucket containing threatlist in the name.&lt;br&gt;
Click Upload to open the S3 upload wizard.&lt;br&gt;
Click Add files and select the threat-list.txt file we created earlier.&lt;br&gt;
Click Upload in the lower-right corner to upload the file with the default S3 file configuration.&lt;br&gt;
Click threat-list.txt to open its details in a new tab, and copy the Object URL in the Object overview panel:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7o0lxpt4na8aoy0whw86.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7o0lxpt4na8aoy0whw86.png" alt=" " width="800" height="287"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Return to the GuardDuty Console, and select &lt;strong&gt;Lists&lt;/strong&gt; in the left sidebar.&lt;/p&gt;

&lt;p&gt;Note: You may already see some &lt;strong&gt;Findings&lt;/strong&gt; in the GuardDuty Console. GuardDuty does not require a threat list to make findings. It will only report additional findings for IP addresses in the threat list.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Click Add a threat IP list to create a threat IP list:&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvtjfwvgkz6jtix1t2tme.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvtjfwvgkz6jtix1t2tme.png" alt=" " width="800" height="61"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In the Add a threat IP list form, enter the following values and click Add list:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;List name&lt;/strong&gt;: &lt;em&gt;Lab&lt;/em&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Location&lt;/strong&gt;: Paste in the S3 link you copied a few instructions ago&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Format&lt;/strong&gt;: Plaintext (Notice that the drop-down lists other formats that can be used if you have existing threat intelligence services to import threat lists from)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;I agree&lt;/strong&gt;: checked
Check the Active checkbox to activate the threat list:&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7ghm3bkhuck8rjo5mkl8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7ghm3bkhuck8rjo5mkl8.png" alt=" " width="800" height="34"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We have activated a threat list in GuardDuty. You began by listing IP addresses in a file. Then you uploaded the file to S3, and created a threat list in GuardDuty. Lastly, you activated the threat list. No new findings related to the threat list will be made unless the threat list is active.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;u&gt;&lt;/u&gt;&lt;/strong&gt;Examining Sample GuardDuty Findings*&lt;em&gt;&lt;/em&gt;*&lt;/p&gt;

&lt;p&gt;To learn about the types of threats that GuardDuty can find, you will generate sample findings in this lab step. The findings are simulated, but allow you to view details and illustrate the three different severity levels in GuardDuty: high, medium, and low. In addition to the sample findings, you can find [descriptions of what each finding relates to in the GuardDuty documentation]&lt;/p&gt;

&lt;p&gt;(&lt;a href="https://docs.aws.amazon.com/guardduty/latest/ug/guardduty_finding-types.html" rel="noopener noreferrer"&gt;https://docs.aws.amazon.com/guardduty/latest/ug/guardduty_finding-types.html&lt;/a&gt;).&lt;/p&gt;

&lt;p&gt;Instructions&lt;br&gt;
Click on Settings in the GuardDuty Console sidebar.&lt;br&gt;
You can ignore any error that appears regarding not being authorized to perform IAM requests.&lt;br&gt;
Scroll down to the Sample findings section and click on Generate sample findings:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbayowaxc9ghawicjf3mx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbayowaxc9ghawicjf3mx.png" alt=" " width="800" height="124"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After a few seconds, a success banner appears:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjy7yjo33jfzmf8806bpc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjy7yjo33jfzmf8806bpc.png" alt=" " width="515" height="46"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Click on Findings in the GuardDuty sidebar.&lt;br&gt;
Notice the table is full of various findings that begin with [SAMPLE]:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fg7nu2n356tme8cnctomm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fg7nu2n356tme8cnctomm.png" alt=" " width="800" height="421"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Read through the different sample findings to see what kind of threats GuardDuty can identify.&lt;br&gt;
Select a few findings and inspect the details panel that appears:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F21673p9q9r0er9955prf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F21673p9q9r0er9955prf.png" alt=" " width="800" height="419"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The details are divided into several sections: Summary, &lt;strong&gt;Resource affected&lt;/strong&gt;, &lt;strong&gt;Action&lt;/strong&gt;, &lt;strong&gt;Actor&lt;/strong&gt;, and &lt;strong&gt;Additional information&lt;/strong&gt;.&lt;br&gt;
We have generated and examined sample GuardDuty findings. Although this Lab focuses on EC2 threats, you have also seen in the sample findings that GuardDuty can also identify IAM threats by using CloudTrail logs.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;u&gt;&lt;/u&gt;&lt;/strong&gt;Examining Live Threats in GuardDuty*&lt;em&gt;&lt;/em&gt;*&lt;/p&gt;

&lt;h3&gt;
  
  
  Introduction
&lt;/h3&gt;

&lt;p&gt;The EC2 instances in the Cloud Academy lab environment have been communicating with each other since you enabled GuardDuty. The findings related to the instances should appear within 15 minutes. You can read through this lab step without waiting if you prefer. The lab step explains the findings that would eventually appear. If you do wait and no findings are present after 15 minutes ensure the threat IP list is active, The way the two instances communicate with each other is as follows:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The App Server instance simply makes HTTP requests to the Malicious Instance every 15 seconds.&lt;/li&gt;
&lt;li&gt;The Malicious Instance sends SSH connection attempts to the App Server instance every 4 seconds. The connection request does not include an SSH key causing the request to always be refused.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The signatures of each of these communication types are recognized by GuardDuty as findings. You will investigate the findings in this lab step.&lt;/p&gt;

&lt;h3&gt;
  
  
  Instructions
&lt;/h3&gt;

&lt;p&gt;Click on &lt;strong&gt;Findings&lt;/strong&gt; in the GuardDuty Console's sidebar.&lt;/p&gt;

&lt;p&gt;Depending on how quickly you arrived at this lab step, you may see the following &lt;strong&gt;Finding type&lt;/strong&gt; row:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4lgz3kc49rpdqugsexva.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4lgz3kc49rpdqugsexva.png" alt=" " width="674" height="42"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Click on the UnauthorizedAccess:EC2/MaliciousIPCaller.Custom finding with a yellow square (medium severity):&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Foe4lyuwr7885g93emnts.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Foe4lyuwr7885g93emnts.png" alt=" " width="577" height="806"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This finding indicates outbound TCP communication with an IP address in one of your GuardDuty threat lists. The Threat list name field tells you which list. The medium severity rating is used because it is recommended that you investigate the affected instance at your earliest convenience.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Scroll down the finding details to discover all the details included to help you understand the threat:&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fia66lh8uyplkyfdp1i6m.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fia66lh8uyplkyfdp1i6m.png" alt=" " width="547" height="148"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;For example, in the &lt;strong&gt;Resource affected&lt;/strong&gt; section you can see if the involved instance (the App Server in this case) was in the role of the target or the actor and which port was involved. GuardDuty uses &lt;a href="https://docs.aws.amazon.com/guardduty/latest/ug/guardduty_finding-types-ec2.html#unauthorizedaccess-ec2-maliciousipcallercustom" rel="noopener noreferrer"&gt;VPC flow logs&lt;/a&gt; to make the finding. In previous iterations of GuardDuty a separate SSHBruteForce finding was also reported but it is not treated separately any longer.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Additional Potential Findings&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The following findings are not expected to be included in your lab's GuardDuty findings but have been observed when leaving instances open to the Internet for extended periods of time or if an instance is compromised. They can give you additional perspective on what GuardDuty can find.&lt;/p&gt;

&lt;p&gt;1. &lt;strong&gt;UnauthorizedAccess:EC2/SSHBruteForce&lt;/strong&gt; (low severity):&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fugzu1w35zu78v117kj5r.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fugzu1w35zu78v117kj5r.png" alt=" " width="546" height="847"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The &lt;strong&gt;EC2/SSHBruteForce&lt;/strong&gt; finding indicates an instance was involved in a brute force attack aimed at gaining SSH access using passwords or access keys. In the above image, you can see the description states that an instance is the target of an attack from an IP address. GuardDuty uses VPC flow logs to make this finding. The finding is classified as &lt;strong&gt;Low&lt;/strong&gt; severity meaning that it does not require immediate attention, but is something to address in the future, perhaps by blocking traffic from that IP in your VPC and only allowing SSH access through keys. You can see &lt;strong&gt;Location&lt;/strong&gt; of the attacker's IP address in the &lt;strong&gt;Actor&lt;/strong&gt; section of the finding details.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Note&lt;/em&gt;: SSH findings are only reported if SSH is configured on the default port of 22.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt; &lt;strong&gt;Recon:EC2/PortProbeUnprotectedPort&lt;/strong&gt; (low severity):
This finding notifies you that an open port on one of your instances has been probed by known scanners on the internet. The finding is low risk, but you are advised to restrict access to known instances by configuring security groups, access control lists, or host firewalls. The &lt;strong&gt;Actor&lt;/strong&gt; section tells you where the probe originated:&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flkyurq9pa2v67lcp06k4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flkyurq9pa2v67lcp06k4.png" alt=" " width="547" height="560"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We examined a real EC2 threat finding for the lab environment. You understood the signatures for each finding and actions that can be taken to remedy each.&lt;/p&gt;

&lt;p&gt;It is worth noting that GuardDuty findings are event sources in EventBridge. By using EventBridge, it is possible to automatically react to GuardDuty findings.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Disabling Amazon GuardDuty&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Amazon GuardDuty incurs &lt;a href="https://aws.amazon.com/guardduty/pricing/" rel="noopener noreferrer"&gt;costs for analyzing the variety of data sources&lt;/a&gt; that it monitors. If you no longer need the proactive threat detection provided by GuardDuty, you can either suspend or disable it to stop accumulating costs. If you disable GuardDuty, any findings that were discovered by GuardDuty will be lost. In practice, you are encouraged to back up any findings you want to preserve before disabling GuardDuty.&lt;/p&gt;

&lt;p&gt;In this Lab Step, you will disable GuardDuty because you will not need to preserve any findings or activate GuardDuty later.&lt;/p&gt;

&lt;h3&gt;
  
  
  Instructions
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;In the GuardDuty Console, click on &lt;strong&gt;Settings&lt;/strong&gt; in the left sidebar:&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fb88xjbyq3n1jzcl4207m.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fb88xjbyq3n1jzcl4207m.png" alt=" " width="238" height="121"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Under Disable GuardDuty, click on Disable:&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7haup899veivlbfr1w07.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7haup899veivlbfr1w07.png" alt=" " width="632" height="359"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fb24jea417hh92i1g4jij.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fb24jea417hh92i1g4jij.png" alt=" " width="800" height="163"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You are presented with the GuardDuty welcome page when the operation is complete.&lt;/p&gt;

&lt;p&gt;We  disabled GuardDuty to stop accumulating threat analysis costs and to remove any trace of previous findings.&lt;br&gt;
&lt;strong&gt;&lt;u&gt;Conclusion&lt;/u&gt;&lt;/strong&gt;&lt;br&gt;
Amazon GuardDuty offers a robust and proactive approach to safeguarding your EC2 instances from a wide range of threats. By continuously monitoring your AWS environment, GuardDuty provides invaluable insights into suspicious activities, enabling you to respond promptly and effectively. Its ability to detect anomalies, unauthorized access, and malicious behaviors is a critical component of a comprehensive security strategy.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;u&gt;Recommendations&lt;/u&gt;&lt;/strong&gt;&lt;br&gt;
To maximize the benefits of Amazon GuardDuty and strengthen your overall security posture, consider the following recommendations:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Develop clear incident response plans to address potential threats identified by GuardDuty. Establish communication channels and roles to ensure efficient coordination.&lt;/li&gt;
&lt;li&gt;Combine GuardDuty with other security tools and services to create a layered defense. Utilize tools like AWS Security Hub to centralize and prioritize findings.&lt;/li&gt;
&lt;li&gt;Stay informed about emerging threats and vulnerabilities. Incorporate threat intelligence feeds into GuardDuty to enhance detection capabilities.&lt;/li&gt;
&lt;li&gt;Continuously review GuardDuty findings and adjust detection filters as needed. This helps optimize the service for your specific environment.&lt;/li&gt;
&lt;li&gt;Foster a security-aware culture within your organization. Train users on best practices for handling sensitive information and recognizing potential threats.&lt;/li&gt;
&lt;li&gt;GuardDuty is a valuable tool, but it should be part of a broader security strategy. Consider implementing additional safeguards such as strong access controls, network segmentation, and regular vulnerability assessments.&lt;/li&gt;
&lt;/ul&gt;

</description>
    </item>
    <item>
      <title>Building with the Cloud: Guide to Becoming an AWS Builder</title>
      <dc:creator>Wilklins Nyatteng</dc:creator>
      <pubDate>Tue, 16 Jan 2024 07:49:36 +0000</pubDate>
      <link>https://forem.com/aws-builders/building-with-the-cloud-guide-to-becoming-an-aws-builder-3k0l</link>
      <guid>https://forem.com/aws-builders/building-with-the-cloud-guide-to-becoming-an-aws-builder-3k0l</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fonh858mem9pp03z376si.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fonh858mem9pp03z376si.png" alt=" " width="800" height="400"&gt;&lt;/a&gt;&lt;br&gt;
&lt;strong&gt;&lt;u&gt;Introduction&lt;/u&gt;&lt;/strong&gt;&lt;br&gt;
As the cloud computing landscape continues to evolve, professionals and enthusiasts alike seek opportunities to deepen their expertise and contribute to the broader community. One such avenue is the AWS Community Builders Program, a platform designed to bring together AWS enthusiasts, foster collaboration, and amplify the collective knowledge within the Amazon Web Services ecosystem. In this comprehensive technical article, we will delve into the intricacies of the program, covering eligibility criteria, prerequisites, application processes, the diverse categories it encompasses, and the enticing perks that come with being an AWS Community Builder.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;u&gt;What is the AWS Community Builders Program&lt;/u&gt;&lt;/strong&gt;&lt;br&gt;
The &lt;a href="https://aws.amazon.com/developer/community/community-builders/" rel="noopener noreferrer"&gt;AWS Community Builders program&lt;/a&gt; offers technical resources, education, and networking opportunities to AWS technical enthusiasts and emerging thought leaders who are passionate about sharing knowledge and connecting with the technical community.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;u&gt;Who Can Apply for the Program?&lt;/u&gt;&lt;/strong&gt;&lt;br&gt;
The AWS Community Builders Program is inclusive and welcomes individuals from various backgrounds and levels of expertise. Whether you are a seasoned cloud architect, a software developer, or a newcomer to the cloud space, if you possess a genuine passion for AWS and a commitment to community engagement, you are a potential candidate for the program. AWS values diversity and actively encourages applicants from different professional and cultural backgrounds.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;u&gt;Prerequisites Needed for the Program&lt;/u&gt;&lt;/strong&gt;&lt;br&gt;
While there are no strict prerequisites for joining the AWS Community Builders Program, having a foundational understanding of AWS services and solutions is beneficial. This understanding could be acquired through professional experience, certifications, or self-directed learning. However, what sets successful applicants apart is not just their technical proficiency but also their enthusiasm for continuous learning, effective communication skills, and a collaborative mindset.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;u&gt;AWS Community Builder Categories&lt;/u&gt;&lt;/strong&gt;&lt;br&gt;
The program is structured around diverse categories to accommodate the varied interests and expertise of its members. These categories include, but are not limited to Containers, Data (databases, analytics, and BI), Developer Tools, Front-End Web and Mobile, Game Tech, Graviton/Arm Development, Cloud Ops, Machine Learning, Network Content &amp;amp; Delivery, Security &amp;amp; Identity, Serverless, and Storage. Each category serves as a thematic hub where community builders can collaborate, share insights, and contribute to the collective knowledge within their specific area of expertise.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;u&gt;Why Should You Join the AWS Community Builders Program?&lt;/u&gt;&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;Networking Opportunities&lt;/strong&gt;&lt;br&gt;
Being part of the AWS Community Builders Program provides unparalleled networking opportunities. You get to connect with fellow community builders, AWS experts, and industry leaders. Engaging in discussions, attending meetups, and participating in exclusive events organized by AWS foster meaningful connections that can lead to collaborations and knowledge exchange.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Stay Updated on Latest Technologies&lt;/strong&gt;&lt;br&gt;
AWS is at the forefront of cloud innovation, constantly releasing new services and features. As a community builder, you gain early access to these innovations, allowing you to stay ahead of the curve and contribute valuable insights to the community. This access to cutting-edge technologies enhances your professional development.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Collaboration and Learning&lt;/strong&gt;&lt;br&gt;
The program encourages a culture of collaboration and continuous learning. By participating in discussions, contributing to open-source projects, and sharing your knowledge through &lt;a href="https://dev.to/aws-builders"&gt;blogs&lt;/a&gt; or tutorials, you not only enhance your own understanding but also contribute to the growth of the community. This collaborative environment fosters a sense of shared success among community builders.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;u&gt;How to Get Accepted?&lt;/u&gt;&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;Showcase Your Passion for AWS&lt;/strong&gt;&lt;br&gt;
Active participation in AWS-related discussions is crucial. Engage in forums, social media, and other community platforms to showcase your passion for AWS. Share your experiences, answer queries, and contribute to discussions. This not only demonstrates your expertise but also highlights your commitment to the community.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Contribute to Open-Source Projects&lt;/strong&gt;&lt;br&gt;
Contributing to open-source projects related to AWS is a powerful way to demonstrate your skills and commitment. Whether it's fixing bugs, adding features, or creating new projects, your contributions become tangible evidence of your dedication to advancing the AWS ecosystem.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Share Your Expertise&lt;/strong&gt;&lt;br&gt;
Demonstrate your expertise by creating and sharing content. This could be in the form of blog posts, tutorials, or even speaking at local meetups or conferences. Your ability to articulate complex concepts in a clear and concise manner enhances your credibility within the community.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Engage with the Community&lt;/strong&gt;&lt;br&gt;
Building relationships within the AWS community is key. Engage with other community builders, attend events, and actively participate in community initiatives. Being an active member showcases your dedication to the community's growth and success.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;u&gt;How to Apply?&lt;/u&gt;&lt;/strong&gt;&lt;br&gt;
The application process for the AWS Community Builders Program is typically conducted &lt;a href="https://aws.amazon.com/developer/community/community-builders/" rel="noopener noreferrer"&gt;online&lt;/a&gt;. The application form will require you to provide details about your AWS experience, contributions to the community, and reasons for wanting to join the program. Here are some key steps to consider when applying:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Detail Your AWS Experience&lt;/strong&gt;&lt;br&gt;
Provide a comprehensive overview of your experience with AWS. This includes any certifications you may have, professional projects you've worked on, and any notable achievements related to AWS.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Highlight Community Contributions&lt;/strong&gt;&lt;br&gt;
Emphasize your contributions to the AWS community. This could include participation in forums, open-source projects, blog posts, or any other initiatives that showcase your commitment to community engagement.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Articulate Your Motivation&lt;/strong&gt;&lt;br&gt;
Clearly express why you want to be part of the AWS Community Builders Program. Whether it's for personal development, a desire to contribute to the community, or a specific goal you aim to achieve, articulate your motivations effectively.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Showcase Your Diversity&lt;/strong&gt;&lt;br&gt;
If applicable, highlight any unique perspectives, experiences, or skills you bring to the community. AWS values diversity and encourages individuals from different backgrounds to contribute to the program.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;u&gt;Perks of Being an AWS Community Builder&lt;/u&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqp8dyaby5j9cg5sdz9qi.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqp8dyaby5j9cg5sdz9qi.png" alt=" " width="800" height="226"&gt;&lt;/a&gt;&lt;br&gt;
Joining the AWS Community Builders Program comes with a host of perks that go beyond the satisfaction of contributing to the community. These perks include:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Exclusive Access to AWS Experts&lt;/strong&gt;&lt;br&gt;
As a community builder, you gain exclusive access to AWS experts. This access opens up opportunities for mentorship, one-on-one discussions, and valuable insights directly from the minds behind AWS services. Exclusive talks where they teach you how to generate content and share their experiences.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Early Access to Features&lt;/strong&gt;&lt;br&gt;
Being on the forefront of AWS innovation, community builders often receive early access to upcoming features and services. This not only allows you to explore and experiment with new technologies but also positions you as an early adopter within the community.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Opportunities for Collaboration&lt;/strong&gt;&lt;br&gt;
The program facilitates collaboration between community builders. Whether it's co-authoring blog posts, working on open-source projects, or organizing events, the collaborative environment fosters collective growth and success. 50% discount for &lt;a href="https://reinvent.awsevents.com/" rel="noopener noreferrer"&gt;AWS re:Invent&lt;/a&gt; ticket and &lt;a href="https://pages.awscloud.com/GLOBAL_STRAT_ADHOC_all-builders-welcome-grant-2021-application_20210623__02--Confirmation-page.html?Languages=English" rel="noopener noreferrer"&gt;All Builders Welcome Grant program&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Recognition and Visibility&lt;/strong&gt;&lt;br&gt;
As an AWS Community Builder, you gain visibility within the AWS ecosystem. This recognition can lead to speaking opportunities at AWS events, workshops, and other avenues to showcase your expertise to a broader audience.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;AWS Swags&lt;/strong&gt;&lt;br&gt;
In addition to the intangible benefits, AWS Community Builders are often rewarded with exclusive swag. These can include custom t-shirts, stickers, and other merchandise that serve as a tangible representation of your involvement in the program. There is also $500 AWS Credits for your practice and development, 1-year access to &lt;a href="https://cloudacademy.com/" rel="noopener noreferrer"&gt;Cloud Academy&lt;/a&gt; and one free &lt;a href="https://aws.amazon.com/certification/" rel="noopener noreferrer"&gt;AWS certification&lt;/a&gt; exam voucher per year.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;u&gt;Conclusion&lt;/u&gt;&lt;/strong&gt;&lt;br&gt;
An hour in the trenches of the AWS Community Builders Program is not just an investment in your technical skills but a commitment to a thriving community. By actively participating, contributing, and collaborating, you not only advance your own expertise but also play a pivotal role in shaping the future of the AWS ecosystem. Joining the program is not merely an individual achievement; it is a step towards collective growth, learning, and success within the dynamic realm of cloud computing.&lt;/p&gt;

</description>
      <category>awscommunitybuilder</category>
      <category>aws</category>
    </item>
    <item>
      <title>Amazon Q: Your AI Work BFF Debuts at Re:Invent 2023</title>
      <dc:creator>Wilklins Nyatteng</dc:creator>
      <pubDate>Mon, 04 Dec 2023 05:46:16 +0000</pubDate>
      <link>https://forem.com/aws-builders/amazon-q-your-ai-work-bff-debuts-at-reinvent-2023-3lan</link>
      <guid>https://forem.com/aws-builders/amazon-q-your-ai-work-bff-debuts-at-reinvent-2023-3lan</guid>
      <description>&lt;p&gt;Las Vegas. November. A sea of techies, fueled by cold brew and ambition, floods the halls of &lt;a href="https://reinvent.awsevents.com/" rel="noopener noreferrer"&gt;Re:Invent&lt;/a&gt; – the annual cloud computing extravaganza hosted by Amazon Web Services. This year, amidst the mind-bending demos and visionary keynotes, a single announcement stole the show: &lt;a href="https://aws.amazon.com/q/" rel="noopener noreferrer"&gt;Amazon Q&lt;/a&gt;, an AI work assistant so revolutionary it'll make your current to-do list cry in a corner.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9gcnyehh888hf6h5vivu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9gcnyehh888hf6h5vivu.png" alt=" " width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Imagine a work bestie who's not just good at coffee runs and pep talks, but a machine-learning marvel that answers any question you throw its way, writes code faster than your keyboard can handle, and even untangles your thorniest tech woes. That's the magic of Q. It's not just Google on steroids, it's your personal knowledge Sherpa, diving deep into your company's data lakes, code repositories, and even enterprise systems to surface the exact insights you need to crush your workday.&lt;/p&gt;

&lt;p&gt;Forget drowning in documentation or spamming colleagues for help. Q speaks your language, even if your question sounds like it was written by a particularly creative toddler. Ask it anything, from "What's the global impact of a 10% price hike on our unicorn onesie line?" to "Write me some Python code to automate this soul-sucking report." Q doesn't bat an eye, it just delivers.&lt;/p&gt;

&lt;p&gt;But Q is more than just an answer machine. It's your problem-solving superhero. Stuck on a bug that's turning your hair prematurely gray? Q can debug it faster than you can say "Stack Overflow." Need to optimize your cloud infrastructure and make your CFO do a happy dance? Q can analyze your data like a financial Sherlock Holmes and suggest tweaks that'll have your costs singing like Beyoncé. Feeling creatively bankrupt, staring at a blank document like a deer in headlights? Q can brainstorm ideas so brilliant they'll make your marketing team green with envy and your next client presentation the stuff of Silicon Valley legend.&lt;/p&gt;

&lt;p&gt;And the best part? Q is your personal AI apprentice. Train it to understand your company's lingo, inside jokes, and even your boss's signature brand of motivational (but slightly awkward) pep talks. Want Q to answer questions with your CEO's dry wit and penchant for inspirational quotes? No problem. Need it to decipher the cryptic engineering acronyms your team throws around like confetti? Easy peasy. Q becomes an extension of your tribe, seamlessly integrating into your existing work environment like a long-lost, super-smart sibling.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fiohaer2lfvme69bhtk7n.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fiohaer2lfvme69bhtk7n.jpg" alt=" " width="800" height="309"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;But the real game-changer? How Q turbocharges collaboration. Imagine a world where everyone has instant access to your organization's collective brainpower. Q breaks down silos like a digital wrecking ball, fostering information sharing that sparks cross-team innovation like fireworks on the Fourth of July. Suddenly, that marketing whiz can tap into the wisdom of your seasoned engineers to craft campaigns that resonate like a Taylor Swift ballad. Your sales team can close deals based on real-time customer insights gleaned from Q's data analysis. And your designers? They can collaborate with engineers in real-time, sketching prototypes and building masterpieces like a digital Michelangelo and Da Vinci tag team.&lt;/p&gt;

&lt;p&gt;Amazon Q is still young, but its potential is bigger than the metaverse and bolder than Elon Musk's Twitter rants. It's not just about replacing your Google searches; it's about redefining how we work. Q empowers us to be more efficient, more creative, and ultimately, more human. So, ditch the endless to-do lists and knowledge-hunting expeditions. With Q by your side, you can finally focus on what you do best: bringing your A-game to work every single day.&lt;/p&gt;

&lt;p&gt;So, the next time you feel like your work is a bottomless pit of despair, remember: you're not alone. Q is here, ready to be your AI work BFF, your problem-solving sensei, and your secret weapon for success. Now, who's ready to conquer their to-do list and make Re:Invent 2024 look like a kindergarten finger-painting session?&lt;/p&gt;

&lt;p&gt;Let's face it, we all need a little AI magic in our lives. And Q? It's just the spell we've been waiting for.&lt;/p&gt;

</description>
      <category>aws</category>
      <category>awsq</category>
      <category>awsai</category>
      <category>awscommunity</category>
    </item>
    <item>
      <title>Securing Your Applications on AWS: Guide to Data Privacy and Protection</title>
      <dc:creator>Wilklins Nyatteng</dc:creator>
      <pubDate>Mon, 27 Nov 2023 07:28:57 +0000</pubDate>
      <link>https://forem.com/aws-builders/securing-your-applications-on-aws-guide-to-data-privacy-and-protection-2gji</link>
      <guid>https://forem.com/aws-builders/securing-your-applications-on-aws-guide-to-data-privacy-and-protection-2gji</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmjvaq4fu7fbkhq0l75d1.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmjvaq4fu7fbkhq0l75d1.jpg" alt=" " width="700" height="400"&gt;&lt;/a&gt;&lt;br&gt;
In today's data-driven world, businesses are increasingly entrusting sensitive information to cloud platforms like Amazon Web Services (AWS). While AWS offers a robust infrastructure and a multitude of security services, it's crucial for organizations to understand their shared responsibility model and implement appropriate security measures to protect their applications and data.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;u&gt;Understanding Your Role&lt;/u&gt;&lt;/strong&gt;&lt;br&gt;
Imagine you're storing your valuables in a bank. The bank is responsible for securing the building, the vaults, and the overall security infrastructure. However, you, as the owner of the valuables, are still responsible for protecting your specific belongings – your jewelry, cash, and important documents.&lt;/p&gt;

&lt;p&gt;In the cloud computing world, Amazon Web Services (AWS) is like the bank. They provide the secure infrastructure, the servers, and the network. But you, as the customer, are still responsible for protecting your applications, data, and the cloud resources you use.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Foundational Security Principles&lt;/strong&gt;&lt;br&gt;
To effectively secure applications on AWS, it's essential to adhere to fundamental security principles:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Implement robust IAM policies to control user access and permissions, ensuring only authorized individuals have access to sensitive resources.&lt;/li&gt;
&lt;li&gt;Grant users the minimum level of access necessary for their roles, minimizing the potential impact of compromised credentials.&lt;/li&gt;
&lt;li&gt;Encrypt data at rest and in transit using industry-standard algorithms and encryption keys managed securely by AWS Key Management Service (KMS).&lt;/li&gt;
&lt;li&gt;Utilize AWS network security services like VPCs, security groups, and network firewalls to restrict network traffic and protect against unauthorized access.&lt;/li&gt;
&lt;li&gt;Regularly scan applications and systems for vulnerabilities and promptly apply patches to address security weaknesses.&lt;/li&gt;
&lt;li&gt;Implement continuous monitoring and logging to detect suspicious activity, identify potential threats, and facilitate incident response.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Protecting Your Code&lt;/strong&gt;&lt;br&gt;
Application security is paramount in protecting against vulnerabilities that could expose sensitive data or compromise system integrity. Employ secure coding practices, conduct thorough code reviews, and implement Web Application Firewalls (WAFs) to filter and block malicious traffic&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Safeguarding Sensitive Information&lt;/strong&gt;&lt;br&gt;
Data privacy is a critical aspect of securing applications on AWS. Implement data masking and anonymization techniques to protect sensitive data during testing and development. Establish data governance policies to manage data access and usage. Comply with applicable data privacy regulations, such as the General Data Protection Regulation (GDPR) and the California Consumer Privacy Act (CCPA).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Utilizing AWS's Security Arsenal&lt;/strong&gt;&lt;br&gt;
AWS provides a comprehensive suite of security services to enhance application security and data privacy. Leverage services like AWS CloudTrail to audit API activity, AWS CloudWatch to monitor resource utilization and security events, and AWS CloudFormation to deploy secure infrastructure configurations.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Continuous Security - An Ongoing Process&lt;/strong&gt;&lt;br&gt;
Security is not a one-time endeavor; it's an ongoing process that requires continuous vigilance and adaptation. Regularly review and update security policies, train employees on security awareness, and conduct periodic security audits to identify and address potential vulnerabilities.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Conclusion&lt;/strong&gt;&lt;br&gt;
In essence, the comprehensive security measures outlined in this article create a multi-layered defense, transforming your AWS-hosted application into an impregnable fortress. The journey doesn't end here; it's an ongoing commitment to staying ahead of emerging threats, adapting to new challenges, and continually reinforcing the castle walls. By embracing these security principles, you not only protect your application but also contribute to the overall resilience of the digital realm in the face of an ever-evolving cybersecurity landscape.&lt;/p&gt;

</description>
      <category>aws</category>
      <category>appsec</category>
      <category>infosec</category>
      <category>devsecops</category>
    </item>
    <item>
      <title>Securing AWS Environments Against Ransomware</title>
      <dc:creator>Wilklins Nyatteng</dc:creator>
      <pubDate>Thu, 23 Nov 2023 07:58:47 +0000</pubDate>
      <link>https://forem.com/aws-builders/securing-aws-environments-against-ransomware-3a0d</link>
      <guid>https://forem.com/aws-builders/securing-aws-environments-against-ransomware-3a0d</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fccsz4f11vf7hewyexgou.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fccsz4f11vf7hewyexgou.jpg" alt=" " width="800" height="800"&gt;&lt;/a&gt;&lt;br&gt;
In today's increasingly interconnected world, organizations are turning to cloud platforms like Amazon Web Services (AWS) for their critical data and applications. This shift to the cloud has also introduced new security challenges, including the ever-present threat of ransomware. Ransomware is a type of malware that encrypts a victim's files, making them inaccessible until a ransom is paid. In recent years, ransomware attacks have become more sophisticated and costly, with businesses often facing significant financial losses and reputational damage.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4xo9mhv871hcoy6q1zg7.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4xo9mhv871hcoy6q1zg7.jpg" alt=" " width="800" height="438"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Before delving into specific mitigation strategies, it's crucial to understand AWS's shared responsibility model. AWS is responsible for securing the underlying cloud infrastructure, while customers are responsible for securing their own applications and data running on the platform. This shared responsibility model highlights the importance of implementing comprehensive security measures at both the AWS infrastructure level and the application level.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Common AWS Vulnerabilities Exploited by Ransomware Attacks&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Ransomware attackers often exploit specific vulnerabilities in AWS environments to gain access and execute their malicious code. Some of the most common AWS vulnerabilities targeted by ransomware include:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Excessive permissions granted to IAM users or roles can provide attackers with unauthorized access to critical resources.&lt;/li&gt;
&lt;li&gt;Publicly accessible S3 buckets can serve as a staging ground for attackers to store and execute malicious code.&lt;/li&gt;
&lt;li&gt;Weak passwords and insufficient access controls can make it easier for attackers to compromise user accounts and gain access to sensitive data.&lt;/li&gt;
&lt;li&gt;Outdated software running on AWS instances can contain vulnerabilities that attackers can exploit to gain access and execute their payloads.&lt;/li&gt;
&lt;li&gt;Inadequate network security controls, such as firewall misconfigurations, can allow attackers to penetrate the AWS environment and spread malware.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Mitigation Strategies to Harden AWS Environments Against Ransomware&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;To effectively protect against ransomware attacks, organizations should implement a multi-layered approach that encompasses both preventive and reactive measures. Some key mitigation strategies are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Grant IAM users and roles the minimum permissions necessary to perform their tasks. Regularly review and revoke unused or excessive permissions.&lt;/li&gt;
&lt;li&gt;Encrypt all S3 buckets, both at rest and in transit, to protect sensitive data from unauthorized access.&lt;/li&gt;
&lt;li&gt;Implement strong password policies that require complex passwords and regular password changes. Consider using multi-factor authentication (MFA) for added security.&lt;/li&gt;
&lt;li&gt;Implement a vulnerability management program to identify and patch software vulnerabilities promptly. Use automated patching tools to streamline the process.&lt;/li&gt;
&lt;li&gt;Implement network security controls, such as firewalls and intrusion detection systems, to monitor network traffic and block malicious activity.&lt;/li&gt;
&lt;li&gt;Regularly back up critical data to a secure location separate from the production environment. Establish a recovery plan to restore data in the event of a ransomware attack.&lt;/li&gt;
&lt;li&gt;Perform regular security assessments to identify and remediate vulnerabilities in the AWS environment.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In addition to the aforementioned mitigation strategies, you should also consider:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Providing regular security awareness training to educate employees about ransomware risks and phishing tactics.&lt;/li&gt;
&lt;li&gt;Implementing a security incident response plan: Establish a detailed security incident response plan to effectively respond to ransomware attacks and minimize downtime.&lt;/li&gt;
&lt;li&gt;Leveraging AWS security services, such as Amazon GuardDuty and Amazon Inspector, to monitor and protect your AWS environment from potential threats.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Conclusion&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Securing AWS environments against ransomware requires a comprehensive approach that combines preventive measures, reactive strategies, and continuous monitoring. By implementing the mitigation strategies outlined in this blog and staying vigilant about emerging threats, organizations can significantly reduce their risk of falling victim to ransomware attacks. Remember, security is an ongoing process, not a one-time event. Regularly evaluate and update your security posture to stay ahead of the ever-evolving threat landscape.&lt;/p&gt;

</description>
      <category>awssecurity</category>
      <category>ransomware</category>
      <category>infosec</category>
      <category>cloudsecurity</category>
    </item>
    <item>
      <title>Generative AI Security: What It Means for AWS Security</title>
      <dc:creator>Wilklins Nyatteng</dc:creator>
      <pubDate>Sun, 12 Nov 2023 12:49:38 +0000</pubDate>
      <link>https://forem.com/wilklins/generative-ai-security-what-it-means-for-aws-security-422g</link>
      <guid>https://forem.com/wilklins/generative-ai-security-what-it-means-for-aws-security-422g</guid>
      <description>&lt;p&gt;Generative AI is a type of artificial intelligence that can create new content, such as text, code, or images. It's like a creative writing machine, but instead of writing stories, it can write code, generate fake news, or even create deepfakes (videos or audio recordings that have been manipulated to make it look or sound like someone is saying or doing something they never actually said or did).&lt;/p&gt;

&lt;p&gt;Generative AI has the potential to be used for a lot of good, like creating new products and services, improving customer experiences, and automating tasks. But it can also be used for a lot of bad, like creating fake news, spam, malware, and deepfakes.&lt;/p&gt;

&lt;p&gt;So, what does generative AI security have to do with AWS Security? Well, AWS is a cloud computing platform that provides a variety of services that can be used to build and deploy generative AI applications. So, it's important for AWS users to be aware of the potential security risks associated with generative AI and to take steps to mitigate those risks.&lt;/p&gt;

&lt;p&gt;Here are a few of the top generative AI security risks that AWS users need to be aware of:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Misinformation and disinformation: Generative AI can be used to create fake news articles, social media posts, and other types of content that can be used to mislead people and spread disinformation.&lt;/li&gt;
&lt;li&gt;Malware: It can be used to create new types of malware that are more difficult to detect and defend against.&lt;/li&gt;
&lt;li&gt;Phishing attacks:Creating phishing emails and text messages that are more likely to fool people.&lt;/li&gt;
&lt;li&gt;Deepfakes: Generative AI can be used to create deepfakes that can be used to damage reputations, blackmail people, or even interfere with elections.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;AWS Security provides a variety of services and tools that can be used to mitigate the risks associated with generative AI. These services and tools include:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Amazon GuardDuty: This is a threat detection service that uses machine learning to analyze your AWS account for malicious activity. GuardDuty can identify suspicious activity related to generative AI workloads, such as the generation of large volumes of text or code, or the use of unusual APIs.&lt;/li&gt;
&lt;li&gt;Amazon Macie: It is a data classification and security service that uses machine learning to identify sensitive data in your AWS account. Macie can identify sensitive data that has been generated by generative AI models, such as personally identifiable information (PII) and financial data.&lt;/li&gt;
&lt;li&gt;Amazon Inspector: Inspector is a security assessment service that uses machine learning to identify vulnerabilities in your AWS applications. Inspector can identify vulnerabilities in generative AI applications, such as insecure code and misconfigurations.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;In addition to these services and tools, AWS Security also provides a number of best practices for securing generative AI workloads. These best practices include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Use a secure development lifecycle (SDLC) to develop and deploy your generative AI applications. This includes implementing security controls at all stages of the SDLC, from requirements gathering to deployment.&lt;/li&gt;
&lt;li&gt;Use a least privilege approach to grant access to generative AI resources. This means only granting users the access they need to perform their job duties.&lt;/li&gt;
&lt;li&gt;Monitor your generative AI workloads for suspicious activity. This includes monitoring the volume of traffic to and from your generative AI applications, as well as the types of content that are being generated.&lt;/li&gt;
&lt;li&gt;Implement security controls to prevent the misuse of generative AI outputs. This includes preventing generative AI models from generating sensitive data or malicious content.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;To sum it up, generative AI is like a double-edged sword, offering incredible possibilities and lurking security challenges. AWS Security steps in as the knight in shining armor, providing the tools needed to defend against the dark side of AI.&lt;/p&gt;

&lt;p&gt;Now, speaking of generative AI, here's a little joke for you: Why did the generative AI apply for a job as a stand-up comedian? Because it was great at creating "byte"-sized humor!&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
