System Operations on Aws-lab 3w-managing Storage (Windows)

Source: Internet
Author: User
Tags schtasks

Create a EC2 instance, make snapshot for EBS volumes, set up periodic backups, upload and manage log files to S3

1.1 Creating a S3 bucket

1.2 Creating an IAM policy

1.3 Creating an IAM role

1.4 Creating a security group

1.5 Creating an EC2 instance

2.1 Connecting to Commandhost instances

2.2 Creating an initialization snapshot

2.2.1 Get a description of the processor instance

AWS EC2 Describe-instances--filter ' name=tag:name,values=processor '

2.2.2 Displays the ID of the instance EBS volume only

AWS EC2 Describe-instances--filter ' name=tag:name,values=processor '--query ' reservations[0]. Instances[0]. Blockdevicemappings[0]. Ebs. {Volumeid:volumeid} '

2.2.3 shows only this instance Instanceid

AWS EC2 Describe-instances--filters ' name=tag:name,values=processor '--query ' reservations[0]. Instances[0]. InstanceId '

2.2.4 Stop the instance

AWS EC2 Stop-instances--instance-ids I-3BC0B3FC

2.2.5 Check the instance stop state

AWS EC2 Describe-instance-status--instance-id I-3BC0B3FC

2.2.6 Create a Snapshot

AWS EC2 Create-snapshot--volume-id VOL-09E651FF

2.2.7 Check the snapshot status

AWS EC2 Describe-snapshots--snapshot-id SNAP-FA894FA9

2.2.8 restarting the processor instance

AWS EC2 Start-instances--instance-ids I-3BC0B3FC

2.2.9 Check the instance start state

AWS EC2 Describe-instance-status--instance-id I-3BC0B3FC

2.3 Creating a recurring snapshot scheduled task

2.3.1 Checking the current region

Type C:\Users\Administrator\.aws\config

2.3.2 Create the script file C:\temp\backup.bat for the scheduled task, as follows:

AWS EC2 Create-snapshot--volume-id vol-09e651ff--region us-west-2 >c:\temp\output.txt 2>&1

2.3.3 Creating a user to perform a scheduled task

NET user Backupuser passw0rd! /add

2.3.4 gives the user permission to execute scripts

C:\temp\ntrights +r sebatchlogonright-u Backupuser

2.3.5 to create a scheduled task

SCHTASKS/CREATE/SC minute/mo 1/tn "Volume Backup Task"/ru backupuser/rp passw0rd! /TR C:\temp\backup.bat

2.3.6 Wait a few minutes to check if the new snapshots is created

AWS EC2 Describe-snapshots--filters "name=volume-id,values=vol-09e651ff"

2.4 Keep last two snapshots

2.4.1 Delete a previously created scheduled task

Schtasks/delete/tn "Volume Backup Task"

2.4.2 Check the current number of all snapshots

AWS EC2 Describe-snapshots--filters "name=volume-id,values=vol-09e651ff"--query ' snapshots[*]. Snapshotid '

2.4.3 Execution Snapshotter.ps1

C:\temp\snapshotter.ps1 us-west-2

2.4.4 Check the current number of snapshots again

AWS EC2 Describe-snapshots--filters "name=volume-id,values=vol-09e651ff"--query ' snapshots[*]. Snapshotid '

3.1 Moving log files to S3

3.1.1 Logging into an processor instance

3.1.2 Configuring the AWS CLI

PS c:\users\administrator> AWS Configureaws access key ID [none]:aws Secret access key [None]:D efault region name [None ]: Us-west-2default output format [None]:

3.1.3 Download Loggen.ps1

(New-object System.Net.WebClient). DownloadFile ("Https://d2lrzjb0vjvpn5.cloudfront.net/sys-ops/v2.4/lab-3-storage-windows/static/loggen.ps1", "C \ Temp\loggen.ps1 ")

3.2.1 Running LOGGEN.PS1

C:\temp\loggen.ps1

3.2.2 Open a new PowerShell window and switch to C:\Temp

CD \temp

3.2.3 move a log file into the S3 bucket that you created earlier

AWS S3 MV Timestamp.log "s3://s3-bucket-edward/logfiles/timestamp-$ (Get-date-format ' m-d-yyyy-h:m:s ')"

3.2.4 Execute the command again

AWS S3 MV Timestamp.log "s3://s3-bucket-edward/logfiles/timestamp-$ (Get-date-format ' m-d-yyyy-h:m:s ')"

3.2.5 List the contents of the S3 bucket

AWS S3 LS S3://s3-bucket-edward

3.2.6 list all objects that begin with/logfiles/

AWS S3 LS S3://s3-bucket-edward/logfiles/

3.2.7 moving files to/logfiles/archive/location

AWS S3 MV S3://s3-bucket-edward/logfiles/<file-name> S3://s3-bucket-edward/logfiles/archive/<file-name >

3.2.8 check whether to move to this location

AWS S3 LS S3://s3-bucket-edward/logfiles/

System Operations on Aws-lab 3w-managing Storage (Windows)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.