Showing posts with label configuration. Show all posts
Showing posts with label configuration. Show all posts

Monday, June 23, 2014

AWS CLI multiple profiles

Details on multiple AWS CLI profiles can be found here: http://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-started.html#cli-multiple-profiles

Here is a summary of the highlights:
1. Location and name of configuration file:  Directory ~/.aws. File name is config.

2. Define a profile by tying this at command prompt: aws configure --profile tomlaszeast (tomlaszeast is the name of the profile)

3. Setting the profile to use is done using this command:
aws configure --profile tomlaszeast



AWS EC2 user data

You can perform any bootstrapping action you would like using user data.  Here is an example of installing Apache, PHP, and MySQL.  Then Apache, PHP and MySQL are started.  Then a sample application is installed on Apache.

#!/bin/sh
yum -y install httpd php mysql php-mysql
chkconfig httpd on
/etc/init.d/httpd start
cd /tmp
wget http://us-east-1-aws-training.s3.amazonaws.com/self-paced-lab-4/examplefiles-as.zip
unzip examplefiles-as.zip
mv examplefiles-as/* /var/www/html

Monday, March 31, 2014

AWS Elastic Beanstalk basics

When first getting started with AWS Elastic Beanstalk here are some basic things to know
1. Logging : In Java, logging is done using the Apache Commons Logging framework. Logs can be captured with Apache Log4j or any other component that supports Apache Commons Logging.
2. Custom AMIs can be used : The process is documented here: http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/using-features.customenv.html
3. RDS support: Amazon RDS Oracle, MySQL and SQL Server databases can deployed as part of you Elastic Beanstalk application. 
4. Launch New Environment to get OS patches : Amazon periodically updates the AMIs that were used to build the server instances, but servers can’t be updated while their running. When you launch a new environment, you get the updates.
5. Load Balancing : The Elastic Beanstalk service creates the load balancer for you.
6. Auto Scaling : The service creates the auto scaling configuration and group for you.
7..Custom configuration : Example Uses for YAML Configuration 

  • Define custom environment variables beyond PARAMx
  • Identify files to be downloaded to hosts 
  • Can automatically unpack downloaded archive files
  • Specify software to install Specify which services should run on hosts 
  • Create and run scripts 
  • Create and configure AWS resources

Sunday, March 30, 2014

AWS CLI multiple profiles

When using the AWS CLI, you may be working with multiple AWS accounts.  Therefore, you will want to have multiple profiles.  The profile configuration file is contained in the ~/.aws/config on Linux, OS X, or Unix.  In this file, you will list all of your profiles. At the command prompt or in your .profile file you can have do the following to chose the profile you would like:
export AWS_DEFAULT_PROFILE=<profilename>

Sunday, March 23, 2014

Installing PHP and AWS PHP SDK on Mac

Many instructions for PHP and AWS PHP SDK installation and configuration assume deep knowledge of PHP and ability to locate configuration files.

To get the AWS PHP SDK, you first need to get PHP running on Mac.  PHP comes preinstalled but not running, here is how to get it running:
1. Modify https.conf in directory /private/etc/apache2.
2. To change this file, you need to have access as root or super user.  I attempted to su - root and sudo vi but this did not work as not supported on Mac. I had to sudo su as specified here: http://serverfault.com/questions/43362/su-not-working-on-mac-os-x
4. Test if PHP is running.  
a. First need to create php.info file in eh DocumentRoot directotoy.  The default directory (DocumentRoot) on the Mac is "/Library/WebServer/Documents". You can always check: /private/etc/apache2/httd.conf to find the DocumentRoot directory.
The php.info looks like:
            <php phpinfo(); ?>


Some good information here: http://www.php.net/manual/en/install.macosx.bundled.php

b. Test using this in browser: http://localhost/info.php

6. Install AWS PHP SDK using Composer. The instructions are here: http://docs.aws.amazon.com/aws-sdk-php/guide/latest/installation.html
Follow these instructuions with these caveats/changes. 
WARNING: Be careful where you run the install from. I ran from /private/etc and my AWS SDK was installed in /private/key/vendor.  So my AWS PHP SDK is here:  /private/etc/vendor/aws/aws-sdk-php
a. During this step-  curl -sS https://getcomposer.org/installer | php,
you will get this error. 
#!/usr/bin/env php
Some settings on your machine make Composer unable to work properly.
Make sure that you fix the issues listed below and run this script again:

The detect_unicode setting must be disabled.
Add the following to the end of your `php.ini`:
            detect_unicode = Off

A php.ini file does not exist. You will have to create one.
The file is in /private/etc/php.ini. You can copy /private/etc/php.ini.default to /private/etc/php.ini and then modify php.ini to add detect_unicode = Off.
Note: You need to be su and also need to chmod 666 to the php.ini file to be able to edit it.

b. If you try this command "php composer.phar install", you will probably get this error unless you did the first step. So do the first step, if not done.  It does not tell you this in instructions but file needs to be here: /private/etc

The instructions for testing the installation are here:
http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/SettingUpTestingSDKPHP.html.  I did the test for DynamoDB as this what I was going to be using.
1.The following is an example of such a configuration file, named config.php:
This file can be placed anywhere. I decided to put it here: /private/etc/vendor/aws/aws-sdk-php

1. The instructions tell you to execute these commands (it may appear as thought they need to be issued from the command prompt, this is not the case):
use Aws\DynamoDb\DynamoDbClient;
// Instantiate the client with your AWS access keys
$aws = Aws\Common\Aws::factory('./config.php');
$client = $aws->get('dynamodb');
This actually needs to be in a php file:
<?php
use Aws\DynamoDb\DynamoDbClient;
// Instantiate the client with your AWS access keys
$aws = Aws\Common\Aws::factory('/private/etc/vendor/aws/aws-sdk-php/config.php');
$client = $aws->get('dynamodb');
?>

When you run the test php fle (“php test.php”, or whatever you called it), you will get the error: PHP Fatal error:  Class 'Aws\Common\Aws' not found in /private/etc/vendor/aws/aws-sdk-php/dynamodb/test.php on line 

You need to add this line to all you php files:
1.require '/private/etc/vendor/autoload.php';
This is actually documented here but unless you know PHP makes no sense:
http://docs.aws.amazon.com/aws-sdk-php/guide/latest/installation.html


Your updated test.php file will look like this:

            <?php
            require '/private/etc/vendor/autoload.php';
use Aws\DynamoDb\DynamoDbClient;
// Instantiate the client with your AWS access keys
$aws = Aws\Common\Aws::factory('/private/etc/vendor/aws/aws-sdk-php/config.php');
$client = $aws->get('dynamodb');
?>


2. Also change line “$aws = Aws\Common\Aws::factory("./config.php");” to point to location of configuration file.  In my case, you can see the change made above: Aws\Common\Aws::factory('/private/etc/vendor/aws/aws-sdk-php/config.php');

Monday, December 2, 2013

Tuesday, October 16, 2012

Oracle APEX on AWS Oracle RDS

Oracle APEX on AWS Oracle RDS requires the APEX HTTP Listener to be installed on an EC2 Instance.  It also requires the that the Oracle RDS instance is setup to run APEX.  This is done by adding an APEX XMLDB option group to the Oracle RDS Instance.  Details can be found here:
http://aws.typepad.com/aws/2012/08/additional-rds-features-oracle-xml-db-and-oracle-application-express-apex.html

Currently, AWS Oracle RDS supports APEX 4.11.