Skip to main content

Posts

Showing posts from March, 2020

How to download file in S3 using PowerShell and install downloaded file

Downloading file from S3 to local folder can be done in different ways, using Copy-S3Object, Read-S3Object and other methods. This needs AWS PowerShell modules to be loaded on the host machine where the cmdlets will be run. If the host system has AWS CLI modules already installed, "aws s3 cp" command can also be used in PowerShell. Newer versions of PowerShell support the ampersand "&" symbol, plus the command line to be executed. See code example below. Code below requires that AWS credentials has been configured on the system, if need to set credentials see this AWS link on how to setup: https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-files.html PowerShell code to download file using "aws s3 cp" cli command. The command below downloads "vc_redist.x64.exe" and rename it to "vc.exe" and put to c:\temp folder. #rename the path to the correct AWS path which is displayed right below the ribbon tab...

AWS EC2 Add Tag with multiple values separated by commas

PowerShell got cmdlets that supports AWS, adding an EC2 Tag in AWS using PowerShell is quite straight forward. Adding multiple tag values is another thing.  If multiple tags have to be added, it would make sense to separate those values by commas, it will be easy to read and would also indicate that the value separated by commas are different but share the same main key. Adding tags like this in PowerShell is quite easy. Here’s the code: aws ec2 create-tags --resources i-123456abc, i-7896543afsd, i-0123098sdf ` --tags 'Key=\"Product\",Value=User_flawed',    'Key=\"Dept\",Value=Warehouse', ` 'Key=\"Location\",Value=SF_Holly', 'Key=\"Function\",Value=Null_Database',   ` 'Key=\"Crawlers_Remarks\",Value=\"Indexer, Whatever, Ongoing\"    ' These are instance id’s in which the tag will be created: i-123456abc, i-7896543afsd, i-0123098sdf New tags: ...