sábado, 29 de março de 2014

AWS-CLI Command Line Interface for Amazon AWS Administration


1. Introduction


The AWS Command Line Interface is a unified tool to manage your AWS services. With just one tool to download and configure, you can control multiple AWS services from the command line and automate them through scripts.

2. Basic explanation

2.1. Installing


  • To install AWS Command Line Interface in your Windows Operational System, download appropriated binary files: 64 bits or 32 bits
  • To install AWS Command Line Interface in your Linux or Mac, use pip command: Python is required


2.2. Configure AWS-CLI with your account information - Windows

  • Step #1: Get your AWS account information: aws_access_key_id, aws_secret_access_key, aws_security_token
  • Step #2: Configure your default AWS-CLI

C:\Users\Josemar Silva>aws configure
AWS Access Key ID [None]: **************
AWS Secret Access Key [None]: ******************************************
Default region name [None]: sa-east-1
Default output format [None]: text

  • Step #3: Test your AWS-CLI listing all EC2 machines:
C:\Users\Josemar Silva>aws ec2 describe-instances
RESERVATIONS 918139315827 r-5f281c43
GROUPS sg-0bd36d16 awssrv003
INSTANCES 0 x86_64 oJdWt1363791111194 False xen ami-c328f3de i-7e425a62 t1.micro awssrv003 2013-03-22T15:35:51.000Z windows ip-10-248-0-234.sa-east-1.compute.internal 10.248.0.234 ec2-54-232-54-74.sa-east-1.compute.amazonaws.com 54.232.54.74 /dev/sda1 ebs None hvm
BLOCKDEVICEMAPPINGS /dev/sda1
EBS 2013-03-22T15:35:40.000Z False attached vol-b9848b86
MONITORING disabled
PLACEMENT sa-east-1b None default
SECURITYGROUPS sg-0bd36d16 awssrv003
STATE 16 running
TAGS Name Awssrv0003

  • Step #4: Test your AWS-CLI listing all bucktes from S3:


C:\Users\Josemar Silva>aws s3 ls s3://
C:\Program Files\Amazon\AWSCLI\.\dateutil\parser.py:339: UnicodeWarning: Unicod
 equal comparison failed to convert both arguments to Unicode - interpreting th
m as being unequal
2014-01-02 22:54:07 my-backet



  • Step #5: Test copy something to your S3 bucktes:

C:\Users\Josemar Silva>aws s3 cp lixo.txt s3://my-backet/area_backup
upload: .\lixo.txt to s3://my-backet/area_backup


3. References




quinta-feira, 13 de março de 2014

Java Dynamic ArrayList Examples

1. Introduction

This post only gather some references and examples of use of ArrayList in Java


2. Examples


  • Example #1:


List elementList = new ArrayList();
for (int i = 0; i < nodeList.getLength(); i++) {
Element element = (Element) (Node) nodeList.item(i);
if (element.getAttribute(attribute).equals(attributeValue)) {
elementList.add(element);
}
}

  • Example #2:


ArrayList<CellStyle> listCellStyle = new ArrayList<CellStyle>();
// i=0: LEMON_CHIFFON
style = workbook.createCellStyle();
style.setFillForegroundColor(IndexedColors.LEMON_CHIFFON.getIndex());
style.setFillPattern(CellStyle.SOLID_FOREGROUND);
listCellStyle.add(style);





3. References