48
PROGRAMMING AMAZON WEB SERVICES Andreas Chatzakis | Solutions Architect AWS for Startups London, 12 th September 2013

AWS for Startups, London - Programming AWS

Embed Size (px)

DESCRIPTION

An overview of the SDKs and tools available when working with AWS. Review of sample application code and a live demo of a deployment using AWS Elastic Beanstalk.

Citation preview

PROGRAMMING AMAZON WEB SERVICES

Andreas Chatzakis | Solutions Architect

AWS for Startups

London, 12th September 2013

• Deploying your app: Elastic Beanstalk

• Demo

• Programmable Infrastructure: APIs, SDKs, CLI

Agenda

“HOW

DO I DEPLOY

MY APP ?”

AWS Application Management Solutions

Elastic Beanstalk OpsWorks CloudFormation EC2

Convenience Control

Higher-level Services Do it yourself

ELASTIC

BEANSTALK QUICKLY DEPLOY AND MANAGE

APPLICATIONS

Select a Container

IIS, Node.js, PHP, Python, Ruby, Tomcat

DEPLOY

YOUR

APPLICATION

User Application

Application Service

HTTP Service

Language Interpreter

Operating System

Host

THE CONTAINER

IS CREATED IN EC2

ELASTIC BEANSTALK TAKES CARE

OF THE ENVIRONMENT

ADDING

ELASTIC LOAD BALANCER

CONFIGURING

AUTO SCALING GROUP

LAUNCHING

INSTANCE(S)

ALL WIRED WITH

ELASTIC

BEANSTALK

APPLICATION IS PUBLISHED

UNDER A CNAME

WITH LOGS AND

APP VERSIONS

STORED

IN S3

HOW

DO YOU CREATE

AN

APPLICATION

FOR

ELASTIC BEANSTALK ?

LIKE

ANY

OTHER

APPLICATION

Java .war file

Microsoft Web

Deploy package

PHP .zip file

Python .zip file

Git integration IDE plugins

PACKAGE UP AS NORMAL

CONSOLE DEPLOYMENTS

AND VERSION UPDATES

CheckDNSAvailability elastic-beanstalk-check-dns-availability

CreateApplication elastic-beanstalk-create-application

CreateApplicationVersion

elastic-beanstalk-create-application-version

CreateEnvironment

elastic-beanstalk-create-environment

eb init wizard to initialize an application

eb start/stop start/stop an application

eb update

update application version

eb status

get status of a running application

COMMAND LINE TOOLS

AND “WIZARDS”

ECLIPSE INTEGRATION

VISUAL STUDIO INTEGRATION

GIT INTEGRATION

CONTAINER CONFIGURATION

CONTAINER CUSTOMIZATION

ENVIRONMENTAL PROPERTIES

define('S3_BUCKET', $_SERVER['PARAM1']);

Accessible from within the application e.g.:

TIME FOR

A DEMO

AWS is a set of building blocks

Object Storage

Send Email

Message Queue

Notification (Pub & Sub)

NoSQL DB

Video Transcoding

Content Delivery

Monitoring

Search

WHAT DO I NEED TO ? DO

S3

SES

SQS

SNS

DynamoDB

Elastic Transcoder

CloudFront

CloudWatch

CloudSearch

Object Storage

Send Email

Message Queue

Notification (Pub & Sub)

NoSQL DB

Video Transcoding

Content Delivery

Monitoring

Search

WHAT DO I NEED TO ?

= PROGRAMMABLE

PLATFORM

API | SDK | CLI

API | SDK | CLI

// Load the AWS PHP SDK

require __DIR__ . '/../vendor/autoload.php';

$aws = Aws\Common\Aws::factory('/path/to/config.json');

// Instantiate the s3 client

$s3client = $aws->get('s3');

// List available S3 buckets

try {

$result = $s3client->listBuckets();

foreach ($result['Buckets'] as $bucket) {

echo "- {$bucket['Name']}\n";

}

} catch (Aws\S3\Exception\S3Exception $e) {

echo "Request failed.\n";

}

echo "\n";

// upload an object into S3

$s3client->putObject(array(

'Bucket' => $bucketName,

'Key' => $objectKey,

'Body' => fopen($file->getPathname(), 'r'),

'ACL' => CannedAcl::PUBLIC_READ,

));

// Instantiate the DynamoDB client

$ddb = $aws->get('dynamodb');

// Get today's flavors from DynamoDB

$date = new DateTime();

$result = $ddb->getItem(array(

'TableName' => 'flavors-of-the-day',

'Key' => array(

'HashKeyElement' => array('N' => $date->format('n')),

'RangeKeyElement' => array('N' => $date->format('j'))

)

));

$flavors = $result->getPath('Item/flavors/SS');

- Temporary AWS credentials provisioned on EC2 instances

- Automatically rotated for you multiple times per day.

- Initialize the client and the AWS SDK will do the rest.

- Increased security & convenience

“All files stored

online by Dropbox

are encrypted and

kept securely on

Amazon’s Simple

Storage Service

(S3) in multiple data

centers located

across the United

States.”

“Amazon DynamoDB initially served as a secondary data

store for user activity and interaction logs.

However, this new NoSQL database service was

integrated into the production environment as the primary

data store when Shazam realized it could support over

500,000 writes per second.”

FREE TIER http://aws.amazon.com/free

TOOLS & SDKs http://aws.amazon.com/tools

ELASTIC BEANSTALK http://aws.amazon.com/elasticbeanstalk

BLOG http://aws.typepad.com