Random Tips & Tricks

 Home

Welcome! Here i will be going over the more confusing parts i ran into while studying AWS

Navigate:

Chapter 1: Gateways
Chapter 2: Secrets manager
Chapter 3: IAM policy basics

Chapter 1: The Gateways!

ALL THESE DANG GATEWAYS!!!

Storage gateway, transit gateway, Nat gateway internet gateway API gateway, file gateway, tape gateway, volume gateway, you gateway, me gateway, us gateway, all these damn gateways, how do you tell the difference? 



   

Solution:  Seperate!  

The Gateways can be seperated into two basic categories:

1. Storage Gateway (file, tape, volume)

2. VPC Gateways (transit, nat, internet)

3. Endpoints (VPC interface, VPC Gateway)




1. Storage Gateway

In the simplest terms possible, Storage Gateway is a Suite of tools that give companies the ability to extend their already existent on premise databases into the cloud without a full migration.

1a. File gateway - extends your on premise file systems ( windows SMB/NFS) into amazon FSx or s3

  1b. Tape Gateway - extends your backup servers (ISCSI VTL) into an s3 tape library or s3 glacier tape archive

1c. Volume Gateway -    extends your block storage iscsi into aws s3, which then makes a copy via EBS                                                                                                                                                                                                                                                                                                                                                                                                   

2. VPC Gateways -

VPC gateways are the main three tools that help items within your VPC connect with the outside world

2a. Internet Gateway - The internet gateway is the logical connection your VPC has to the internet. Everything connecting to the internet in your subnet is going through that gateway to get access.  

2b. NAT Gateway - is a tool through which instances in a private subnet can access the internet, but external resources cannot connect with your instances

2c.  Transit Gateway -  A "cloud router" to connect multiple VPCs  together.                                                                                                                                                                                                                                                                                                                                                              

3. Endpoints:

The Endpoints are AWS services that connect your EC2 instances to AWS services through a private link

3a. VPC Interface Endpoint - A privatelink secure connection from your VPC to most AWS services (SNS, system manager, cloudtrail, cloudwatch, KMS, STS, and more)

3b. VPC Gateway Endpoint  - A special privatelink secure connection from your VPC to S3 and Dynamodb
         

Chapter 2: Secrets manager vs Parameter Store

Top

CAN SOMEONE JUST MANAGE MY SECRETS?

They both can manage secrets, they both allow KMS encryption, and they both are giving me headaches while studying for the security specialty exam, so how do i differentiate them?



   

Solution:  Cost and Tier levels

Parameter store is a cheaper option can store any parameters but offers few extra features

Secrets manager is a higher cost premium service that offers secrets storing and more bells and whistles 

Here's a summary: 




1. AWS System Manager Parameter Store 

Parameter store is a feature of AWS System Manager that provides storage for not only credentials, but also configuration files, licenses codes and more in one secure place.    

This is how it works:
- Your application sends a parameter request to SSM Parameter Store. 

- If this is a plaintext parameter request, Parameter Store checks with IAM if the user/role is allowed to retrieve the parameter. 

- If this is an encrypted parameter request, Parameter Store checks with IAM if the user/role is allowed to both retrieve and decrypt the parameter with AWS KMS. 

- Decryption requires that the IAM has KMS Decrypt permission.
If IAM verification is successful, Parameter Store sends back the parameter value to the application.                       


2. AWS Secrets Manager -enables you to easily rotate, manage, and retrieve database credentials, API keys, and other secrets throughout their lifecycle. Can do everything that parameter store can do, and more, including rotating keys, cross account access and generating passwords. it also costs more coming in at .40 per secret. 

Secrets manager works just like parameter store in practice with more features and abilities.  

Watch the videos below for cool overviews and walkthroughs of secrets manager:                                                                                                                                                                                                                                                                                                                         

Chapter 3: IAM policy basics 

Top

What is an "IAM policy", and why does it look so weird.





   


An IAM Policy is your written law on what anything (account or resource) is and is not allowed to do within your AWS account. It is the single most powerful tool in AWS. 

I read the documentation so you didnt have too

Here is an example, Lets do a deep dive, below!

The Parts of an IAM Policy

Version
  • The Version specifies the syntax rules version that are being used to process the policy
  • Current version is 2012-10-17
  • Previous version is 2008-10-17 (a lot of newer variables will not work with this version)
Learn More
SID
  • SID is the optional identifier, you can use numbers or letters, and can use this as an identification.
Learn More
Statement

- Statement is the main element of the policy, it is where it indicates the start of the  actual commands of the policy

Learn More
Effect

- Effect tells the policy whether you are allowing something to happen or denying it. 
- It is a required element, the only values are "Allow" or "Deny"
        

Learn More
Action

    - Action describes what specific actions you want to be denied or allowed
-   - Every AWS service has its own set of spefic actions that can be placed inside this element
    - Below there will be a list of the most important actions to look out for in policies 
    - Example:  "Action": "ec2:StartInstances"

Learn More
Resource 

 - Resource specifies the object (IAM account/service/file/other) that the statement covers 

Examples:
      "Resource": "arn:aws:s3:::DOC-EXAMPLE-BUCKET/*/test/*"
    "Resource": "arn:aws:iam::account-ID-without-hyphens:user/Bob"
          "Resource": [ "arn:aws:dynamodb:us-east-2:account-ID-without-hyphens:table/books_table",                             "arn:aws:dynamodb:us-east-2:account-ID-without-hyphens:table/magazines_table" ]


Learn More
Principal

- The Principal elementis only used for Resource Based Policies
- Is used to specify which principals are allowed or denied access to a service.
- Principal: an AWS term for an IAM user/account/role/ AWS Service, 

Learn More
Condition

- Condition lets you specify conditions to when a policy is in effect.
- You can specify cool things like:
           - IP address
           - usernames
           - MFA has to be activated and much more

Learn More

The Two main types of policies:

1.  Identity Based Policy 
Policies that are attached to an IAM user, group or role. These policies specify what that identity is allowed to do. 
The red-text policy is an example of an Identity Based Policy
- in this policy, it is giving a IAM user, group or role the ability to detach and attach volumes to the specified ec2 instances. 



2. Resource Based Policy  -

Policies that are attached to a resource, for example bucket policies, Key policies and other.    
The policy with the green spine is an example of a Resource based policy.

In this policy access is being given to "Putobject" (place things inside the bucket) and "GetObject" (download things from the bucket)   from the awssecurity bucket. if coming from the ip address listed. and stuarts account

Notice that it has a "Principal" tag which are found primarily in resource based policies  
      

Here are some important Actions! 

S3 actions
  • PutObject: grants permissions to add object to bucket (you gain write permission)
  • GetObject : grants permission to retrieve objects from s3 (you gain read permissions
  • GetBucketPolicy: you may return the specific policy  of the bucket (read access)
  • DeleteObject: grants permission to remove the null version of an object and insert a delete marker
  • DeleteObjecVersion: removes a specific version of an object 
EC2
  • RunInstances: gives you the ability to launch instances
  • RebootInstances: gives you the ability to reboot instances
  • GetConsoleScreenshot: gives you a jpeg of a running instance
IAM
  • CreateServiceLinkedRole: gives permission to create an IAM role that allows service to do things on your behalf 
  • GetPolicy: grants permission to retrieve info on specific managed policy 
  • GetUser: allows them to get information about a specifice user 

Get A little better everyday!

Top