Журнал лабораторных работ

Содержание

Журнал

Среда (12/19/18)

/dev/pts/6
13:51:46
$~
{
}
     [             ]
EOF
fi
~
user@instructor:~/aws$ scripts/create-infrastructure.sh
Usage:
  scripts/create-infrastructure.sh start|stop
user@instructor:~/aws$ scripts/create-infrastructure.sh start
...
user@instructor:~/aws$ git commit -m 'initial revision of create-infrastructure'|
                           push                                                 |
user@instructor:~/aws$ git commit -m 'initial revision of create-infrastructure'|
                           status                                               |
user@instructor:~/aws$                                                          |
                                                                                |
user@instructor:~/aws$
user@instructor:~/aws$
user@instructor:~/aws$ exit
exit
/dev/pts/2
13:52:22
$vim scripts/create-infrastructure.sh
13:53:01
$vim scripts/create-infrastructure.sh
13:56:39
$aws ec2 run-instance --help
usage: aws [options] <command> <subcommand> [<subcommand> ...] [parameters]
To see help text, you can run:
  aws help
  aws <command> help
  aws <command> <subcommand> help
aws: error: argument operation: Invalid choice, valid choices are:
accept-reserved-instances-exchange-quote | accept-transit-gateway-vpc-attachment
accept-vpc-endpoint-connections          | accept-vpc-peering-connection
advertise-byoip-cidr                     | allocate-address
allocate-hosts                           | apply-security-groups-to-client-vpn-target-network
...
search-transit-gateway-routes            | start-instances
stop-instances                           | terminate-client-vpn-connections
terminate-instances                      | unassign-ipv6-addresses
unassign-private-ip-addresses            | unmonitor-instances
update-security-group-rule-descriptions-egress | update-security-group-rule-descriptions-ingress
withdraw-byoip-cidr                      | wait
help
Invalid choice: 'run-instance', maybe you meant:
  * run-instances
  * bundle-instance
13:57:34
$aws ec2 run-instances --help
usage: aws [options] <command> <subcommand> [<subcommand> ...] [parameters]
To see help text, you can run:
  aws help
  aws <command> help
  aws <command> <subcommand> help
Unknown options: --help
13:57:45
$aws ec2 run-instances help
RUN-INSTANCES()                                                RUN-INSTANCES()
NAME
       run-instances -
DESCRIPTION
       Launches  the  specified number of instances using an AMI for which you
       have permissions.
       You can specify a number of options, or leave the default options.  The
       following rules apply:
       o [EC2-VPC]  If you don't specify a subnet ID, we choose a default sub-
         net from your default VPC for you. If you don't have a  default  VPC,
         you must specify a subnet ID in the request.
       o [EC2-Classic]  If  don't  specify an Availability Zone, we choose one
         for you.
       o Some instance types must be launched into a VPC. If you do not have a
         default VPC, or if you do not specify a subnet ID, the request fails.
         For more information, see Instance Types Available Only in a VPC .
13:58:23
$aws ec2 run-instances help | less -R
14:02:24
$vi scripts/create-infrastructure.sh
14:09:59
$nano scripts/create-infrastructure.sh
14:10:13
$!/bin/bash
vpc_id=vpc-08b950cd8140c7403
key_name=user3
security_group=...
shutdown_type=shutdown
start()
{
  private_ip_address="10.2.1.31"
  aws ec2 run-instances \
    --image-id "$image_id" \
    --instance-type "$instance_type" \
...
 [--dry-run | --no-dry-run]
[--ebs-optimized | --no-ebs-optimized]
[--iam-instance-profile <value>]
[--instance-initiated-shutdown-behavior <value>]
[--network-interfaces <value>]
[--private-ip-address <value>]
[--elastic-gpu-specification <value>]
^G Get Help      ^O Write Out     ^W Where Is      ^K Cut Text      ^J Justify       ^C Cur Pos       ^Y Prev Page     M-\ First Line
Use "fg" to return to nano.le     ^\ Replace       ^U Uncut Text    ^T To Linter     ^_ Go To Line    ^V Next Page     M-/ Last Line
[1]+  Stopped                 nano scripts/create-infrastructure.sh
14:10:25
$nano scripts/create-infrastructure.sh
14:15:47
$vi scripts/create-infrastructure.sh
14:17:51
$vi scripts/create-infrastructure.sh
14:20:43
$vi scripts/create-infrastructure.sh
14:25:11
${
  private_ip_address="10.1.1.31"
  public_ip=associate-public-ip-address
  aws ec2 run-instances \
    --image-id "$image_id" \
    --instance-type "$instance_type" \
    --key-name "$key_name" \
    --subnet_id "$subnet_id" \
    --instance-initiated-shutdown-behavior"$shutdown_type" \
    --private-ip-address "$private_ip_address" \
    --tag-specifications "$tags"] \
...
    --tag-specifications        ] \
    --
    :
}
stop()
{
 :
}
if [      = start ]; then
  start
