-
-
Save an00byss/b5e796468c205fa91bd71ff3c4aa447d to your computer and use it in GitHub Desktop.
Revisions
-
davidmoremad revised this gist
Jun 4, 2019 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,4 @@ # AWS-CLI Cheatsheet ## Table of content -
davidmoremad renamed this gist
Jun 3, 2019 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
davidmoremad revised this gist
Jun 3, 2019 . 1 changed file with 4 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -3,7 +3,7 @@ ## Table of content * [Installation](#installation) * [EC2](#ec2) * [UTIL: List all instances](#EC2-UTIL-List-all-instances) * [UTIL: List specific fields of all instances](#EC2-UTIL-List-specific-fields-of-all-instances) * [UTIL: List all instances of a product](#EC2-UTIL-List-all-instances-of-a-product) @@ -12,21 +12,21 @@ * [UTIL: List all snapshots in the date specified](#EC2-UTIL-List-all-snapshots-in-the-date-specified) * [SEC: List all snapshots without encryption](#EC2-SEC-List-all-snapshots-without-encryption) * [SEC: List SecurityGroups with SSH open to Internet](#EC2-SEC-List-SecurityGroups-with-SSH-open-to-Internet) * [IAM](#iam) * [UTIL: List certificates](#IAM-UTIL-List-certificates) * [UTIL: List policies](#IAM-UTIL-List-policies) * [UTIL: List policies attached to a group](#IAM-UTIL-List-policies-attached-to-a-group) * [UTIL: List users of a group](#IAM-UTIL-List-users-of-a-group) * [UTIL: List groups of a user](#IAM-UTIL-List-groups-of-a-user) * [SEC: Access Keys Rotation](#IAM-SEC-Access-Keys-Rotation) * [SEC: User with MFA enabled ](#IAM-SEC-User-with-MFA-enabled) * [S3](#s3) * [UTIL: List buckets](#S3-UTIL-List-buckets) * [UTIL: List bucket objects](#S3-UTIL-List-bucket-objects) * [SEC: Bucket with public READ access](#S3-SEC-Bucket-with-public-READ-access) * [SEC: Bucket with public WRITE access](#S3-SEC-Bucket-with-public-WRITE-access) * [SEC: Bucket with public FULL_CONTROL access](#S3-SEC-Bucket-with-public-FULL_CONTROL-access) * [RDS](#rds) * [UTIL: List databases](#RDS-UTIL-List-databases) * [SEC: List Databases without DeletionProtection enabled](#RDS-SEC-List-Databases-without-DeletionProtection-enabled) * [SEC: List Public Databases](#RDS-SEC-List-Public-Databases) -
davidmoremad revised this gist
Jun 3, 2019 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -35,6 +35,8 @@ ## Installation Ref: https://docs.aws.amazon.com/es_es/cli/latest/userguide/cli-chap-welcome.html | Function | Command | |---------------------------|---------------------------------------| | Install awscli | `pip3 install awscli --upgrade --user` | -
davidmoremad revised this gist
Jun 3, 2019 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -202,5 +202,5 @@ aws rds describe-db-instances \ #### RDS-SEC: List Public Databases ``` aws rds describe-db-instances \ --query 'DBInstances[?PubliclyAccessible=="true"].[DBInstanceIdentifier,Endpoint.Address]' ``` -
davidmoremad revised this gist
Jun 3, 2019 . 1 changed file with 6 additions and 6 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,6 @@ # AWS Cheatsheet ## Table of content * [Installation](#installation) * EC2 @@ -33,7 +33,7 @@ --- ## Installation | Function | Command | |---------------------------|---------------------------------------| @@ -42,7 +42,7 @@ --- ## EC2 #### EC2-UTIL: List all instances ``` @@ -97,7 +97,7 @@ aws ec2 describe-security-groups \ --- ## IAM #### IAM-UTIL: List certificates ``` @@ -142,7 +142,7 @@ if [[ $(aws iam list-mfa-devices --user-name root --output text) ]]; then echo " --- ## S3 #### S3-UTIL: List buckets ``` @@ -183,7 +183,7 @@ aws s3api list-buckets \ --- ## RDS #### RDS-UTIL: List databases ``` -
davidmoremad revised this gist
Jun 3, 2019 . 1 changed file with 8 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -33,7 +33,7 @@ --- # Installation | Function | Command | |---------------------------|---------------------------------------| @@ -42,6 +42,8 @@ --- # EC2 #### EC2-UTIL: List all instances ``` aws ec2 describe-instances @@ -95,6 +97,8 @@ aws ec2 describe-security-groups \ --- # IAM #### IAM-UTIL: List certificates ``` aws iam list-server-certificates @@ -138,6 +142,7 @@ if [[ $(aws iam list-mfa-devices --user-name root --output text) ]]; then echo " --- # S3 #### S3-UTIL: List buckets ``` @@ -178,6 +183,8 @@ aws s3api list-buckets \ --- # RDS #### RDS-UTIL: List databases ``` aws rds describe-db-instances \ -
davidmoremad revised this gist
Jun 3, 2019 . 1 changed file with 11 additions and 6 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,11 +1,8 @@ # AWS Cheatsheet # Table of content * [Installation](#installation) * EC2 * [UTIL: List all instances](#EC2-UTIL-List-all-instances) * [UTIL: List specific fields of all instances](#EC2-UTIL-List-specific-fields-of-all-instances) @@ -36,6 +33,14 @@ --- #### Installation | Function | Command | |---------------------------|---------------------------------------| | Install awscli | `pip3 install awscli --upgrade --user` | | Configuring awscli | `aws configure` | --- #### EC2-UTIL: List all instances ``` -
davidmoremad revised this gist
Jun 3, 2019 . 1 changed file with 23 additions and 23 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -7,32 +7,32 @@ * EC2 * [UTIL: List all instances](#EC2-UTIL-List-all-instances) * [UTIL: List specific fields of all instances](#EC2-UTIL-List-specific-fields-of-all-instances) * [UTIL: List all instances of a product](#EC2-UTIL-List-all-instances-of-a-product) * [UTIL: List all stopped instances](#EC2-UTIL-List-all-stopped-instances) * [UTIL: List all stopped instances with ElasticIP](#EC2-UTIL-List-all-stopped-instances-with-ElasticIP) * [UTIL: List all snapshots in the date specified](#EC2-UTIL-List-all-snapshots-in-the-date-specified) * [SEC: List all snapshots without encryption](#EC2-SEC-List-all-snapshots-without-encryption) * [SEC: List SecurityGroups with SSH open to Internet](#EC2-SEC-List-SecurityGroups-with-SSH-open-to-Internet) * IAM * [UTIL: List certificates](#IAM-UTIL-List-certificates) * [UTIL: List policies](#IAM-UTIL-List-policies) * [UTIL: List policies attached to a group](#IAM-UTIL-List-policies-attached-to-a-group) * [UTIL: List users of a group](#IAM-UTIL-List-users-of-a-group) * [UTIL: List groups of a user](#IAM-UTIL-List-groups-of-a-user) * [SEC: Access Keys Rotation](#IAM-SEC-Access-Keys-Rotation) * [SEC: User with MFA enabled ](#IAM-SEC-User-with-MFA-enabled) * S3 * [UTIL: List buckets](#S3-UTIL-List-buckets) * [UTIL: List bucket objects](#S3-UTIL-List-bucket-objects) * [SEC: Bucket with public READ access](#S3-SEC-Bucket-with-public-READ-access) * [SEC: Bucket with public WRITE access](#S3-SEC-Bucket-with-public-WRITE-access) * [SEC: Bucket with public FULL_CONTROL access](#S3-SEC-Bucket-with-public-FULL_CONTROL-access) * RDS * [UTIL: List databases](#RDS-UTIL-List-databases) * [SEC: List Databases without DeletionProtection enabled](#RDS-SEC-List-Databases-without-DeletionProtection-enabled) * [SEC: List Public Databases](#RDS-SEC-List-Public-Databases) --- -
davidmoremad revised this gist
Jun 3, 2019 . 1 changed file with 23 additions and 23 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -7,32 +7,32 @@ * EC2 * [UTIL: List all instances](#EC2-UTIL:-List-all-instances) * [UTIL: List specific fields of all instances](#EC2-UTIL:-List-specific-fields-of-all-instances) * [UTIL: List all instances of a product](#EC2-UTIL:-List-all-instances-of-a-product) * [UTIL: List all stopped instances](#EC2-UTIL:-List-all-stopped-instances) * [UTIL: List all stopped instances with ElasticIP](#EC2-UTIL:-List-all-stopped-instances-with-ElasticIP) * [UTIL: List all snapshots in the date specified](#EC2-UTIL:-List-all-snapshots-in-the-date-specified) * [SEC: List all snapshots without encryption](#EC2-SEC:-List-all-snapshots-without-encryption) * [SEC: List SecurityGroups with SSH open to Internet](#EC2-SEC:-List-SecurityGroups-with-SSH-open-to-Internet) * IAM * [UTIL: List certificates](#IAM-UTIL:-List-certificates) * [UTIL: List policies](#IAM-UTIL:-List-policies) * [UTIL: List policies attached to a group](#IAM-UTIL:-List-policies-attached-to-a-group) * [UTIL: List users of a group](#IAM-UTIL:-List-users-of-a-group) * [UTIL: List groups of a user](#IAM-UTIL:-List-groups-of-a-user) * [SEC: Access Keys Rotation](#IAM-SEC:-Access-Keys-Rotation) * [SEC: User with MFA enabled ](#IAM-SEC:-User-with-MFA-enabled) * S3 * [UTIL: List buckets](#S3-UTIL:-List-buckets) * [UTIL: List bucket objects](#S3-UTIL:-List-bucket-objects) * [SEC: Bucket with public READ access](#S3-SEC:-Bucket-with-public-READ-access) * [SEC: Bucket with public WRITE access](#S3-SEC:-Bucket-with-public-WRITE-access) * [SEC: Bucket with public FULL_CONTROL access](#S3-SEC:-Bucket-with-public-FULL_CONTROL-access) * RDS * [UTIL: List databases](#RDS-UTIL:-List-databases) * [SEC: List Databases without DeletionProtection enabled](#RDS-SEC:-List-Databases-without-DeletionProtection-enabled) * [SEC: List Public Databases](#RDS-SEC:-List-Public-Databases) --- -
davidmoremad revised this gist
Jun 3, 2019 . 1 changed file with 27 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -6,6 +6,33 @@ | Configuring awscli | `aws configure` | * EC2 * EC2-UTIL: List all instances * EC2-UTIL: List specific fields of all instances * EC2-UTIL: List all instances of a product * EC2-UTIL: List all stopped instances * EC2-UTIL: List all stopped instances with ElasticIP * EC2-UTIL: List all snapshots in the date specified * EC2-SEC: List all snapshots without encryption * EC2-SEC: List SecurityGroups with SSH open to Internet * IAM * IAM-UTIL: List certificates * IAM-UTIL: List policies * IAM-UTIL: List policies attached to a group * IAM-UTIL: List users of a group * IAM-UTIL: List groups of a user * IAM-SEC: Access Keys Rotation * IAM-SEC: User with MFA enabled * S3 * S3-UTIL: List buckets * S3-UTIL: List bucket objects * S3-SEC: Bucket with public READ access * S3-SEC: Bucket with public WRITE access * S3-SEC: Bucket with public FULL_CONTROL access * RDS * RDS-UTIL: List databases * RDS-SEC: List Databases without DeletionProtection enabled * RDS-SEC: List Public Databases --- -
davidmoremad revised this gist
Jun 3, 2019 . 1 changed file with 68 additions and 54 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -6,63 +6,54 @@ | Configuring awscli | `aws configure` | --- #### EC2-UTIL: List all instances ``` aws ec2 describe-instances ``` #### EC2-UTIL: List specific fields of all instances ``` aws ec2 describe-instances \ --query "Reservations[].Instances[].[InstanceId, PublicIpAddress, Tags[?Key=='Name']|[0].Value]" ``` #### EC2-UTIL: List all instances of a product ``` aws ec2 describe-instances \ --filter "Name=tag:Name,Values=latch*" \ --query "Reservations[].Instances[].[InstanceId, PublicIpAddress, Tags[?Key=='Name']|[0].Value]" ``` #### EC2-UTIL: List all stopped instances ``` aws ec2 describe-instances \ --filters Name=instance-state-name,Values=stopped ``` #### EC2-UTIL: List all stopped instances with ElasticIP ``` aws ec2 describe-instances \ --query "Reservations[*].Instances[*].PublicIpAddress" \ --filters Name=instance-state-name,Values=stopped ``` #### EC2-UTIL: List all snapshots in the date specified ``` aws ec2 describe-snapshots \ --filters Name=start-time,Values=2019-01-05* ``` #### EC2-SEC: List all snapshots without encryption ``` aws ec2 describe-snapshots \ --filters "Name=encrypted,Values=false" ``` #### EC2-SEC: List SecurityGroups with SSH open to Internet ``` aws ec2 describe-security-groups \ --filters Name=ip-permission.from-port,Values=22 Name=ip-permission.to-port,Values=22 Name=ip-permission.cidr,Values='0.0.0.0/0' \ @@ -72,82 +63,105 @@ aws ec2 describe-security-groups \ --- #### IAM-UTIL: List certificates ``` aws iam list-server-certificates ``` #### IAM-UTIL: List policies ``` aws iam list-policies ``` #### IAM-UTIL: List policies attached to a group ``` aws iam list-attached-group-policies \ --group-name ec2-Users ``` #### IAM-UTIL: List users of a group ``` aws iam get-group \ --group-name ec2-users \ --query "Users[]" ``` #### IAM-UTIL: List groups of a user ``` aws iam list-groups-for-user \ --user-name aws-admin2 ``` #### IAM-SEC: Access Keys Rotation ``` aws iam list-access-keys \ --user-name aws-admin2 \ --query 'AccessKeyMetadata[?Status=="Active"].[CreateDate]' ``` #### IAM-SEC: User with MFA enabled ``` if [[ $(aws iam list-mfa-devices --user-name root --output text) ]]; then echo "MFA Enabled"; else echo "MFA Disabled";fi ``` --- #### S3-UTIL: List buckets ``` aws s3 ls ``` #### S3-UTIL: List bucket objects ``` aws s3api list-objects \ --bucket pre-cdo-web-resources \ --query 'Contents[].{Key: Key, Size: Size}' \ --output text ``` #### S3-SEC: Bucket with public READ access ``` aws s3api list-buckets \ --query 'Buckets[*].[Name]' \ --output text \ |xargs -I {} bash -c 'if [[ $(aws s3api get-bucket-acl --bucket {} --query '"'"'Grants[?Grantee.URI==`http://acs.amazonaws.com/groups/global/AllUsers` && Permission==`READ`]'"'"' --output text) ]]; then echo {} ; fi' ``` #### S3-SEC: Bucket with public WRITE access ``` aws s3api list-buckets \ --query 'Buckets[*].[Name]' \ --output text \ |xargs -I {} bash -c 'if [[ $(aws s3api get-bucket-acl --bucket {} --query '"'"'Grants[?Grantee.URI==`http://acs.amazonaws.com/groups/global/AllUsers` && Permission==`WRITE`]'"'"' --output text) ]]; then echo {} ; fi' ``` #### S3-SEC: Bucket with public FULL_CONTROL access ``` aws s3api list-buckets \ --query 'Buckets[*].[Name]' \ --output text \ | xargs -I {} bash -c 'if [[ $(aws s3api get-bucket-acl --bucket {} --query '"'"'Grants[?Grantee.URI==`http://acs.amazonaws.com/groups/global/AllUsers` && Permission==`READ`]'"'"' --output text) ]]; then echo {} ; fi' ``` --- #### RDS-UTIL: List databases ``` aws rds describe-db-instances \ --query 'DBInstances[].DBInstanceIdentifier' ``` #### RDS-SEC: List Databases without DeletionProtection enabled ``` aws rds describe-db-instances \ --query 'DBInstances[*].[DBInstanceIdentifier]' \ --output text \ | xargs -I {} bash -c 'if [[ $(aws rds describe-db-instances --db-instance-identifier {} --query '"'"'DBInstances[*].DeletionProtection'"'"' --output text) == False ]]; then echo {} ; fi' ``` #### RDS-SEC: List Public Databases ``` aws rds describe-db-instances \ --query 'DBInstances[?PubliclyAccessible==`true`].[DBInstanceIdentifier,Endpoint.Address]`' ``` -
davidmoremad revised this gist
Jun 3, 2019 . 1 changed file with 11 additions and 10 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -75,13 +75,13 @@ aws ec2 describe-security-groups \ # IAM * [UTIL - List certificates](#UTIL---List-certificates-) * [UTIL - List policies](#UTIL---List-policies-) * [UTIL - List policies attached to a group](#UTIL---List-policies-attached-to-a-group-) * [UTIL - List users of a group](#UTIL---List-users-of-a-group-) * [UTIL - List groups of a user](#UTIL---List-groups-of-a-user-) * [SEC - Access Keys Rotation](#SEC---Access-Keys-Rotation-) * [SEC - User with MFA enabled](#SEC---User-with-MFA-enabled-) #### UTIL - List certificates ``` @@ -108,17 +108,18 @@ aws iam get-group \ #### UTIL - List groups of a user ``` aws iam list-groups-for-user \ --user-name aws-admin2 ``` #### SEC - Access Keys Rotation ``` aws iam list-access-keys \ --user-name aws-admin2 \ --query 'AccessKeyMetadata[?Status=="Active"].[CreateDate]' ``` #### SEC - User with MFA enabled ``` if [[ $(aws iam list-mfa-devices --user-name root --output text) ]]; then echo "MFA Enabled"; else echo "MFA Disabled";fi ``` -
davidmoremad revised this gist
Jun 3, 2019 . 1 changed file with 7 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -79,7 +79,7 @@ aws ec2 describe-security-groups \ * [UTIL - List policies](#) * [UTIL - List policies attached to a group](#) * [UTIL - List users of a group](#) * [UTIL - List groups of a user](#) * [SEC - Rotate Keys. Created date of an AccessKey](#) * [SEC - Check if user has MFA enabled](#) @@ -95,7 +95,8 @@ aws iam list-policies #### UTIL - List policies attached to a group ``` aws iam list-attached-group-policies \ --group-name ec2-Users ``` #### UTIL - List users of a group @@ -105,14 +106,16 @@ aws iam get-group \ --query "Users[]" ``` #### UTIL - List groups of a user ``` aws iam list-groups-for-user --user-name aws-admin2 ``` #### SEC - Rotate Keys. Created date of an AccessKey ``` aws iam list-access-keys \ --user-name aws-admin2 \ --query 'AccessKeyMetadata[?Status=="Active"].[CreateDate]' ``` #### SEC - Check if user has MFA enabled -
davidmoremad revised this gist
Jun 3, 2019 . 1 changed file with 59 additions and 28 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -8,49 +8,49 @@ # EC2 * [UTIL - List all instances](#UTIL---List-all-instances) * [UTIL - List specific fields of all instances](#UTIL---List-specific-fields-of-all-instances) * [UTIL - List all instances of a product](#UTIL---List-all-instances-of-a-product) * [UTIL - List all stopped instances](#UTIL---List-all-stopped-instances) * [UTIL - List all stopped instances with ElasticIP](#UTIL---List-all-stopped-instances-with-ElasticIP) * [UTIL - List all snapshots in the date specified](#UTIL---List-all-snapshots-in-the-date-specified) * [SEC - List all snapshots without encryption](#SEC---List-all-snapshots-without-encryption) * [SEC - List SecurityGroups with SSH open to Internet](#SEC---List-SecurityGroups-with-SSH-open-to-Internet) #### UTIL - List all instances ``` aws ec2 describe-instances ``` #### UTIL - List specific fields of all instances ``` aws ec2 describe-instances \ --query "Reservations[].Instances[].[InstanceId, PublicIpAddress, Tags[?Key=='Name']|[0].Value]" ``` #### UTIL - List all instances of a product ``` aws ec2 describe-instances \ --filter "Name=tag:Name,Values=latch*" \ --query "Reservations[].Instances[].[InstanceId, PublicIpAddress, Tags[?Key=='Name']|[0].Value]" ``` #### UTIL - List all stopped instances ``` aws ec2 describe-instances \ --filters Name=instance-state-name,Values=stopped ``` #### UTIL - List all stopped instances with ElasticIP ``` aws ec2 describe-instances \ --query "Reservations[*].Instances[*].PublicIpAddress" \ --filters Name=instance-state-name,Values=stopped ``` #### UTIL - List all snapshots in the date specified ``` aws ec2 describe-snapshots \ --filters Name=start-time,Values=2019-01-05* @@ -75,25 +75,56 @@ aws ec2 describe-security-groups \ # IAM * [UTIL - List certificates](#) * [UTIL - List policies](#) * [UTIL - List policies attached to a group](#) * [UTIL - List users of a group](#) * [UTIL - List groups for a given user](#) * [SEC - Rotate Keys. Created date of an AccessKey](#) * [SEC - Check if user has MFA enabled](#) #### UTIL - List certificates ``` aws iam list-server-certificates ``` #### UTIL - List policies ``` aws iam list-policies ``` #### UTIL - List policies attached to a group ``` aws iam list-attached-group-policies --group-name ec2-Users ``` #### UTIL - List users of a group ``` aws iam get-group \ --group-name ec2-users \ --query "Users[]" ``` #### UTIL - List groups for a given user ``` aws iam list-groups-for-user --user-name aws-admin2 ``` #### SEC - Rotate Keys. Created date of an AccessKey ``` aws iam list-access-keys --user-name aws-admin2 --query 'AccessKeyMetadata[?Status==```Active```].[CreateDate]' --output text ``` #### SEC - Check if user has MFA enabled ``` if [[ $(aws iam list-mfa-devices --user-name root --output text) ]]; then echo "MFA Enabled"; else echo "MFA Disabled";fi ``` ## S3 ## Util | Function | Command | |---------------------------------------------------|---------------------------------------------------| -
davidmoremad revised this gist
Jun 3, 2019 . 1 changed file with 7 additions and 7 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -27,33 +27,33 @@ aws ec2 describe-instances \ #### UTILS - List specific fields of all instances ``` aws ec2 describe-instances \ --query "Reservations[].Instances[].[InstanceId, PublicIpAddress, Tags[?Key=='Name']|[0].Value]" ``` #### UTILS - List all instances of a product ``` aws ec2 describe-instances \ --filter "Name=tag:Name,Values=latch*" \ --query "Reservations[].Instances[].[InstanceId, PublicIpAddress, Tags[?Key=='Name']|[0].Value]" ``` #### UTILS - List all stopped instances ``` aws ec2 describe-instances \ --filters Name=instance-state-name,Values=stopped ``` #### UTILS - List all stopped instances with ElasticIP ``` aws ec2 describe-instances \ --query "Reservations[*].Instances[*].PublicIpAddress" \ --filters Name=instance-state-name,Values=stopped ``` #### UTILS - List all snapshots in the date specified ``` aws ec2 describe-snapshots \ --filters Name=start-time,Values=2019-01-05* ``` #### SEC - List all snapshots without encryption -
davidmoremad revised this gist
Jun 3, 2019 . 1 changed file with 0 additions and 11 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -25,55 +25,44 @@ aws ec2 describe-instances \ ``` #### UTILS - List specific fields of all instances ``` aws ec2 describe-instances \ --query "Reservations[].Instances[].[InstanceId, PublicIpAddress, Tags[?Key=='Name']|[0].Value]" ``` #### UTILS - List all instances of a product ``` aws ec2 describe-instances \ --filter "Name=tag:Name,Values=latch*" \ --query "Reservations[].Instances[].[InstanceId, PublicIpAddress, Tags[?Key=='Name']|[0].Value]" ``` #### UTILS - List all stopped instances ``` aws ec2 describe-instances \ --filters Name=instance-state-name,Values=stopped ``` #### UTILS - List all stopped instances with ElasticIP ``` aws ec2 describe-instances \ --query "Reservations[*].Instances[*].PublicIpAddress" \ --filters Name=instance-state-name,Values=stopped ``` #### UTILS - List all snapshots in the date specified ``` aws ec2 describe-snapshots \ --filters Name=start-time,Values=2019-01-05* ``` #### SEC - List all snapshots without encryption ``` aws ec2 describe-snapshots \ --filters "Name=encrypted,Values=false" ``` #### SEC - List SecurityGroups with SSH open to Internet ``` aws ec2 describe-security-groups \ --filters Name=ip-permission.from-port,Values=22 Name=ip-permission.to-port,Values=22 Name=ip-permission.cidr,Values='0.0.0.0/0' \ -
davidmoremad revised this gist
Jun 3, 2019 . 1 changed file with 0 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -20,7 +20,6 @@ #### UTILS - List all instances ``` aws ec2 describe-instances \ ``` -
davidmoremad revised this gist
Jun 3, 2019 . 1 changed file with 5 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -8,14 +8,15 @@ # EC2 * [UTILS - List all instances](#UTILS---List-all-instances) * [UTILS - List specific fields of all instances](#UTILS---List-specific-fields-of-all-instances) * [UTILS - List all instances of a product](#UTILS---List-all-instances-of-a-product) * [UTILS - List all stopped instances](#UTILS---List-all-stopped-instances) * [UTILS - List all stopped instances with ElasticIP](#UTILS---List-all-stopped-instances-with-ElasticIP) * [UTILS - List all snapshots in the date specified](#UTILS---List-all-snapshots-in-the-date-specified) * [SEC - List all snapshots without encryption](#SEC---List-all-snapshots-without-encryption) * [SEC - List SecurityGroups with SSH open to Internet](#SEC---List-SecurityGroups-with-SSH-open-to-Internet) #### UTILS - List all instances -
davidmoremad revised this gist
Jun 3, 2019 . 1 changed file with 4 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -65,17 +65,14 @@ aws ec2 describe-snapshots \ --filters Name=start-time,Values=2019-01-05* ``` #### SEC - List all snapshots without encryption ``` aws ec2 describe-snapshots \ --filters "Name=encrypted,Values=false" ``` #### SEC - List SecurityGroups with SSH open to Internet ``` aws ec2 describe-security-groups \ @@ -84,6 +81,9 @@ aws ec2 describe-security-groups \ --output table ``` --- # IAM ## Utils -
davidmoremad revised this gist
Jun 3, 2019 . 1 changed file with 10 additions and 9 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -5,16 +5,17 @@ | Install awscli | `pip3 install awscli --upgrade --user` | | Configuring awscli | `aws configure` | # EC2 * [UTILS - List all instances](#utils---list-all-instances) * [UTILS - List specific fields of all instances](#UTILS---List-specific-fields-of-all-instances) * [UTILS - List all instances of a product](#UTILS---List-all-instances-filtered-by-product) * [UTILS - List all stopped instances](#UTILS---List-all-stopped-instances) * [UTILS - List all stopped instances with ElasticIP](#UTILS---List-all-stopped-instances-with-ElasticIP) * [UTILS - List all snapshots in the date specified](#UTILS---List-all-snapshots-in-the-date-specified) * [SEC - List all snapshots without encryption](#SEC---List-all-snapshots-without-encryption-in-a-date) * [SEC - List SecurityGroups with SSH open to Internet](#SEC---List-SecurityGroups-with-SSH-(22)-open-to-Internet) #### UTILS - List all instances @@ -31,7 +32,7 @@ aws ec2 describe-instances \ ``` #### UTILS - List all instances of a product ``` aws ec2 describe-instances \ @@ -67,20 +68,20 @@ aws ec2 describe-snapshots \ ## Security #### SEC - List all snapshots without encryption ``` aws ec2 describe-snapshots \ --filters "Name=encrypted,Values=false" ``` #### SEC - List SecurityGroups with SSH (22) open to Internet ``` aws ec2 describe-security-groups \ --filters Name=ip-permission.from-port,Values=22 Name=ip-permission.to-port,Values=22 Name=ip-permission.cidr,Values='0.0.0.0/0' \ --query 'SecurityGroups[*].{Name:GroupName}' \ --output table ``` # IAM -
davidmoremad revised this gist
Jun 3, 2019 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -13,8 +13,8 @@ * [UTILS - List all stopped instances](#UTILS---List-all-stopped-instances) * [UTILS - List all stopped instances with ElasticIP](#UTILS---List-all-stopped-instances-with-ElasticIP) * [UTILS - List all snapshots in the date specified](#UTILS---List-all-snapshots-in-the-date-specified) * [SEC - List all snapshots without encryption in a date](#SEC---List-all-snapshots-without-encryption-in-a-date) * [SEC - List SecurityGroups with SSH (22) open to Internet](#SEC---List-SecurityGroups-with-SSH-(22)-open-to-Internet) #### UTILS - List all instances -
davidmoremad revised this gist
Jun 3, 2019 . 1 changed file with 11 additions and 11 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -8,34 +8,34 @@ # EC2 * [UTILS - List all instances](#utils---list-all-instances) * [UTILS - List specific fields of all instances](#UTILS---List-specific-fields-of-all-instances) * [UTILS - List all instances filtered by product (i.e. Latch)](#UTILS---List-all-instances-filtered-by-product-(i.e.-Latch)) * [UTILS - List all stopped instances](#UTILS---List-all-stopped-instances) * [UTILS - List all stopped instances with ElasticIP](#UTILS---List-all-stopped-instances-with-ElasticIP) * [UTILS - List all snapshots in the date specified](#UTILS---List-all-snapshots-in-the-date-specified) * [USEC - List all snapshots without encryption in a date](#USEC---List-all-snapshots-without-encryption-in-a-date) * [USEC - List SecurityGroups with SSH (22) open to Internet](#USEC---List-SecurityGroups-with-SSH-(22)-open-to-Internet) #### UTILS - List all instances ``` aws ec2 describe-instances \ ``` #### UTILS - List specific fields of all instances ``` aws ec2 describe-instances \ --query "Reservations[].Instances[].[InstanceId, PublicIpAddress, Tags[?Key=='Name']|[0].Value]" ``` #### UTILS - List all instances filtered by product (i.e. Latch) ``` aws ec2 describe-instances \ --filter "Name=tag:Name,Values=latch*" \ --query "Reservations[].Instances[].[InstanceId, PublicIpAddress, Tags[?Key=='Name']|[0].Value]" ``` -
davidmoremad revised this gist
Jun 3, 2019 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -7,7 +7,7 @@ # EC2 * [UTILS - List all instances](#utils---list-all-instances) * UTILS - List all instances of a product (Latch) * UTILS - List all instances (ID, PublicIp & Name) * UTILS - List all stopped instances -
davidmoremad revised this gist
Jun 3, 2019 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -7,7 +7,7 @@ # EC2 * [UTILS - List all instances](#UTILS - List all instances) * UTILS - List all instances of a product (Latch) * UTILS - List all instances (ID, PublicIp & Name) * UTILS - List all stopped instances -
davidmoremad revised this gist
Jun 3, 2019 . 1 changed file with 8 additions and 8 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -16,14 +16,14 @@ * SEC - List all snapshots without encryption in a date * SEC - List SecurityGroups with SSH (22) open to Internet #### UTILS - List all instances ``` aws ec2 describe-instances \ ``` #### UTILS - List all instances of a product (Latch) ``` aws ec2 describe-instances \ @@ -32,23 +32,23 @@ aws ec2 describe-instances \ ``` #### UTILS - List all instances (ID, PublicIp & Name) ``` aws ec2 describe-instances \ --query "Reservations[].Instances[].[InstanceId, PublicIpAddress, Tags[?Key=='Name']|[0].Value]" ``` #### UTILS - List all stopped instances ``` aws ec2 describe-instances \ --filters Name=instance-state-name,Values=stopped ``` #### UTILS - List all stopped instances with ElasticIP ``` aws ec2 describe-instances \ @@ -57,7 +57,7 @@ aws ec2 describe-instances \ ``` #### UTILS - List all snapshots in the date specified ``` aws ec2 describe-snapshots \ @@ -67,14 +67,14 @@ aws ec2 describe-snapshots \ ## Security #### SEC - List all snapshots without encryption in a date ``` aws ec2 describe-snapshots \ --filters Name=encrypted,Values=false Name=start-time,Values=2019-01-05* ``` #### SEC - List SecurityGroups with SSH (22) open to Internet ``` aws ec2 describe-security-groups \ -
davidmoremad revised this gist
Jun 3, 2019 . 1 changed file with 8 additions and 8 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -16,14 +16,14 @@ * SEC - List all snapshots without encryption in a date * SEC - List SecurityGroups with SSH (22) open to Internet ### UTILS - List all instances ``` aws ec2 describe-instances \ ``` ### UTILS - List all instances of a product (Latch) ``` aws ec2 describe-instances \ @@ -32,23 +32,23 @@ aws ec2 describe-instances \ ``` ### UTILS - List all instances (ID, PublicIp & Name) ``` aws ec2 describe-instances \ --query "Reservations[].Instances[].[InstanceId, PublicIpAddress, Tags[?Key=='Name']|[0].Value]" ``` ### UTILS - List all stopped instances ``` aws ec2 describe-instances \ --filters Name=instance-state-name,Values=stopped ``` ### UTILS - List all stopped instances with ElasticIP ``` aws ec2 describe-instances \ @@ -57,7 +57,7 @@ aws ec2 describe-instances \ ``` ### UTILS - List all snapshots in the date specified ``` aws ec2 describe-snapshots \ @@ -67,14 +67,14 @@ aws ec2 describe-snapshots \ ## Security ### SEC - List all snapshots without encryption in a date ``` aws ec2 describe-snapshots \ --filters Name=encrypted,Values=false Name=start-time,Values=2019-01-05* ``` ### SEC - List SecurityGroups with SSH (22) open to Internet ``` aws ec2 describe-security-groups \ -
davidmoremad revised this gist
Jun 3, 2019 . 1 changed file with 8 additions and 8 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -16,14 +16,14 @@ * SEC - List all snapshots without encryption in a date * SEC - List SecurityGroups with SSH (22) open to Internet ###UTILS - List all instances ``` aws ec2 describe-instances \ ``` ###UTILS - List all instances of a product (Latch) ``` aws ec2 describe-instances \ @@ -32,23 +32,23 @@ aws ec2 describe-instances \ ``` ###UTILS - List all instances (ID, PublicIp & Name) ``` aws ec2 describe-instances \ --query "Reservations[].Instances[].[InstanceId, PublicIpAddress, Tags[?Key=='Name']|[0].Value]" ``` ###UTILS - List all stopped instances ``` aws ec2 describe-instances \ --filters Name=instance-state-name,Values=stopped ``` ###UTILS - List all stopped instances with ElasticIP ``` aws ec2 describe-instances \ @@ -57,7 +57,7 @@ aws ec2 describe-instances \ ``` ###UTILS - List all snapshots in the date specified ``` aws ec2 describe-snapshots \ @@ -67,14 +67,14 @@ aws ec2 describe-snapshots \ ## Security ###SEC - List all snapshots without encryption in a date ``` aws ec2 describe-snapshots \ --filters Name=encrypted,Values=false Name=start-time,Values=2019-01-05* ``` ###SEC - List SecurityGroups with SSH (22) open to Internet ``` aws ec2 describe-security-groups \ -
davidmoremad revised this gist
Jun 3, 2019 . 1 changed file with 8 additions and 8 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -16,14 +16,14 @@ * SEC - List all snapshots without encryption in a date * SEC - List SecurityGroups with SSH (22) open to Internet ### UTILS - List all instances ``` aws ec2 describe-instances \ ``` ### UTILS - List all instances of a product (Latch) ``` aws ec2 describe-instances \ @@ -32,23 +32,23 @@ aws ec2 describe-instances \ ``` ### UTILS - List all instances (ID, PublicIp & Name) ``` aws ec2 describe-instances \ --query "Reservations[].Instances[].[InstanceId, PublicIpAddress, Tags[?Key=='Name']|[0].Value]" ``` ### UTILS - List all stopped instances ``` aws ec2 describe-instances \ --filters Name=instance-state-name,Values=stopped ``` ### UTILS - List all stopped instances with ElasticIP ``` aws ec2 describe-instances \ @@ -57,7 +57,7 @@ aws ec2 describe-instances \ ``` ### UTILS - List all snapshots in the date specified ``` aws ec2 describe-snapshots \ @@ -67,14 +67,14 @@ aws ec2 describe-snapshots \ ## Security ### SEC - List all snapshots without encryption in a date ``` aws ec2 describe-snapshots \ --filters Name=encrypted,Values=false Name=start-time,Values=2019-01-05* ``` ### SEC - List SecurityGroups with SSH (22) open to Internet ``` aws ec2 describe-security-groups \ -
davidmoremad revised this gist
Jun 3, 2019 . 1 changed file with 8 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -17,12 +17,14 @@ * SEC - List SecurityGroups with SSH (22) open to Internet #### UTILS - List all instances ``` aws ec2 describe-instances \ ``` #### UTILS - List all instances of a product (Latch) ``` aws ec2 describe-instances \ --filter "Name=tag:Name,Values=latch*" \ @@ -31,20 +33,23 @@ aws ec2 describe-instances \ #### UTILS - List all instances (ID, PublicIp & Name) ``` aws ec2 describe-instances \ --query "Reservations[].Instances[].[InstanceId, PublicIpAddress, Tags[?Key=='Name']|[0].Value]" ``` #### UTILS - List all stopped instances ``` aws ec2 describe-instances \ --filters Name=instance-state-name,Values=stopped ``` #### UTILS - List all stopped instances with ElasticIP ``` aws ec2 describe-instances \ --query "Reservations[*].Instances[*].PublicIpAddress" \ @@ -53,6 +58,7 @@ aws ec2 describe-instances \ #### UTILS - List all snapshots in the date specified ``` aws ec2 describe-snapshots \ --filters Name=start-time,Values=2019-01-05* @@ -62,12 +68,14 @@ aws ec2 describe-snapshots \ ## Security #### SEC - List all snapshots without encryption in a date ``` aws ec2 describe-snapshots \ --filters Name=encrypted,Values=false Name=start-time,Values=2019-01-05* ``` #### SEC - List SecurityGroups with SSH (22) open to Internet ``` aws ec2 describe-security-groups \ --filters Name=ip-permission.from-port,Values=22 Name=ip-permission.to-port,Values=22 Name=ip-permission.cidr,Values='0.0.0.0/0' \
NewerOlder