Skip to main content


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}

Recent posts

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 ($ManulSonpsho…

How to Backup postgres globals without sysadmin permission in RDS

For those of my Friends who are on postgres RDS and require to backup the globas for a rds instance you would soon find it can't perform a backup with pg_dumpall --globals-only.  The default user that gets created along with the RDS postgres instance does not have adequate permission to get through the backup processes. Bellow is the message that you would receive.

pg_dumpall.exe : pg_dumpall: query failed: ERROR:  permission denied for relation pg_authid At line:1 char:1

+ & 'C:\setup_msi\postgres\bin\pg_dumpall.exe'  -h XXXXXX.cXXXX... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~    + CategoryInfo          : NotSpecified: (pg_dumpall: que...ation pg_authid:String) [], RemoteException    + FullyQualifiedErrorId : NativeCommandError

pg_dumpall: query was: SELECT oid, rolname, rolsuper, rolinherit, rolcreaterole, rolcreatedb, rolcanlogin, rolconnlimit, rolpassword, rolvaliduntil, rolreplication, rolbypassrls, pg_catalog.shobj_description(oid, '…

How To Install a msi/exe with powershell

Today I had to programitacally install a .msi and .exe at the start up of an EC2 instance. By default all them code that needs to be executed during a start up is added to the user data of the EC2 instance.

Bellow was the code used to install the msi and exe
start-process c:\setup\<>.msi /gn -wait

However executing the exe required some effort as it needed special switchers
start-process c:\setup\psqlodbc-setup.exe /install /quiet /norestart  -wait-passthorugh

found the extra switcher doing this

Get the Endpoint for a RDS instnace in powershell

If  you are looking for the endpoint for a RDS instnace and wondered where it had gone. You should find it in the Endpoint property in Get-rdsdbinstance. I found the Get-rdsdbinstance a bit misleading , cause i expected the a expandable property to be {} and found a just text.

Get-RDSDBInstance-Region $region|Where-Object {$_.Engine-eq'Mysql'

Setup Psql Manually

When you use RDS as a service , what you soon find out is that you are not aware of the OS, hardware. You are forced to connect to the RDS instance remotely.

I had the urge to copy data into a postgres RDS instnace and the EC2 instnace that we have backed didn't have psql intalled( the command line tool for postgres). The lasting solution was to get a new AMI backe with the shell for psql, Instead i followed these steps to get the psql shell setup.

Copy the bin, scripts folders from a machine where psql is already works. It generally should be found at C:\Program Files\PostgreSQL\9.6 Download the msvcr120.dll ie link ( and copy it to the bin folder Open the runpsql.bat and change the new location of the “psql.exe"
Make a shortcut of the runpsql.bat to desktop.

RDS for SQL Server - SQL native backups

You soon realize the AWS platform provides some of the maintenance work that we used to do as DBA's. But you would find there are situation where you require some level of control. In late 2016 AWS provided the functionality for SQL server to perform native backups of its RDS instances extending its snapshot functionality.
Solution will attempt to extend what Jeff bar has blogged by providing few extra screen shots and some additional steps.
Steps to follow
1.) Enable the SQL native backups by adding the SQL_Server_Backup_Restore option group

2.) Associate the option group created in step 1 to the RDS instance

 Once you have created the option group, it is mandatory that you associate the newly created option group to the RDS instance that you intend to run the SQL native backup. Faili