14:31:16
${
#!/bin/bash
image_id=ami-09693313102a30b2c
instance_type=t2.micro
vpc_id=vpc-08b950cd8140c7403
key_name=user3
shutdown_type=stop
"scripts/create-infrastructure.sh" 45L, 783C
#!/bin/bash
image_id=ami-09693313102a30b2c
instance_type=t2.micro
...
    --tag-specifications "$tags"] \
    --${public_ip}
    :
}
stop()
{
 :
}
if [ "$1" = start ]; then
  start
прошло 27 минут
14:59:02
$ ))

14:59:03
$git status
On branch master
Your branch is up-to-date with 'origin/master'.
Untracked files:
  (use "git add <file>..." to include in what will be committed)
        scripts/
nothing added to commit but untracked files present (use "git add" to track)
14:59:10
$git add scripts/

14:59:21
$git status
On branch master
Your branch is up-to-date with 'origin/master'.
Changes to be committed:
  (use "git reset HEAD <file>..." to unstage)
        new file:   scripts/create-infrastructure.sh
14:59:22
$git commit -m 'initial revision of create-infrastructure'
[master 267fcbb] initial revision of create-infrastructure
 Committer: ValeryBarai <user@m3.class.sl>
Your name and email address were configured automatically based
on your username and hostname. Please check that they are accurate.
You can suppress this message by setting them explicitly:
    git config --global user.name "Your Name"
    git config --global user.email you@example.com
After doing this, you may fix the identity used for this commit with:
    git commit --amend --reset-author
 1 file changed, 50 insertions(+)
 create mode 100755 scripts/create-infrastructure.sh
15:02:37
$git config --global user.name "ValeryBarai"

15:04:21
$git push
Username for 'https://github.com': ValeryBarai
Password for 'https://ValeryBarai@github.com':
Counting objects: 4, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (4/4), done.
Writing objects: 100% (4/4), 908 bytes | 0 bytes/s, done.
Total 4 (delta 0), reused 0 (delta 0)
To https://github.com/ValeryBarai/AWS.git
   4750fbe..267fcbb  master -> master
15:04:39
$exit
exit
There are stopped jobs.

Четверг (12/20/18)

/dev/pts/0
08:17:28
$ssh m0
The authenticity of host 'm0 (172.20.13.183)' can't be established.
ECDSA key fingerprint is SHA256:OmAUOGefATc3fUfxoq0a8q0SorClVWEnwAh7KqphL8A.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'm0' (ECDSA) to the list of known hosts.
user@m0's password:
Linux instructor 4.9.0-8-amd64 #1 SMP Debian 4.9.130-2 (2018-10-27) x86_64
The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Thu Dec 20 10:18:15 2018 from 172.20.13.191
l3-agent is already running: pid=1843; pidfile=/home/user/.lilalo/l3-agent.pid
user@instructor:~$ d
-bash: d: command not found
user@instructor:~$ logout
Connection to m0 closed.
08:18:45
$ssh m0
user@m0's password:
Linux instructor 4.9.0-8-amd64 #1 SMP Debian 4.9.130-2 (2018-10-27) x86_64
The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Thu Dec 20 10:18:41 2018 from 172.20.13.180
l3-agent is already running: pid=1843; pidfile=/home/user/.lilalo/l3-agent.pid
user@instructor:~$ logout
Connection to m0 closed.
/dev/pts/2
08:20:08
$cd AWS/

08:20:16
$vi scripts/create-infrastructure.sh
08:26:46
$vi scripts/create-infrastructure.sh
08:35:45
$vi scripts/create-infrastructure.sh
08:43:51
$^C

08:48:00
$^C

08:51:00
$^C

08:51:49
$^C

08:52:46
$(
SHUTDOWN_TYPE=stop
SUBNET_ID=subnet-060d8c5c243f86664
TAGS="ResourceType=instance,Tags=[{Key=installation_id,Value=${USER_NAME}-1},{Key=Name, Value=NAME}]"
start_vm()
{
{ local_private_ip_address="$1"
  local_public_ip_address="$2"
  local_name="$3"
  local tags=$(echo $TAGS | sed s/NAME/$name/)
  #local tags=$(TAGS/NAME/$name}
  aws ec2 run-instances \
    --image-id "$image_id" \
    --instance-type "$instance_type" \
    --subnet-id "$SUBNET_ID" \
    --instance-initiated-shutdown-behavior "$SHUTDOWN_TYPE" \
"scripts/create-infrastructure.sh" 63L, 1608C written
прошло 29 минут
/dev/pts/2
09:21:49
$vi teacher_script.txt
09:22:31
$rn teacher_script.txt teacher_script_1.txt
bash: rn: command not found
прошло 17 минут
09:40:07