==================== Amazon Web Services ==================== AWS Command Line Interface for Auto-Publishing ================================================= Install AWS Command Line and Configure --------------------------------------- * https://aws.amazon.com/cli/ * http://docs.aws.amazon.com/cli/latest/userguide/using-s3-commands.html * Install ``pip install awscli`` Or use the Windows 64 bit installer. * Configure #. Access Key ID #. Secret Acess Key #. None #. None ``aws configure`` Note: I have to be in C: where it is installed. Setup Auto-Publish Script -------------------------- Base Command: ``aws s3 sync [--options]`` Rsync Style Command: ``aws s3 sync s3:// --delete`` Note: A batch script with "call" + the above line in it makes for a quick and easy way to publish the website. AWS Access Key ID, etc. ========================== * http://docs.aws.amazon.com/IAM/latest/UserGuide/id_users_create.html?icmpid=docs_iam_console * http://docs.aws.amazon.com/general/latest/gr/managing-aws-access-keys.html To Create User/Initial Access Key: ----------------------------------- AWS Console -> IAM -> Users -> Add User ->User Name ->Programmatic Acess To Get New Access Key: ---------------------- AWS Console -> IAM -> Users -> Username -> Security Credentials -> Make Inactive -> Create Access Key Groups: -------- A user needs ``AWSCodeCommitFullAccess`` to pull/push to git repositories and ``AmazonS3FullAccess`` to push html to the website content hosting s3 bucket. AWS CodeCommit for Version Control =================================== Setup Tutorial: http://docs.aws.amazon.com/codecommit/latest/userguide/setting-up-gc.html 1. Git ------- Download Git https://git-scm.com/download/winhttps://git-scm.com/download/win Install Git -> Use Notepad++ as Git's Default Editor -> Use Git from the Windows Command Prompt -> Checkout Windows-style, commit Unix-style line ends -> Use Window's default console window 2. AWS IAM ----------- Create User Give User AWSCodeCommitFullAccess 3. Get Credentials & Create Repo -------------------------------------------- Follow Tutorial Step 3 and 4 -> Generate Git Credentials through IAM-> User -> Security Credentials -> Git Credentials -> Download Credentials 4. Clone Repo -------------- -> Go to Folder where you want the repo (i.e. U:// or ~/ ) -> git clone the repo (Repo Directory url can be found by loging into AWS with [Non-Root] User and opening Repo) -> Give Credentials 4.B Clone Shallow Repo ------------------------ If the full repository is too long, you can clone a shallow repository that will only keep parts of the master repository. ``git clone --depth=n `` Will only keep the n newest commits in the current repo. A good number here is 3 since very shallow repos can't always be pushed to the master. If that happens, use ``git fetch --depth=m`` where m>n to fix it. 5. Code! --------- ``git clone url`` -> Gets Code Repo ``git status`` -> gives status ``git branch`` -> gives branch name ``git commit -m "Change-Log Message"`` -> Commits Changes to Local Repo (Do Anytime there are Changes) ``git remote`` -> gives remote rep nickname ``git push remoteNickname branchName`` -> Pushes to AWS Repo and Branch ``git pull`` -> gets from AWS Repo 6. Workflow ------------ #. ``git pull`` #. Do Work! #. ``git add .`` #. ``git status`` #. ``git commit -m "Change-Log Message"`` #. Go To 2 or at End of Work: #. ``git push`` 7. Remove History when Repo gets too big ------------------------------------------ ``git fetch --depth=1`` to prune the old commits ``git reflog expire --expire-unreachable=now --all`` to expire old commits and objects ``git gc --aggressive --prune=all`` to remove the old objects and clean up 8. Issues Storing Credentials ------------------------------- If there's issues storing credentials, such as on linux systems, try: ``git config credential.helper store`` then ``git pull`` and git should store the credentials. Beware that this stores git credentials on the disk in plaintext so is less secure than other options. AWS Glacier for Long Term Backup ==================================== Create Vault -------------- #. Go To AWS Console #. Go To Glacier #. Create Vault #. Optional: Set up notifications #. Optional: Go to Settings and Limit Data Retrieval Cost Fast Glacier --------------- Free Windows Client for Glacier: https://fastglacier.com/ * Supports Multi-Part upload * Smart (Estimated Cost) Data Retrival * Folder Sync/Comparison * Command Line Folder Sync Tool Setup: * Download and Install Client * Use Account Type: Amazon Glacier * Get Access Keys * Follow Link * Go to Acess Keys * Create Keys * Show Access Keys * Encrypt Keys with Master Password * Use SSL Use: * Select Vault * Go to Files * Upload Folder