-
Notifications
You must be signed in to change notification settings - Fork 1
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
0 parents
commit d2bacc9
Showing
99 changed files
with
5,165 additions
and
0 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,11 @@ | ||
============== | ||
7-Zip on Linux | ||
============== | ||
|
||
Ubuntu | ||
====== | ||
|
||
Install 7-Zip on Ubuntu:: | ||
|
||
$ sudo apt-get install p7zip-rar p7zip-full | ||
|
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 @@ | ||
=============== | ||
Available zones | ||
=============== | ||
|
||
# Actual information on http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-regions-availability-zones.html | ||
|
||
us-east-1 US East (N. Virginia) | ||
us-west-2 US West (Oregon) | ||
us-west-1 US West (N. California) | ||
eu-west-1 EU (Ireland) | ||
eu-central-1 EU (Frankfurt) | ||
ap-southeast-1 Asia Pacific (Singapore) | ||
ap-northeast-1 Asia Pacific (Tokyo) | ||
ap-southeast-2 Asia Pacific (Sydney) | ||
ap-northeast-2 Asia Pacific (Seoul) | ||
ap-south-1 Asia Pacific (Mumbai) | ||
sa-east-1 South America (São Paulo) |
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,49 @@ | ||
=== | ||
CLI | ||
=== | ||
|
||
~/.aws/config | ||
|
||
[default] | ||
output = json | ||
region = eu-west-1 # important! | ||
|
||
[profile <username>] | ||
output = json | ||
region = eu-west-1 # important! | ||
|
||
~/.aws/credentials | ||
|
||
[default] | ||
aws_access_key_id = <key_id> | ||
aws_secret_access_key = <access_key> | ||
|
||
[<username>] | ||
aws_access_key_id = <key_id> | ||
aws_secret_access_key = <access_key> | ||
|
||
######################################## | ||
|
||
# for run as username: | ||
aws --profile <username> <some_aws_command> | ||
|
||
|
||
# controll output | ||
|
||
aws iam get-user --query 'User.Arn' --output text | ||
|
||
aws iam list-users --query 'Users[0]' | ||
|
||
aws iam list-users --query 'Users[*].{name:UserName, arn:Arn}' | ||
|
||
aws iam list-users --query 'Users[*].[UserName, Arn]' # output without keys | ||
|
||
aws iam list-users --query 'Users[?UserName==`den`].[UserName, Arn]' # output where UserName==den | ||
|
||
aws ec2 describe-volumes --query 'Volumes[*].{ID:VolumeId,InstanceId:Attachments[0].InstanceId,AZ:AvailabilityZone,Size:Size}' | ||
|
||
|
||
# S3 | ||
|
||
aws --profile <user> s3 ls s3://<backet> --recursive --human-readable | ||
|
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,11 @@ | ||
=== | ||
EC2 | ||
=== | ||
|
||
aws ec2 describe-security-groups --group-names 'Default' --query 'SecurityGroups[0].OwnerId' --output text | ||
describe-regions # show available regions | ||
|
||
aws ec2 stop-instances --instance-ids <ids> # stop instances | ||
aws ec2 start-instances --instance-ids <ids> # start | ||
|
||
|
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,102 @@ | ||
=== | ||
ECS | ||
=== | ||
|
||
Step 1: Configure repository | ||
create repository | ||
|
||
Step 2: Build, tag, and push Docker image | ||
|
||
Step 3: Create a task definition | ||
Task definition name | ||
Container name | ||
Image | ||
Memory Limits (MB) | ||
Port mappings | ||
|
||
Step 4: Configure service | ||
Service name | ||
Desired number of tasks | ||
Add ELB | ||
|
||
Step 5: Configure cluster | ||
Cluster name | ||
EC2 instance type | ||
Number of instances | ||
Key pair | ||
Security group | ||
Container instance IAM role | ||
|
||
############################################################################### | ||
|
||
ECS | ||
|
||
Create cluster: clusterName1 | ||
ECS cluster clusterName1 | ||
|
||
Create task definition: clusterName1 taskDefName1 | ||
Task definition taskDefName1:1 | ||
|
||
Create instances for: clusterName1 | ||
ECS instances for clusterName1 | ||
|
||
Create service: servName1 | ||
Service created. Tasks will start momentarily. View: servName1 | ||
|
||
|
||
EC2 | ||
|
||
CloudFormation stack created | ||
CloudFormation stack arn:aws:cloudformation:eu-west-1:798327215437:stack/EC2ContainerService-clusterName1/a12e95d0-c1f2-11e6-adc6-503abe701cfd | ||
|
||
Internet gateway created | ||
Internet gateway igw-2b3ef34f | ||
|
||
VPC created | ||
VPC vpc-50024b34 | ||
|
||
Route table created | ||
Route table rtb-995c45fd | ||
|
||
VPC attached gateway created | ||
VPC attached gateway EC2Co-Attac-6YYFGR8UODP0 | ||
|
||
Subnet 1 created | ||
Subnet 1 subnet-e92243b1 | ||
|
||
ELB security group created | ||
ELB security group sg-e1009987 | ||
|
||
Subnet 2 created | ||
Subnet 2 subnet-ff3e1a9b | ||
|
||
Public routing created | ||
Public routing EC2Co-Publi-1JR7V606VFBC5 | ||
|
||
Subnet 1 association created | ||
Subnet 1 association rtbassoc-46f3be21 | ||
|
||
ECS security group created | ||
ECS security group sg-a60099c0 | ||
|
||
Subnet 2 association created | ||
Subnet 2 association rtbassoc-45f3be22 | ||
|
||
Auto Scaling group created | ||
Auto Scaling group EC2ContainerService-clusterName1-EcsInstanceAsg-RMPBUPVOQ9OC | ||
|
||
Launch configuration created | ||
Launch configuration EC2ContainerService-clusterName1-EcsInstanceLc-953ZPR1US8UH | ||
|
||
Elastic load balancer created | ||
Elastic load balancer EC2Contai-EcsElast-5NIU1WVQN742 | ||
|
||
|
||
ECR | ||
--- | ||
|
||
aws ecr get-login | ||
|
||
aws ecr describe-repositories | ||
aws ecr list-images --repository-name my-web-app | ||
|
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,21 @@ | ||
=== | ||
IAM | ||
=== | ||
|
||
# attach exist managed policy to user | ||
aws iam attach-user-policy --policy-arn arn:aws:iam::aws:policy/<value> --user-name <value> | ||
|
||
# create new managed policy | ||
aws iam create-policy --policy-name <value> --policy-document file://<value> | ||
|
||
# get user ID | ||
aws iam get-user --query 'User.Arn' --output text | ||
aws iam get-user | awk '/arn:aws:/{print $2}' | ||
aws iam list-users --query 'Users[?UserName==`den`].[Arn]' --output text | ||
|
||
aws iam create-group --group-name <value> # create group | ||
list-groups # show groups | ||
attach-group-policy --group-name <value> --policy-arn <policy_arn> # attach policy to group (example arn - arn:aws:iam::aws:policy/AdministratorAccess) | ||
list-attached-group-policies --group-name <value> # show attached policies | ||
remove-user-from-group --user-name <value> --group-name <value> # delete user from group | ||
delete-group --group-name <value> # delete group (first remove the users in the group, delete inline policies and detach any managed policies) |
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,9 @@ | ||
=== | ||
AWS | ||
=== | ||
|
||
.. toctree:: | ||
:maxdepth: 2 | ||
:glob: | ||
|
||
* |
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 @@ | ||
== | ||
S3 | ||
== | ||
|
||
# link to the file: | ||
https://<aws_region>.amazonaws.com/<backet_name>/<file_name> | ||
Example: | ||
https://s3-eu-west-1.amazonaws.com/my-super-bucket/linux-155549_960_720.png | ||
|
||
|
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,52 @@ | ||
===================== | ||
Anaconda instructions | ||
===================== | ||
|
||
http://conda.pydata.org/docs/_downloads/conda-cheatsheet.pdf | ||
|
||
`Link text <http://conda.pydata.org/docs/_downloads/conda-cheatsheet.pdf>` | ||
|
||
# update | ||
conda update conda | ||
conda update anaconda | ||
|
||
conda list # display a list of installed packages and their versions | ||
|
||
python # run the Python shell | ||
|
||
# create a new environment named /envs/snowflakes with the program Biopython | ||
conda create --name snowflakes biopython | ||
conda create --name bunnies python=3 astroid babel | ||
|
||
# To activate this environment, use: | ||
source activate snowflakes | ||
|
||
# To deactivate this environment, use: | ||
source deactivate | ||
|
||
conda info --envs # see a list of environments | ||
|
||
|
||
conda create --name <dest_name> --clone <source_name> # Make an exact copy of an environment | ||
|
||
conda remove --name flowers --all # remove environment | ||
<pkg_name> # remove pkg from flowers | ||
|
||
conda search python # search packages contain 'python' | ||
--full-name python # search packages with full name 'python' | ||
|
||
conda install <pkg_name> # install pkg to current env | ||
--name <env_name> <pkg_name> # install pkg to 'env_name' environment | ||
--channel https://conda.anaconda.org/pandas <pkg_name> # install a package from Anaconda.org | ||
|
||
pip install <pkg_name> # install via pip | ||
uninstall <pkg_name> # uninstall via pip | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
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,11 @@ | ||
======== | ||
Anaconda | ||
======== | ||
|
||
.. toctree:: | ||
:maxdepth: 2 | ||
:glob: | ||
|
||
* | ||
|
||
|
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 @@ | ||
======= | ||
Ansible | ||
======= | ||
|
||
# https://habrahabr.ru/post/195048/ | ||
|
||
|
||
# config | ||
/etc/ansible/ansible.cfg or ~/.ansible.cfg | ||
host_key_checking = False # if host changed.. known_hosts... | ||
|
||
# hosts | ||
/etc/ansible/hosts | ||
|
||
ssh-keygen | ||
ssh-copy-id # to hosts | ||
|
||
ssh-agent bash | ||
ssh-add ~/.ssh/id_rsa | ||
|
||
ansible <[group_of_hosts]> -a "/bin/echo Hello, World!" | ||
|
||
ansible all -m ping # ping known hosts | ||
|
||
ansible all -m ping -u spider # ping with user name | ||
|
||
ansible all -m ping -u bruce -b # to root user | ||
ansible all -m ping -u bruce -b --become-user batman # to sudo user | ||
|
||
ansible all -a "/bin/echo hello" | ||
|
||
|
||
ansible-playbook -i <inventory> <playbook.yml> | ||
|
||
|
||
# play playbook with ask sudo pass or root | ||
|
||
ansible-playbook -i inventory playbooks/lemp.yml --ask-become-pass(-K) -u spider | ||
ansible-playbook -i inventory playbooks/lemp.yml -u root | ||
|
||
|
||
|
||
|
||
|
||
192.168.0.5 ansible_become=true ansible_user=manager # become for all operations | ||
|
||
ansible webservers -m service -a "name=nginx state=stopped" | ||
|
||
|
||
{{ ansible_distribution_release }} # trusty, ... | ||
{{ ansible_distribution }} # Debian, ... | ||
|
||
|
||
Inventory file example | ||
---------------------- | ||
|
||
Example ``inventory``:: | ||
|
||
[WebServersG1] | ||
webserver1-g1 ansible_ssh_port=4444 ansible_ssh_host=192.168.1.50 ansible_ssh_user=ubuntu | ||
staging.test.com.ua | ||
|
||
[WebServersG2] | ||
webserver1-g2:4444 # alternative SSH port | ||
webserver2-g2 | ||
|
||
[WebServersProxy] | ||
webserver-proxy1 | ||
webserver-proxy2 | ||
|
||
[DataBase] | ||
db1 | ||
db2 | ||
|
||
[DataBaseSlave] | ||
dbs1 | ||
dbs2 | ||
|
||
[SomeServers] | ||
someserver1 | ||
someserver2 | ||
|
||
|
||
[WEB:children] | ||
WebServersG1 | ||
WebServersG2 | ||
WebServersProxy | ||
|
Oops, something went wrong.