Skip to main content

Posts

Showing posts from May, 2014

Redshift commands - CLI

Redshift CLI Commands authorize-cluster-security-group-ingress | authorize-snapshot-access copy-cluster-snapshot                    | create-cluster create-cluster-parameter-group           | create-cluster-security-group create-cluster-snapshot                  | create-cluster-subnet-group create-event-subscription                | create-hsm-client-certificate create-hsm-configuration                 | delete-cluster delete-cluster-parameter-group           | delete-cluster-security-group delete-cluster-snapshot                  | delete-cluster-subnet-group delete-event-subscription                | delete-hsm-client-certificate delete-hsm-configuration                 | describe-cluster-parameter-groups describe-cluster-parameters              | describe-cluster-security-groups describe-cluster-snapshots               | describe-cluster-subnet-groups describe-cluster-versions                | describe-clusters describe-default-cluster-parameters      | describe-event-categories

Redshift - CLI

Create Snapshot Backup of Redshift Cluster aws redshift create-cluster-snapshot --cluster-identifier analytics --snapshot-identifier analytics-`date +%d%m%y-%HH:%MM:%SS` Delete Redshift Cluster aws redshift delete-cluster --cluster-identifier analytics --final-cluster-snapshot-identifier analytics-`date +%d%m%y-%HHRs-%MMin-%SSec`| tee analytics-`date +%d%m%y-%HH:%MM:%SS`_metadata.log

How to analyze TAGS

aws ec2 describe-tags --filters "Name=value,Values=pname" aws ec2 describe-tags   To describe the tags for a single resource aws ec2 describe-tags --filters "Name=resource-id,Values=i-5f4e3d2a"    { "Tags" : [ { "ResourceType" : "instance" , "ResourceId" : "i-5f4e3d2a" , "Value" : "Test" , "Key" : "Stack" }, { "ResourceType" : "instance" , "ResourceId" : "i-5f4e3d2a" , "Value" : "Beta Server" , "Key" : "Name" } ] } To describe the tags for a type of resource aws ec2 describe-tags --filters "Name=resource-type,Values=volume"   { "Tags" : [ { "ResourceType" : "vo

AWS - CLI for EC2

Start an Instance aws ec2 start-instances --instance-ids Instance Id Stop an Instance aws ec2 stop-instances --instance-ids Instance Id Create / Delete TAGS   aws ec2 create-tags --resources ami-1a2b3c4d i-10a64379 --tags Key=webserver,Value=   Key=stack,Value=Production aws ec2 create -tags --resources Instance-Id --tags Key=Name,Value=Testing aws ec2 delete -tags --resources Instance-Id --tags Key=Name,Value=Testing Attach / Detach Volumes to EC2 aws ec2 attach -volume --volume-id vol-45de780c --instance-id Instance-Id --device /dev/sdf aws ec2 detach -volume --volume-id vol-45de780c --instance-id Instance-Id --device /dev/sdf Create / Delete EBS Volume aws ec2 create-volume --size 1 --region us-east-1 --availability-zone us-east-1a {     "AvailabilityZone": "us-east-1a",     "Attachments": [],     "Tags": [],     "VolumeType": "standard",     "VolumeId": "vol-6mb5678

Problem in downloading AWS programatic bills from Master Account S3 Bucket to Linked account EC2 instance with CLI

There are certain restriction for this activity and this restriction only applies to access Programmatic Billing access. How to do this?  EC2 instance got created in Linked account. Configured EC2 instance with # aws configure command with Linked account "Access Key" and "Secure Access Key" Need to use # aws configure and this time we need to give Master account's "Access Key" and "Secure Access Key" to reconfigure EC2- CLI Note: This is the only exception for Billing account. For other S3 bucket in other account, you need to set only Bucket Policy aws s3 cp s3://Master-Account-Billing-Bucket . --recursive or  aws s3 cp s3://Master-Account-Billing-Bucket /home/dir --recursive  

CLI - S3

Listing Buckets aws s3 ls Create a Bucket aws s3 mb s3://BucketName Remove a Bucket aws s3 rb s3://BucketName Listing Folders/Files inside Bucket aws s3 ls s3://BucketName / Listing Folders/Files inside Buckets / Folders aws s3 ls s3://BucketName /FolderName/ Copies a single s3 object to a specified bucket and key aws s3 cp s3://Bucket-1/test.txt s3://Bucket-2/test2.txt Copies a single object to a specified bucket while retaining its original name aws s3 cp s3:/Bucket-1/test.txt s3://Bucket-2/ Download file to your current directory from specified Bucket aws s3 cp s3://Bucket-1 . --recursive aws s3 cp s3://Bucket-1 /home/dir1 --recursive Upload file from Directory to specific s3 bucket aws s3 cp myDir s3://mybucket/ --recursive

How to install CLI on LINUX

wget http://s3.amazonaws.com/ec2-downloads/ec2-api-tools.zip sudo mkdir /usr/local/ec2 sudo unzip ec2-api-tools.zip -d /usr/local/ec2 export AWS_ACCESS_KEY=xxxxxxxxxxxxxxxxx export AWS_SECRET_KEY=xxxxxxxxxxxxxxxxxxxxxx $ aws configure AWS Access Key ID [None]: xxxxxxxxxxxxxxxxxxxxxxxxxx AWS Secret Access Key [None]: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx Default region name [None]: us-west-2 Default output format [None]: json