Cloud Security Labs to learn IAM policies following the least privilege principle.
These labs can be setup using terraform and setup AWS resources.
- Familiarity with AWS console.
- Comfortable using command-line tools to log in to servers, install packages, execute scripts and applications
- Basics of Networking concepts enough to understand Cloud Architecture.
- Configured AWS CLI with
AdministratorAccess
.
- Clone the github repository via
git clone https://github.com/justmorpheus/ch1_iam
- Setup the aws cli via
* Signup/Signin to aws console
* In the search bar type IAM
* Click on Users on the sidebar
* Click on add user, you will be redirected to a new page
* Fill the user name you wish
* In the Access type checkbox selection select Programmatic access and click Next
* Now select Attach existing policies directly
* In the search bar enter AdministratorAccess
* Now select the one which has a Policy name as AdministratorAccess and click Next and again click Next
* Now click Create User
* Now you can download the csv file that will have your access-key and secret-key
* Open terminal and run `aws configure`.
-
Basic Terraform
- Step 1: Change directory:
cd ch1_iam/
- Step 2: Initialize the terraform plugins via
terraform init
- Step 3: Describe the plan of action via
terraform plan
- Step 4: Now create the infrastructure via
terraform apply
- Step 1: Change directory:
NOTE: To skip typing yes try terraform apply --auto-approve.
-
Once the terraform apply is complete, it will give output of above created resources.
-
The terraform creates a lab environment consisting of:
- EC2 Instance with an IAM role attached (access to SSM is granted for Session Manager access)
- S3 bucket
- SSM parameters
-
Make a note with the outputs of the stack: IamRole, S3Bucket.
-
Connect to the EC2 instance using SSM Session Manager - Visit https://console.aws.amazon.com/systems-manager/session-manager/start-session - Select your instance - Push the Start Session button - Jump to your home directory: cd ~
- Lab 01: S3 read access
- Lab 02: S3 read and write with prefix
- Lab 03: Parameter Store read access
- Lab 04: Grant access to KMS customer managed CMK
- Lab 05: Terminate EC2 instance with tag
- Lab 06: Launch EC2 instance with tag
- Destroy your infrastructure via
terraform destroy --auto-approve
.
This AWS workshops has been tailored to your needs, for the original lab see widdix/learn-*.