-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
baa7ee1
commit 6ef77fc
Showing
51 changed files
with
1,401 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
--- | ||
name: Bug report | ||
about: Create a report to help us improve | ||
title: '' | ||
labels: bug | ||
assignees: '' | ||
|
||
--- | ||
|
||
**Describe the bug** | ||
A clear and concise description of what the bug is. | ||
|
||
**To Reproduce** | ||
Steps to reproduce the behavior: | ||
1. Go to '...' | ||
2. Click on '....' | ||
3. Scroll down to '....' | ||
4. See error | ||
|
||
**Expected behavior** | ||
A clear and concise description of what you expected to happen. | ||
|
||
**Screenshots** | ||
If applicable, add screenshots to help explain your problem. | ||
|
||
**Desktop (please complete the following information):** | ||
- OS: [e.g. iOS] | ||
- Browser [e.g. chrome, safari] | ||
- Version [e.g. 22] | ||
|
||
**Additional context** | ||
Add any other context about the problem here. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
--- | ||
name: Recipe request | ||
about: Suggest a recipe for this Chapter | ||
title: '' | ||
labels: enhancement | ||
assignees: '' | ||
|
||
--- | ||
|
||
**Is your recipe request related to a problem? Please describe.** | ||
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] | ||
|
||
**Describe what you'd like to learn** | ||
A clear and concise description of what you want to happen. | ||
|
||
**Describe alternatives you've considered** | ||
A clear and concise description of any alternative solutions or features you've considered. | ||
|
||
**Additional context** | ||
Add any other context or screenshots about the feature request here. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
assume-role-policy.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Creating and Assuming an IAM Role for Developer Access | ||
## Clean up | ||
### Detach the PowerUserAccess policy from the role: | ||
``` | ||
aws iam detach-role-policy --role-name AWSCookbook101Role \ | ||
--policy-arn arn:aws:iam::aws:policy/PowerUserAccess | ||
``` | ||
|
||
### Delete the IAM role: | ||
|
||
`aws iam delete-role --role-name AWSCookbook101Role` | ||
|
||
### Unset your local variables: | ||
``` | ||
unset ROLE_ARN | ||
unset PRINCIPAL_ARN | ||
``` |
12 changes: 12 additions & 0 deletions
12
101-Creating-and-Assuming-an-IAM-Role/assume-role-policy-template.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"Version": "2012-10-17", | ||
"Statement": [ | ||
{ | ||
"Effect": "Allow", | ||
"Principal": { | ||
"AWS": "PRINCIPAL_ARN" | ||
}, | ||
"Action": "sts:AssumeRole" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Generate a Least Privilege IAM Policy Based on Access Patterns | ||
|
||
## Clean up | ||
### Delete the IAM policy that you created |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# Enforcing IAM User Password Policies in Your AWS Account | ||
|
||
## Clean up | ||
### Delete the login profiles that you created (including the validation step user): | ||
``` | ||
aws iam delete-login-profile --user-name awscookbook103user | ||
aws iam delete-login-profile --user-name awscookbook103user2 | ||
``` | ||
|
||
### Remove the user from the group: | ||
``` | ||
aws iam remove-user-from-group --user-name awscookbook103user \ | ||
--group-name AWSCookbook103Group | ||
``` | ||
|
||
### Detach the policy from the group: | ||
``` | ||
aws iam detach-group-policy --group-name AWSCookbook103Group \ | ||
--policy-arn arn:aws:iam::aws:policy/AWSBillingReadOnlyAccess | ||
``` | ||
|
||
### Delete the group: | ||
`aws iam delete-group --group-name AWSCookbook103Group` | ||
|
||
### Delete the users that you created (including the validation step user): | ||
``` | ||
aws iam delete-user --user-name awscookbook103user | ||
aws iam delete-user --user-name awscookbook103user2 | ||
``` | ||
|
||
### Delete the account password policy that you configured: | ||
`aws iam delete-account-password-policy` | ||
|
||
### Unset the local variables you created: | ||
``` | ||
unset RANDOM_STRING | ||
unset RANDOM_STRING2 | ||
``` |
13 changes: 13 additions & 0 deletions
13
104-Testing-IAM-Policies-with-the-IAM-Policy-Simulator/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# Testing IAM Policies with the IAM Policy Simulator | ||
|
||
## Clean up | ||
### Step Text | ||
Detach the AmazonEC2ReadOnlyAccess policy from the role: | ||
``` | ||
aws iam detach-role-policy --role-name AWSCookbook104IamRole \ | ||
--policy-arn arn:aws:iam::aws:policy/AmazonEC2ReadOnlyAccess | ||
``` | ||
|
||
Delete the IAM Role for the proxy: | ||
|
||
`aws iam delete-role --role-name AWSCookbook104IamRole` |
13 changes: 13 additions & 0 deletions
13
104-Testing-IAM-Policies-with-the-IAM-Policy-Simulator/assume-role-policy.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"Version": "2012-10-17", | ||
"Statement": [ | ||
{ | ||
"Effect": "Allow", | ||
"Principal": { | ||
"Service": "ec2.amazonaws.com" | ||
}, | ||
"Action": "sts:AssumeRole" | ||
} | ||
] | ||
} | ||
|
3 changes: 3 additions & 0 deletions
3
105-Delegating-IAM-Administrative-Capabilities-Using-Permissions-Boundaries/.gitignore
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
assume-role-policy.json | ||
policy.json | ||
boundary-policy.json |
56 changes: 56 additions & 0 deletions
56
...legating-IAM-Administrative-Capabilities-Using-Permissions-Boundaries/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
# Delegating IAM Administrative Capabilities Using Permissions Boundaries | ||
|
||
## Clean up | ||
|
||
### Unset the variables you set to assume the AWSCookbook105 role in your terminal: | ||
``` | ||
unset AWS_ACCESS_KEY_ID | ||
unset AWS_SECRET_ACCESS_KEY | ||
unset AWS_SESSION_TOKEN | ||
``` | ||
|
||
### Detach the AmazonDynamoDBFullAccess and CloudWatchFullAccess policy from the role: | ||
``` | ||
aws iam detach-role-policy --role-name AWSCookbook105test1 \ | ||
--policy-arn arn:aws:iam::aws:policy/AmazonDynamoDBFullAccess | ||
aws iam detach-role-policy --role-name AWSCookbook105test1 \ | ||
--policy-arn arn:aws:iam::aws:policy/CloudWatchFullAccess | ||
``` | ||
|
||
### Delete the IAM Role you used to test: | ||
``` | ||
aws iam delete-role --role-name AWSCookbook105test1 | ||
``` | ||
|
||
### Detach the Policy you created from the role: | ||
``` | ||
aws iam detach-role-policy --role-name AWSCookbook105Role \ | ||
--policy-arn arn:aws:iam::$AWS_ACCOUNT_ID:policy/AWSCookbook105Policy | ||
``` | ||
|
||
### Delete the policy: | ||
``` | ||
aws iam delete-policy --policy-arn \ | ||
arn:aws:iam::$AWS_ACCOUNT_ID:policy/AWSCookbook105Policy | ||
``` | ||
|
||
### Delete the permissions boundary: | ||
``` | ||
aws iam delete-policy --policy-arn \ | ||
arn:aws:iam::$AWS_ACCOUNT_ID:policy/AWSCookbook105PB | ||
``` | ||
|
||
### Delete the IAM Role: | ||
``` | ||
aws iam delete-role --role-name AWSCookbook105Role | ||
``` | ||
|
||
### Unset the variables you set: | ||
``` | ||
unset PRINCIPAL_ARN | ||
unset ROLE_ARN | ||
unset TEST_ROLE_1 | ||
unset creds | ||
``` | ||
|
12 changes: 12 additions & 0 deletions
12
...Administrative-Capabilities-Using-Permissions-Boundaries/assume-role-policy-template.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"Version": "2012-10-17", | ||
"Statement": [ | ||
{ | ||
"Effect": "Allow", | ||
"Principal": { | ||
"AWS": "PRINCIPAL_ARN" | ||
}, | ||
"Action": "sts:AssumeRole" | ||
} | ||
] | ||
} |
39 changes: 39 additions & 0 deletions
39
...AM-Administrative-Capabilities-Using-Permissions-Boundaries/boundary-policy-template.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
{ | ||
"Version": "2012-10-17", | ||
"Statement": [ | ||
{ | ||
"Sid": "CreateLogGroup", | ||
"Effect": "Allow", | ||
"Action": "logs:CreateLogGroup", | ||
"Resource": "arn:aws:logs:*:AWS_ACCOUNT_ID:*" | ||
}, | ||
{ | ||
"Sid": "CreateLogStreamandEvents", | ||
"Effect": "Allow", | ||
"Action": [ | ||
"logs:CreateLogStream", | ||
"logs:PutLogEvents" | ||
], | ||
"Resource": "arn:aws:logs:*:AWS_ACCOUNT_ID:*" | ||
}, | ||
{ | ||
"Sid": "DynamoDBPermissions", | ||
"Effect": "Allow", | ||
"Action": [ | ||
"dynamodb:PutItem", | ||
"dynamodb:UpdateItem", | ||
"dynamodb:DeleteItem" | ||
], | ||
"Resource": "arn:aws:dynamodb:*:AWS_ACCOUNT_ID:table/AWSCookbook*" | ||
}, | ||
{ | ||
"Sid": "S3Permissions", | ||
"Effect": "Allow", | ||
"Action": [ | ||
"s3:GetObject", | ||
"s3:PutObject" | ||
], | ||
"Resource": "arn:aws:s3:::AWSCookbook*/*" | ||
} | ||
] | ||
} |
13 changes: 13 additions & 0 deletions
13
...M-Administrative-Capabilities-Using-Permissions-Boundaries/lambda-assume-role-policy.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"Version": "2012-10-17", | ||
"Statement": [ | ||
{ | ||
"Effect": "Allow", | ||
"Principal": { | ||
"Service": "lambda.amazonaws.com" | ||
}, | ||
"Action": "sts:AssumeRole" | ||
} | ||
] | ||
} | ||
|
10 changes: 10 additions & 0 deletions
10
...elegating-IAM-Administrative-Capabilities-Using-Permissions-Boundaries/lambda_function.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import json | ||
import os | ||
import sys | ||
|
||
def lambda_handler(event, context): | ||
|
||
return { | ||
'statusCode': 200, | ||
'body': json.dumps('Hello AWSCookbook Reader!') | ||
} |
88 changes: 88 additions & 0 deletions
88
...egating-IAM-Administrative-Capabilities-Using-Permissions-Boundaries/policy-template.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
{ | ||
"Version": "2012-10-17", | ||
"Statement": [ | ||
{ | ||
"Sid": "DenyPBDelete", | ||
"Effect": "Deny", | ||
"Action": "iam:DeleteRolePermissionsBoundary", | ||
"Resource": "*" | ||
}, | ||
{ | ||
"Sid": "IAMRead", | ||
"Effect": "Allow", | ||
"Action": [ | ||
"iam:Get*", | ||
"iam:List*" | ||
], | ||
"Resource": "*" | ||
}, | ||
{ | ||
"Sid": "IAMPolicies", | ||
"Effect": "Allow", | ||
"Action": [ | ||
"iam:CreatePolicy", | ||
"iam:DeletePolicy", | ||
"iam:CreatePolicyVersion", | ||
"iam:DeletePolicyVersion", | ||
"iam:SetDefaultPolicyVersion" | ||
], | ||
"Resource": "arn:aws:iam::AWS_ACCOUNT_ID:policy/AWSCookbook*" | ||
}, | ||
{ | ||
"Sid": "IAMRolesWithBoundary", | ||
"Effect": "Allow", | ||
"Action": [ | ||
"iam:CreateRole", | ||
"iam:DeleteRole", | ||
"iam:PutRolePolicy", | ||
"iam:DeleteRolePolicy", | ||
"iam:AttachRolePolicy", | ||
"iam:DetachRolePolicy" | ||
], | ||
"Resource": [ | ||
"arn:aws:iam::AWS_ACCOUNT_ID:role/AWSCookbook*" | ||
], | ||
"Condition": { | ||
"StringEquals": { | ||
"iam:PermissionsBoundary": "arn:aws:iam::AWS_ACCOUNT_ID:policy/AWSCookbook105PB" | ||
} | ||
} | ||
}, | ||
{ | ||
"Sid": "ServerlessFullAccess", | ||
"Effect": "Allow", | ||
"Action": [ | ||
"lambda:*", | ||
"logs:*", | ||
"dynamodb:*", | ||
"s3:*" | ||
], | ||
"Resource": "*" | ||
}, | ||
{ | ||
"Sid": "PassRole", | ||
"Effect": "Allow", | ||
"Action": "iam:PassRole", | ||
"Resource": "arn:aws:iam::AWS_ACCOUNT_ID:role/AWSCookbook*", | ||
"Condition": { | ||
"StringLikeIfExists": { | ||
"iam:PassedToService": "lambda.amazonaws.com" | ||
} | ||
} | ||
}, | ||
{ | ||
"Sid": "ProtectPB", | ||
"Effect": "Deny", | ||
"Action": [ | ||
"iam:CreatePolicyVersion", | ||
"iam:DeletePolicy", | ||
"iam:DeletePolicyVersion", | ||
"iam:SetDefaultPolicyVersion" | ||
], | ||
"Resource": [ | ||
"arn:aws:iam::AWS_ACCOUNT_ID:policy/AWSCookbook105PB", | ||
"arn:aws:iam::AWS_ACCOUNT_ID:policy/AWSCookbook105Policy" | ||
] | ||
} | ||
] | ||
} |
Oops, something went wrong.