/images/avatar.png

Hi! I'm Pratyaksha.

AWS CLI Cheatsheet

CLI Command Structure: aws <command> <subcommand> [options and parameters] aws <command> wait <subcommand> [options and parameters] (not supported by all) Set Up Using long-term credentials with IAM user (Not recommended): 1 aws configure Using short-term credentialswith IAM user: 1 2 aws configure aws configure set aws_session_token TOKEN # token generated from previous command Using EC2 instance metadata: 1 2 3 4 aws configure set role_arn arn:aws:iam::123456789012:role/defaultrole aws configure set credential_source Ec2InstanceMetadata aws configure set region us-west-2 aws configure set output json Using IAM role:

SQL Cheatsheet

Single line comment: -- comment Multiline comment: /* comments */ Data query Language (DQL) 1 2 3 4 5 6 7 SELECT 'ID: ', id, col_1 + col_2, sqrt(col_2) FROM t1 -- precedence within WHERE: functions, comparisons, NOT, AND, OR WHERE col_1 > 100 AND NOT MOD(col_2, 10) = 0 OR col_3 < col_1 ORDER BY col_4 DESC, col_5; 1 2 -- number of rows, number of not-null-values SELECT COUNT(*), COUNT(col_1) FROM t1; 1 2 -- predefined functions SELECT COUNT(col_1), MAX(col_1), MIN(col_1), AVG(col_1), SUM(col_1) FROM t1; 1 2 -- UNIQUE values only SELECT DISTINCT col_1 FROM t1; 1 2 -- Only the combination of col_1 plus col_2 is unique SELECT DISTINCT col_1, col_2 FROM t1; Case Expression 1 2 3 4 5 6 7 8 SELECT id, CASE contact_type WHEN 'fixed line' THEN 'Phone' WHEN 'mobile' THEN 'Phone' ELSE 'Not a telephone number' END AS 'contact_type', contact_value FROM contact; There are two short forms for special CASE expressions: COALESCE and NULLIF.