Posts

Showing posts from November, 2017

S3 Doesn't Have Folders!

The S3 folder delusion When you AWS console you can create folders to group objects but this is just a delusion deliberately created by AWS to simplify the usage. In reality, S3 has a flat structure and all the objects are on the same level. Here’s the excerpt from AWS documentation that states this fact: In Amazon S3, buckets and objects are the primary resources, where objects are stored in buckets. Amazon S3 has a flat structure with no hierarchy like you would see in a typical file system. However, for the sake of organizational simplicity, the Amazon S3 console supports the folder concept as a means of grouping objects. Amazon S3 does this by using key name prefixes for objects. So essentially AWS is just smart enough to recognize the standard folder notation we’ve been using for ages to make this things easier for us. All about S3 objects.

AWS WAIT command

Wait for … When writing shell scripts by using the CLI there will be the need to wait for a specific condition from time to time. For example, after initiating an EBS snapshot your script might need to wait until the snapshot was completed. Waiting can be achieved with a polling loop and a describe-* command. But there is a simpler solution built into the CLI for this: aws <service> wait <condition>. The following contains a wait command that will block the script until the snapshot has been completed. #!/bin/bash echo "Waiting for EBS snapshot" aws ec2 wait snapshot-completed --snapshot-ids snap-id_abc echo "EBS snapshot completed"   You'll find many more uses for this, and hopefully no more corruption as commands compete.

Killing a stuck Oracle RDS Session

Sometimes you might have a session running over a link to another system and something happens on the source, the session carries on but is never released. All resources used by the session are locked - packages, table rows, etc.... On a physical machine the DBA might have to physically kill the underlying session at an OS level, but with Oracle RDS as a service there is no machine / OS. Fortunately (and recently) there is now a way. It involves finding the session details and passing them into the rdsadmin_util package. select SID, SERIAL#, STATUS from V$SESSION where USERNAME = '****'; begin     rdsadmin.rdsadmin_util.disconnect(         sid    => 3847,         serial => 365); end; / Good luck.

Size of a S3 bucket

How big is my bucket, or does my data look big in this bucket? There was a time where you would list the files and sum up the sizes......... but no more. It is as simple as aws s3 ls --summarize --human-readable --recursive s3://bucket-name/   and by extension listing a folder in a bucket is:   aws s3 ls --summarize --human-readable --recursive s3://bucket-name/directory     See the documentation here .