Digital Tips n Tricks

  • Home
  • Mobile Tricks
    • Internet
    • Market
    • Stock
  • SmartPhones
    • Dvd
    • Games
    • Software
      • Office
  • Parent Category
    • Child Category 1
      • Sub Child Category 1
      • Sub Child Category 2
      • Sub Child Category 3
    • Child Category 2
    • Child Category 3
    • Child Category 4
  • Featured
  • Health
    • Childcare
    • Doctors
  • Uncategorized

Saturday, July 16, 2022

testing

 Tricks Spot     July 16, 2022     No comments   

A Snapshot is a point in time copy of volume which is used for backup & recovery. A snapshot is used to create a known state of volume & restore it when needed. In this post we are going to look in to how snapshots can be used as backup of EBS volumes. Snapshot management consists of number of different steps. Search for volumes which are tagged for backup. Create snapshot of volumes and tag snapshots, add description to snapshots; delete snapshots that are older than the retention period. So, how we can schedule or automate these steps? We will be using Amazon CloudWatch Events. It allows to automate things based on events happening in AWS infra. CloudWatch Events integrates with AWS Lambda. Meaning you can execute your code with Lambda Function in response to an event or schedule using CloudWatch Events. In this case we are going to have two Lambda Functions; 1. Create snapshots, tag them & 2. Delete snapshots. And these steps should be in sequence.
Param (
[string][Parameter(Mandatory = $True)] $VolumeId,
[int][Parameter(Mandatory = $True)] $NewSize
)
$CurrentSize = Get-EC2Volume -Volume $VolumeId
If ($NewSize -lt $CurrentSize.Size) { Write-Host "New volume must be larger than current" -ForegroundColor Red; break}
Edit-EC2Volume -VolumeId $VolumeId -Size $NewSize | Out-Null
$ModifiedSize = (Get-EC2Volume -Volume $VolumeId).Size
While ($ModifiedSize -ne $NewSize) {
Start-Sleep 5
$ModifiedSize = (Get-EC2Volume -Volume $VolumeId).Size
}
Write-Host ""
Write-Host "Volume:$VolumeId is resized to size:$NewSize" -ForegroundColor Green
$InstanceId = (Get-EC2Volume -Volume $VolumeId | Select-Object -ExpandProperty Attachments)[0].InstanceId
$Commands = @(
'$DiskNumber = (Get-Partition -DriveLetter D).DiskNumber',
'Update-Disk -Number "$DiskNumber"',
'$Size = Get-PartitionSupportedSize -DriveLetter D',
'Resize-Partition -DriveLetter D -Size $Size.SizeMax'
)
$Parameter = @{
commands = $Commands
}
$Document = 'AWS-RunPowerShellScript'
Write-Host ""
Write-Host "Extending D: drive..." -ForegroundColor Green
Try {
$Cmd = Send-SSMCommand -DocumentName $Document -Parameter $Parameter -InstanceId $InstanceId
While ($Cmd.Status -ne 'Success') {
$Cmd = Get-SSMCommand -CommandId $Cmd.CommandId
Start-Sleep 5
}
Write-Host ""
Write-Host "D: drive is extended" -ForegroundColor Green
}
Catch {
Write-Host ""
Write-Host "Failed to extend drive" -ForegroundColor Red
}
view raw resize-ebsvolume.ps1 hosted with ❤ by GitHub
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg
Email ThisBlogThis!Share to XShare to Facebook

Related Posts:

  • Candy Crush Free Lives for Android and Facebook (UNLIMITED!) 1. Go to Settings on your device. 2. Scroll down to  ”Date & time” 3. Tap the check-mark next to “automatic date & time” … Read More
  • COMPUTER TIPS ONE SHOULD KNOW Many hardcore computer users might think themselves above learning new tricks, but there’s always new things to learn that will help improve your sk… Read More
  • How to Cut Videos with VLC Media Player To cut a video using VLC media player you need to follow the steps as given below- Run VLC media player and active Advance control. To … Read More
  • Install and Boot Windows 8 from a External Hard Disk Let me point out the overall steps in this process : Create a Virtual Hard Disk (VHD) on External Hard Disk Do a Silent installation of Window… Read More
  • How to reset and create new user account in MAC OS without logging into the system Reset 10.5 Leopard & 10.6 Snow Leopard password Power on or restart your Mac. At the chime (or grey screen if your chime is turned off), hold d… Read More
Older Post Home

0 comments:

Post a Comment

Popular Posts

  • How to Create a Password Protected Folder Without any Software
    Before you get started you need to create a folder that will store your password protected folder, this is just an ordinary folder and c...
  • How to use your Mobile as Wireless Mouse and Keyboard
    RemoteDroid turns your phone into a wireless keyboard and mouse with touchpad, using your wireless network. It's an application for p...
  • How to Reset the Trial Period of Software to work it Lifetime?
    Want to use the Trial or Evaluation copy of a Software for lifetime? It is possible. You can use the trial software for lifetime. Just Fol...
  • How to Install and Move Android Apps to SD Card
    Android apps install to the internal storage by default, but you can also set the SD card as your default install location. Follow the bel...

Recent Posts

LightBlog

Categories

Android (21) Apple (9) Cab (2) Chrome (5) Facebook (4) Food (1) Galaxy Tab (11) MAC (2) Macbook (3) Mobile (23) Notepad (3) Taxi (2) VLC (2) Whatsapp (1) Windows (27) YouTube (1)

Unordered List

Pages

  • Home

Text Widget

Blog Archive

Main Menu

  • Home
  • About
  • Contact
Powered by Blogger.

Report Abuse

About Me

Tricks Spot
View my complete profile

testing

A Snapshot is a point in time copy of volume which is used for backup & recovery. A snapshot is used to create a known state of volume ...

Put your ad code here

Total Pageviews

50381

Menu

  • <i class="fa fa-cog"></i> Features
  • Mobile
  • Contact Us

Search This Blog

Social Media Icons

  • twitter
  • facebook
  • gplus
  • instagram
  • rss
  • youtube
  • pinterest

Translate

Social Media Icons

  • twitter
  • facebook
  • gplus
  • instagram
  • rss
  • youtube
  • pinterest

Recent News

Recent Post

Facebook

Comments

Recent

Featured Video

Sample Text

Copyright © 2025 Digital Tips n Tricks | Powered by Blogger
Design by Hardeep Asrani | Blogger Theme by NewBloggerThemes.com