Skip to main content

Posts

Showing posts from 2018

How to List The Capacity attributes for Dynamodb table with powershell

I was muddling around attempting to find  away to display the ReadCapacity and WriteCapacity for the dyanmodb table with powersheel. Wanted to share this as it took me quite bit of trial error before getting this right. $PrimaryRegion = 'ap-southeast-2' $ddbtablelist = Get-DDBTableList -Region $PrimaryRegion foreach ($ddbtablelist_item in $ddbtablelist) { Get-DDBTable -Region $PrimaryRegion -TableName $ddbtablelist_item |Select- Object TableName , ItemCount, @{Name= "ProvisionedThroughput" ;Expression={ $_.ProvisionedThroughput | Select- Object ReadCapacityUnits ,WriteCapacityUnits}}|Select- Object -Property * -ExcludeProperty ProvisionedThroughput -ExpandProperty ProvisionedThroughput}

Delete Manual RDS Snapshots with Powershell

As you may have observed already , when a RDS instance is deleted all the automated snapshots disappear along with it giving us little or no option to recover. However, manual snapshots can be retained indefinitely for a additional cost. You will then realize that AWS has imposed a softlimit of 100 manual snapshots per region and account . This can be extended by speaking to AWS but this will cause the cost to increase over a period of time. There is also the other downside, were  snapshots can't be moved to a S3 bucket. After much discussuion we decided to delete the manual snapshots older than 10 days. Attached is the sample script. $20Days = (Get-Date).Adddays(-20) $ManulSonpshot = Get-RDSDBSnapshot -Region us-east-1 | Sort-Object SnapshotCreateTime | select -First 1000 | Where-Object {$_.SnapshotType -eq "manual" -and $_.SnapshotCreateTime -le $20Days } | Select-Object DBInstanceIdentifier , Engine , SnapshotCreateTime ,dbsnapshotidentifier foreach ($ManulSo