AWS Cloud Security Builder
AWS Cloud Security Builder
000554427
1|Page
Table of Contents
Securing and Monitoring Resources with AWS.....................................................................................4
Phase 1: Securing data in Amazon S3........................................................................................................ 4
Description........................................................................................................................................................ 4
Observation...................................................................................................................................................... 4
Task 1.1: Create a bucket, apply a bucket policy, and test access.........................................4
Task 1.2: Enable versioning and object-level logging on a bucket.......................................5
Task 1.3: Implement the S3 Inventory feature on a bucket....................................................6
Task 1.4: Confirm that versioning works as intended..............................................................6
Task 1.5: Confirm object-level logging and query the access logs by using Athena....7
Phase 2: Securing VPCs.................................................................................................................................... 8
Description........................................................................................................................................................ 8
Observation...................................................................................................................................................... 8
Task 2.1: Review LabVPC and its associated resources...........................................................8
Task 2.2: Create a VPC flow log........................................................................................................... 9
Task 2.3: Access the WebServer instance from the internet and review VPC flow
logs in CloudWatch................................................................................................................................... 9
Task 2.4: Configure route table and security group settings...............................................10
Task 2.5: Secure the WebServerSubnet with a network ACL..............................................11
Task 2.6: Review NetworkFirewallVPC and its associated resources.............................12
Task 2.7: Create a network firewall................................................................................................12
Task 2.8: Create route tables............................................................................................................. 13
Task 2.9: Configure logging for the network firewall.............................................................14
Task 2.10: Configure the firewall policy and test access.......................................................15
Phase 3: Securing AWS resources by using AWS KMS.....................................................................16
Description..................................................................................................................................................... 16
Observation.................................................................................................................................................... 16
Task 3.1: Create a customer-managed key and configure key rotation..........................16
Task 3.2: Update the AWS KMS key policy and analyze an IAM policy...........................16
Task 3.3: Use AWS KMS to encrypt data in Amazon S3.........................................................17
Task 3.4: Use AWS KMS to encrypt the root volume of an EC2 instance........................18
Task 3.5: Use AWS KMS envelope encryption to encrypt data in place..........................19
Task 3.6: Use AWS KMS to encrypt a Secrets Manager secret............................................19
2|Page
Phase 4: Monitoring and logging...............................................................................................................20
Description..................................................................................................................................................... 20
Observation.................................................................................................................................................... 20
Task 4.1: Use CloudTrail to record Amazon S3 API calls.......................................................20
Task 4.2: Use CloudWatch Logs to monitor secure logs........................................................22
Task 4.3: Create a CloudWatch alarm to send notifications for security incidents...23
Task 4.4: Configure AWS Config to assess security settings and remediate the
configuration of AWS resources.......................................................................................................24
Reflection............................................................................................................................................................. 25
Certificate............................................................................................................................................................ 26
3|Page
Securing and Monitoring Resources with AWS
In this phase, I secure customer data in S3 so that only the right people can see it.
I first create a new bucket and apply a policy that lets only certain users read and write.
Then, I turned on versioning so I could track every change in each file. I also enable
server access logging so every request is recorded. Next, I set up S3 Inventory to get a
daily report of all objects. By the end, the bucket holds encrypted files and shows who
did what. Only the account manager, Paulo, can read it while Mary is blocked.
Observation
Task 1.1: Create a bucket, apply a bucket policy, and test access
I created a new S3 bucket (data–bucket–0df941711a7d39f06), uploaded a test
file, and then wrote a two-statement policy: one “Allow” for our IAM role plus two test
users (Paulo and Sofia) and a “Deny” for everyone else. Switching to Paulo’s login in
incognito, I confirmed Paulo could list and download objects only from the data-bucket,
and then switched to Mary to verify that access was blocked.
4|Page
Fig 1.2 Paulo can access the bucket and the objects in it.
5|Page
Fig 1.4 The S3 bucket Access log policy is added.
6|Page
and I verified that the older one still held only the original two rows. Switching to Mary, I
could not access the bucket.
Fig 1.6 Versioning is confirmed to be working as there are two versions visible.
Task 1.5: Confirm object-level logging and query the access logs by using
Athena
As the admin, I looked through the logs in s3-objects-access-log and used Athena
to create an external table over those logs. Using a SELECT query, I filtered for IAM-user
actions and saw HTTP status of 200 for Paulo and HTTP status of 403 for Mary.
Fig 1.7 The athena query shows that Paulo was able to access the csv file.
7|Page
Phase 2: Securing VPCs
Description
In this phase, I review the LabVPC’s subnets, route table, and the IAM role for
flow logs. Then, I create a VPC flow log to send all traffic data to CloudWatch. I test
access by trying HTTP and SSH from the internet and watch the flow-log entries to see
rejects. Next, I fix connectivity by adding an internet-gateway route. After that, I applied
a subnet ACL that blocks all traffic by default and then opens only ports 22 and 80.
Observation
Task 2.1: Review LabVPC and its associated resources
I observed that the LabVPC is in us-east-1, and I noted its WebServerSubnet,
main route table, and IAM role for flow logs. On EC2, I confirmed the WebServer
instance had a public IP and a security group.
8|Page
Fig 2.2 The IAM role for flow logs is available.
Task 2.3: Access the WebServer instance from the internet and review VPC
flow logs in CloudWatch
From Cloud9 IDE, I ran a netcat against the server’s HTTP (80) and SSH (22)
ports and saw that it timed out both times. In CloudWatch Logs, under
9|Page
LabVPCFlowLogs, entries appeared showing “REJECT” for my IP on those ports. This
confirmed that the flow log is capturing rejects as expected.
Fig 2.4 The CloudWatch logs show that HTTP and SSH netcat were rejected.
Fig 2.5 The route table is configured by adding 0.0.0.0/0 route to the internet gateway.
10 | P a g e
Fig 2.6 Inbound rules are added to the Webserver security group.
11 | P a g e
Task 2.6: Review NetworkFirewallVPC and its associated resources
I examined the second VPC (NetworkFirewallVPC)—its two subnets, Internet
Gateway, and default ACLs—and verified WebServer2 allowed HTTP, SSH, and port 8080.
12 | P a g e
Fig 2.10 NetworkFirewall created in networkfirewallVPC.
13 | P a g e
Fig 2.12: The Firewall route table is created.
14 | P a g e
Fig 2.14 The logs are being created for NetworkFirewall.
15 | P a g e
Phase 3: Securing AWS resources by using AWS KMS
Description
In phase 3, I create a customer-managed key named MyKMSKey, grant my Voclabs role
administrative and usage permissions, and enable automatic annual rotation. I then
switch an S3 bucket’s encryption to SSE-KMS, verify that authorized users can upload
while others can’t, and launch an EC2 instance with its root volume encrypted by the
key. On WebServer2, I practice envelope encryption by generating a data key with AWS
KMS generate-data-key, encrypting and decrypting a local text file via OpenSSL, and
confirming it works. Finally, I secure a Secrets Manager secret by creating “mysecret”
encrypted under MyKMSKey, then retrieve it over SSH with aws secretsmanager get-
secret-value to prove the integration.
Observation
Task 3.1: Create a customer-managed key and configure key rotation
I created an AWS KMS customer-managed key named MyKMSKey, granted the
voclabs role Key administrator and Key user permissions, and turned on annual
rotation.
Task 3.2: Update the AWS KMS key policy and analyze an IAM policy
I modified the key policy MyKMSKey also to allow Sofia’s IAM user to use it. Then
I reviewed the PolicyForFinancialAdvisors IAM policy, noting it grants S3 complete
16 | P a g e
control, plus KMS decrypt/encrypt, and Sofia is a member of the FinancialAdvisorGroup
IAM group.
17 | P a g e
Fig 3.4 The user Paulo cant access the file.
Task 3.4: Use AWS KMS to encrypt the root volume of an EC2 instance
I launched a new EC2 called EncryptedInstance with Amazon Linux 2 AMI as the
AMI and t2.micro as the instance type, and selected MyKMSKey for encrypting its AMI
root volume. Inspecting the Storage tab confirmed the volume was encrypted.
18 | P a g e
Task 3.5: Use AWS KMS envelope encryption to encrypt data in place
On WebServer2, I generated a data key using AWS KMS generate-data-key, stored
the CiphertextBlob, decrypted it when needed, and finally used OpenSSL to encrypt and
decrypt a text file called data_unencrypted.txt and confirmed if the file was encrypted.
19 | P a g e
Fig 3.7 The value of mysecret is retrieved from webserver2.
Observation
Task 4.1: Use CloudTrail to record Amazon S3 API calls
I created a trail called “data-bucket-reads-writes” that captures both
management and data events in the cloudtrail-logs bucket. After uploading customer-
data.csv, I used Athena to create an external table over those logs and ran a query for my
PutObject events. The query I used was :
Step 5:
SELECT
eventTime,
userIdentity.principalId,
requestParameters,
eventName
FROM cloudtrail_logs_cloudtrail_logs_0df941711a7d39f06
LIMIT 10;
20 | P a g e
Step 6:
SELECT
eventTime,
sourceipaddress,
useragent,
userIdentity.principalId,
requestParameters,
eventName
FROM cloudtrail_logs_cloudtrail_logs_0df941711a7d39f06
LIMIT 10;
21 | P a g e
Fig 4.2 Athena query for og information for when i opened the customer-data.csv file.
Fig 4.3 Installed the linux demaon and cloudagent in the encrypted instance.
22 | P a g e
Fig 4.4 The unsuccessful login was captured in the log.
23 | P a g e
Task 4.4: Configure AWS Config to assess security settings and remediate
the configuration of AWS resources
I enabled AWS Config to record all resources, added the AWS managed rule
named s3-bucket-logging-enabled, and saw my test bucket flagged as noncompliant. I
then walked through the AWS Config console to manually remediate the issue by
enabling server access by logging in to that bucket.
Fig 4.6 AWS config is set up and a rule is added for S3 bucket logging.
24 | P a g e
Fig 4.8 The compliance bucket is remediated and is now compliant.
Reflection
Over the course of this project, I increased my understanding of AWS security
services, such as fine-grained S3 bucket policies, versioning, and inventory, as well as
VPC flow logs, network ACLs, and AWS Network Firewall. I understood how to use the
KMS key creation, envelope encryption, and Secrets Manager integration, as well as
CloudTrail, CloudWatch alarms, and AWS Config for continuous monitoring. One of the
challenges I faced was creating JSON files for the bucket policy and an Athena query.
25 | P a g e
Certificate
26 | P a g e