AWS Assignment– 4
VPC, IAM & Secrets for Linux Learners
Basic Questions
- Create a new VPC with CIDR block 10.0.0.0/16.
- Create two subnets (one public, one private) inside the VPC.
- Attach an Internet Gateway (IGW) to the VPC.
- Create a route table and associate it with the public subnet.
- Verify that an EC2 instance in the public subnet can access the internet.
- Launch an EC2 instance in the private subnet and check internet access (should fail).
- Create a NAT Gateway in the public subnet.
- Update the private subnet route table to use the NAT Gateway for internet access.
- Verify that the private instance now has internet access through NAT.
- List all VPCs in your account using the AWS CLI.
- Create a new IAM user with programmatic access (access key + secret key).
- Configure AWS CLI on Linux with the IAM user’s credentials.
- Create an IAM group named LinuxAdmins.
- Attach the AmazonEC2FullAccess policy to the group.
- Add the new IAM user to the LinuxAdmins group.
- Use AWS CLI to check IAM user permissions.
- Create an IAM role for EC2 with S3 read-only access.
- Attach the role to an EC2 instance and list S3 buckets from it.
- Create a parameter in SSM Parameter Store with type String.
- Retrieve the parameter value from Linux EC2 using AWS CLI.
Intermediate Questions
- Create a custom security group in your VPC that allows only SSH (22) and HTTP (80).
- Launch an EC2 instance in the VPC using this security group.
- Create a second VPC and configure a VPC peering connection with the first.
- Update route tables to allow communication between the two VPCs.
- Test connectivity between EC2 instances in peered VPCs (ping test).
- Create an IAM policy that allows only read access to S3.
- Attach the policy to a new IAM user and verify limited permissions.
- Rotate access keys for an IAM user and test both old and new keys.
- Create an IAM role with EC2 + CloudWatch permissions.
- Launch an EC2 instance with this IAM role and push custom logs to CloudWatch.
- Create a SecureString parameter in SSM Parameter Store with KMS encryption.
- Retrieve the SecureString parameter value from EC2 using AWS CLI.
- Store a database password in Secrets Manager.
- Retrieve the secret value using AWS CLI with proper IAM permissions.
- Test what happens if IAM user without permissions tries to access Secrets Manager.
- Enable MFA (Multi-Factor Authentication) for an IAM user.
- Document the steps for connecting to AWS CLI with MFA.
- Create a parameter hierarchy in SSM (/dev/db/username, /dev/db/password).
- Retrieve multiple parameters using the get-parameters-by-path CLI command.
- Write a short note on differences between SSM Parameter Store and Secrets Manager.
Advanced Questions
- Design a VPC with 3-tier architecture (public, private-app, private-db subnets).
- Configure NAT Gateway for app tier and ensure DB tier has no internet access.
- Write a custom IAM policy that allows listing EC2 instances but denies deletion.
- Attach this policy to a user and verify via AWS CLI.
- Use IAM roles to allow one EC2 instance to access S3 and another instance to access DynamoDB.
- Store API keys in Secrets Manager and retrieve them securely from EC via CLI.
- Automate retrieval of SSM parameters inside a Linux shell script for app configuration.
- Enable CloudWatch logging for VPC flow logs and analyze traffic logs.
- Configure cross-account access for an IAM user using trust policies.
- Final Hands-on Project:
- Create a secure VPC with public + private subnets
- Configure NAT Gateway for private subnet
- Create IAM users, groups, and roles with least privilege
- Store app credentials in SSM Parameter Store & Secrets Manager
- Access secrets securely from EC2 via AWS CLI
- Enable logging & MFA for compliance