• Tidak ada hasil yang ditemukan

GermanX, CC BY-SA 4.0 <https://creativecommons.org/licenses/by-sa/4.0>, via Wikimedia Commons

DI STR IBUTI O N © S te p h an e M aar e k ww w .d at ac u mu lu s.c

DI STR IBUTI O N © S te p h an e M aar e k ww w .d at ac u mu

SQL Regular Expressions

• Pattern matching

• Think a much more powerful “LIKE”

• ~ is the regular expression operator

• ~* is case-insensitive

• !~* would mean “not match expression, case insensitive”

• Regular expression 101

• ^ - match a pattern at the start of a string

• $ - match a pattern at the end of a string (boo$ would match boo but not book)

• | - alternate characters (sit|sat matches both sit and sat)

• Ranges ([a-z] matches any lower case letter)

• Repeats ([a-z]{4} matches any four-letter lowercase word)

• Special metacharacters

\d – any digit; \w – any letter, digit, or underscore, \s – whitespace, \t – tab

• Example:

• SELECT * FROM name WHERE name ~ * ‘^(fire|ice)’;

• Selects any rows where the name starts with “fire” or “ice” (case insensitive)

DI STR IBUTI O N © S te p h an e M aar e k ww w .d at ac u mu lu s.c

Git review

Daniel Kinzler, CC BY 3.0 <https://creativecommons.org/licenses/by/3.0>, via Wikimedia Commons

DI STR IBUTI O N © S te p h an e M aar e k ww w .d at ac u mu

Common git commands

• Setting Up and Configuration:

git init: Initialize a new Git repository.

git config: Set configuration values for user info, aliases, and more.

• git config --global user.name "Your Name": Set your name.

• git config --global user.email "[email protected]": Set your email.

• Basic Commands:

git clone <repository>: Clone (or download) a repository from an existing URL.

git status: Check the status of your changes in the working directory.

git add <filename>: Add changes in the file to the staging area.

• git add .: Add all new and changed files to the staging area.

git commit -m "Commit message here": Commit the staged changes with a

message.

DI STR IBUTI O N © S te p h an e M aar e k ww w .d at ac u mu lu s.c

Branching with git

git branch: List all local branches.

• git branch <branchname>: Create a new branch.

git checkout <branchname>: Switch to a specific branch.

• git checkout -b <branchname>: Create a new branch and switch to it.

git merge <branchname>: Merge the specified branch into the current branch.

git branch -d <branchname>: Delete a branch.

Felix Dreissig, noris network AG

DI STR IBUTI O N © S te p h an e M aar e k ww w .d at ac u mu

Remote repositories

git remote add <name> <url>: Add a remote repository.

git remote: List all remote repositories.

git push <remote> <branch>: Push a branch to a remote repository.

git pull <remote> <branch>: Pull changes from a remote

repository branch into the current local branch.

DI STR IBUTI O N © S te p h an e M aar e k ww w .d at ac u mu lu s.c

Undoing changes

git reset: Reset your staging area to match the most recent commit, without affecting the working directory.

git reset --hard: Reset the staging area and the working directory to match the most recent commit.

git revert <commit>: Create a new commit that undoes all of

the changes from a previous commit.

DI STR IBUTI O N © S te p h an e M aar e k ww w .d at ac u mu

Advanced git

git stash: Temporarily save changes that are not yet ready for a commit.

• git stash pop: Restore the most recently stashed changes.

git rebase <branch>: Reapply changes from one branch onto another, often used to integrate changes from one branch into another.

git cherry-pick <commit>: Apply changes from a specific

commit to the current branch.

DI STR IBUTI O N © S te p h an e M aar e k ww w .d at ac u mu lu s.c

Git collaboration and inspection

git blame <file>: Show who made changes to a file and when.

git diff: Show changes between commits, commit and working tree, etc.

git fetch: Fetch changes from a remote repository without

merging them.

DI STR IBUTI O N © S te p h an e M aar e k ww w .d at ac u mu

