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:

  • How to work offline in Google Chrome When you open any web page inside Google Chrome, it connects to the Internet, fetches the latest version of the page from the server and displa… Read More
  • 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 phones and tabl… Read More
  • How to turn your Windows 7 laptop into a wireless hotspot Sharing your Windows internet connection via software has traditionally been a tricky business. There are programs that can help you do it, but t… Read More
  • How to Make Your Android Phone Looks like Windows 8: Step 1: Turn on Wi-fi or internet in your mobile and go to “Play Store” app. Step 2: Now tap on search box and search for the app named… Read More
  • How to Charge Samsung Galaxy Tab with USB cable How to use your usb cable to charge your Samsung Galaxy Tab 2 on your computer. Is it really Possible. Yes No need to buy expensive additional usb … Read More
Older Post Home

0 comments:

Post a Comment

Popular Posts

  • 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 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 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...
  • Test
    $DNs = Get-ADOrganizationalUnit -SearchBase "OU=MFG,OU=Citrix,OU=InfrastructureServices,DC=bsci,DC=bossci,DC=com" -Filter * -Searc...

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

50788

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