Git maintenance and data recovery

git fsck: Check the database for errors.

git gc: Clean up and optimize the local repository.

git reflog: Record when refs were updated in the local repository,

useful for recovering lost commits.

DI STR IBUTI O N © S te p h an e M aar e k ww w .d at ac u mu lu s.c

Storage

Storing, accessing, and backing up data in AWS

DI STR IBUTI O N © S te p h an e M aar e k ww w .d at ac u mu

Amazon S3 Section

DI STR IBUTI O N © S te p h an e M aar e k ww w .d at ac u mu lu s.c

Section introduction

• Amazon S3 is one of the main building blocks of AWS

• It’s advertised as ”infinitely scaling” storage

• Many websites use Amazon S3 as a backbone

• Many AWS services use Amazon S3 as an integration as well

• We’ll have a step-by-step approach to S3

DI STR IBUTI O N © S te p h an e M aar e k ww w .d at ac u mu

Amazon S3 Use cases

• Backup and storage

• Disaster Recovery

• Archive

• Hybrid Cloud storage

• Application hosting

• Media hosting

• Data lakes & big data analytics

• Software delivery

• Static website

Nasdaq stores 7 years of data into S3 Glacier

Sysco runs analytics

on its data and gain

business insights

DI STR IBUTI O N © S te p h an e M aar e k ww w .d at ac u mu lu s.c

Amazon S3 - Buckets

• Amazon S3 allows people to store objects (files) in “buckets”

(directories)

• Buckets must have a globally unique name (across all regions all accounts)

• Buckets are defined at the region level

• S3 looks like a global service but buckets are created in a region

• Naming convention

• No uppercase, No underscore

• 3-63 characters long

• Not an IP

• Must start with lowercase letter or number

• Must NOT start with the prefix xn--

S3 Bucket

DI STR IBUTI O N © S te p h an e M aar e k ww w .d at ac u mu

Amazon S3 - Objects

• Objects (files) have a Key

• The key is the FULL path:

• s3://my-bucket/my_file.txt

• s3://my-bucket/my_folder1/another_folder/my_file.txt

• The key is composed of prefix + object name

• s3://my-bucket/my_folder1/another_folder/my_file.txt

• There’s no concept of “directories” within buckets (although the UI will trick you to think otherwise)

• Just keys with very long names that contain slashes (“/”)

S3 Bucket with Objects

Object

DI STR IBUTI O N © S te p h an e M aar e k ww w .d at ac u mu lu s.c

Amazon S3 – Objects (cont.)

• Object values are the content of the body:

• Max. Object Size is 5TB (5000GB)

• If uploading more than 5GB, must use “multi-part upload”

• Metadata (list of text key / value pairs – system or user metadata)

• Tags (Unicode key / value pair – up to 10) – useful for security / lifecycle

• Version ID (if versioning is enabled)

DI STR IBUTI O N © S te p h an e M aar e k ww w .d at ac u mu

Amazon S3 – Security

User-Based

IAM Policies – which API calls should be allowed for a specific user from IAM

Resource-Based

Bucket Policies – bucket wide rules from the S3 console - allows cross account

Object Access Control List (ACL) finer grain (can be disabled)

Bucket Access Control List (ACL) – less common (can be disabled)

Note: an IAM principal can access an S3 object if

• The user IAM permissions ALLOW it OR the resource policy ALLOWS it

• AND there’s no explicit DENY

DI STR IBUTI O N © S te p h an e M aar e k ww w .d at ac u mu lu s.c

S3 Bucket Policies

• JSON based policies

• Resources: buckets and objects

• Effect: Allow / Deny

• Actions: Set of API to Allow or Deny

• Principal: The account or user to apply the policy to

• Use S3 bucket for policy to:

• Grant public access to the bucket

• Force objects to be encrypted at upload

• Grant access to another account (Cross

Account)

DI STR IBUTI O N © S te p h an e M aar e k ww w .d at ac u mu

Policy

S3 Bucket

Dokumen terkait