mcrumbmeetup 22 may 14: umbraco and amazon

45
umbraco and amazon agebase // dan lister

Upload: dan-lister

Post on 04-Jul-2015

1.142 views

Category:

Internet


0 download

DESCRIPTION

A brief introduction to Amazon AWS and it's many acronyms. Followed by an explanation of different strategies to host Umbraco applications within the cloud. Including single server instances, auto-scaling and load balanced examples. I'll also go through some of the pain and teething problems experienced with deployments, setup and maintenance.

TRANSCRIPT

Page 1: McrUmbMeetup 22 May 14: Umbraco and Amazon

umbraco and amazon agebase // dan lister

Page 2: McrUmbMeetup 22 May 14: Umbraco and Amazon

agebase.co.uk

agenda

A run through of how to host single server applications, load balanced applications and auto scaling Umbraco

applications in Amazon AWS.

An introduction to Amazon

AWS and it’s many acronyms. A break down of each service

required to host Umbraco applications.

Page 3: McrUmbMeetup 22 May 14: Umbraco and Amazon

agebase.co.uk

amazon aws part one

Page 4: McrUmbMeetup 22 May 14: Umbraco and Amazon

agebase.co.uk

service types

wfoundation services

Nsapplication services

gadministration

services

Page 5: McrUmbMeetup 22 May 14: Umbraco and Amazon

agebase.co.uk

Our Comitment !

e

administration services

Monitoring

Deployment & Automation

Identity & Access

g

Page 6: McrUmbMeetup 22 May 14: Umbraco and Amazon

agebase.co.uk

Our Comitment !

e

application services

Messaging

Content Distribution

Search

Distributed Computing

Workflow

NsMedia

Transcoding

Page 7: McrUmbMeetup 22 May 14: Umbraco and Amazon

agebase.co.uk

Our Comitment !

e

foundation services

Storage

Networking

Compute

wDatabase

Page 8: McrUmbMeetup 22 May 14: Umbraco and Amazon

agebase.co.uk

services of interest

VPC S3

ELB SES

Cloud WatchEC2

AMI Auto Scaling

RDS

Page 9: McrUmbMeetup 22 May 14: Umbraco and Amazon

agebase.co.uk

vpc

virtual private cloud !Amazon Virtual Private Cloud lets you provision a logically isolated section of the Amazon Web Services Cloud where you can launch AWS resources in a virtual network that you define.

Included Free Tier

Unlimited Free Tier Hours

Page 10: McrUmbMeetup 22 May 14: Umbraco and Amazon

agebase.co.uk

elb

elastic load balancing !Elastic Load Balancing automatically distributes your incoming application traffic across multiple Amazon EC2 instances. It detects unhealthy instances and reroutes traffic to healthy instances until the unhealthy instances have been restored. Elastic Load Balancing automatically scales its request handling capacity in response to incoming traffic.

Included Free Tier

750 Free Tier Hours

15 GB Free Tier Data Processing

Page 11: McrUmbMeetup 22 May 14: Umbraco and Amazon

agebase.co.uk

ec2

elastic cloud compute !Amazon Elastic Compute Cloud (Amazon EC2) is a web service that provides resizable computing capacity that you use to build and host your software systems.

Included Free Tier

750 Free Tier Hours

t1.micro Free Tier Instance Type

Page 12: McrUmbMeetup 22 May 14: Umbraco and Amazon

agebase.co.uk

ami

amazon machine image !An Amazon Machine Image (AMI) provides the information required to launch an instance, which is a virtual server in the cloud. You specify an AMI when you launch an instance, and you can launch as many instances from the AMI as you need.

Included Free Tier

Unlimited Free Tier Count

Page 13: McrUmbMeetup 22 May 14: Umbraco and Amazon

agebase.co.uk

rds

relational database service !Amazon Relational Database Service (Amazon RDS) is a web service that makes it easier to set up, operate, and scale a relational database in the cloud. It provides cost-efficient, resizable capacity for an industry-standard relational database and manages common database administration tasks.

Included Free Tier

750 Free Tier Hours

20 GB Free Tier Storage

Page 14: McrUmbMeetup 22 May 14: Umbraco and Amazon

agebase.co.uk

s3

simple storage service !You can use Amazon Simple Storage Service (Amazon S3) to store digital files on AWS. Files stored in Amazon S3 are called objects, and every object is stored in a location called a bucket.

Included Free Tier

5 GB Free Tier Storage

20000 Get & 2000 Put Free Tier Requests

Page 15: McrUmbMeetup 22 May 14: Umbraco and Amazon

agebase.co.uk

ses

simple email service !Amazon Simple Email Service (Amazon SES) is a cost-effective outbound-only email-sending service built on the reliable and scalable infrastructure that Amazon.com has developed to serve its own customer base. With Amazon SES, you can send transactional email, marketing messages, or any other type of high-quality content and you only pay for what you use.

Included Free Tier

2000 per day Free Tier Messages

Page 16: McrUmbMeetup 22 May 14: Umbraco and Amazon

agebase.co.uk

cloud watch

Collects and reports metrics on your AWS resources. You can set alarms on these metrics to trigger actions.

Included Free Tier

10 metrics & 10 alarms Free Tier Count

1000000 Free Tier API Requests

Page 17: McrUmbMeetup 22 May 14: Umbraco and Amazon

agebase.co.uk

auto scaling

Auto Scaling is a web service designed to launch or terminate Amazon EC2 instances automatically based on user-defined policies, schedules, and health checks.

Included Free Tier

Unlimited Free Tier Count

Page 18: McrUmbMeetup 22 May 14: Umbraco and Amazon

agebase.co.uk

elastic beanstalk

Amazon Web Services provides Elastic Load Balancing to automatically distribute incoming web traffic across multiple Amazon Elastic Compute Cloud (Amazon EC2) instances. With Elastic Load Balancing, you can add and remove EC2 instances as your needs change without disrupting the overall flow of information.

Page 19: McrUmbMeetup 22 May 14: Umbraco and Amazon

agebase.co.uk

using aws

WEB CLI SDK API

command line interface !

A text-based tool you install on your computer. It

connects over the Internet to manage your AWS

resources.

software development kits !

Class libraries and tools you add to your application so it

can manage AWS resources.

query apis !

Low-level APIs that are exposed online through

service- and region-specific endpoints. You call API actions by using HTTP

requests.

management console !

The quick way to get started. Graphical user interface you

access online at console.aws.amazon.com

Page 20: McrUmbMeetup 22 May 14: Umbraco and Amazon

agebase.co.uk

hosting umbraco in amazon part two

Page 21: McrUmbMeetup 22 May 14: Umbraco and Amazon

agebase.co.uk

pre deployment tasks

create iam user !An IAM user should be created to create and maintain your Amazon AWS account rather than using your root credentials. Typically, this IAM user should be Power User.

remember api credentials !When creating your IAM user, you’ll be given API credentials to use when deploying to Amazon AWS. For example, when deploying via Visual Studio.

auto generated password !Its sometimes best to auto generate passwords for your IAM users to encourage stronger passwords. You can configure your password policy within the IAM section.

create a key pair !Creating a key pair will allow developers access to Amazon services. For example, allowing a developer to remote desktop connect to an EC2 instance.

Page 22: McrUmbMeetup 22 May 14: Umbraco and Amazon

agebase.co.uk

hosting methods

Nauto scaling

2elastic beanstalk

1single ec2 instance

Page 23: McrUmbMeetup 22 May 14: Umbraco and Amazon

agebase.co.uk

single ec2 instance

Page 24: McrUmbMeetup 22 May 14: Umbraco and Amazon

agebase.co.uk

single ec2 instance: step one

create ec2 instance !> Select a free tier only option. > Choose the Microsoft Windows Server 2012 Base AMI. > Choose a micro instance. > Set the security group name. > Set the security group description. > Select a key pair for RDP access.

Page 25: McrUmbMeetup 22 May 14: Umbraco and Amazon

agebase.co.uk

single ec2 instance: step two

amend security groups !> Allow all HTTP connections. > Allow your IP address through RDP connections.

Page 26: McrUmbMeetup 22 May 14: Umbraco and Amazon

agebase.co.uk

single ec2 instance: step three

create rds instance !> Free tier SQL Server Express edition > Choose a micro instance size with 30 GB of storage. > Give the instance a meaningful identifier which is no less than 15 characters. > Define an administrator username and password.

Page 27: McrUmbMeetup 22 May 14: Umbraco and Amazon

agebase.co.uk

single ec2 instance: step four

amend rds security group !> Allow internal VPC MSSQL connections. > Allow your IP address through MSSQL connections.

Page 28: McrUmbMeetup 22 May 14: Umbraco and Amazon

agebase.co.uk

single ec2 instance: step five

rdp to ec2 instance !> Using your key pair, right click the EC2 instance to retrieve the Windows IP Address and Administrator password. > Once connected, install IIS. > Download Umbraco and repoint the Default Web Site directory to your Umbraco application. > Set folder permissions correctly.

Page 29: McrUmbMeetup 22 May 14: Umbraco and Amazon

agebase.co.uk

single ec2 instance: step six

create database !> Connect to your RDS instance via SQL Server Management Studio. > Create a database to contain your Umbraco data.

Page 30: McrUmbMeetup 22 May 14: Umbraco and Amazon

agebase.co.uk

single ec2 instance: step seven

install umbraco !> Navigate to your EC2 instance’s public DNS. > You’ll be directed to the Umbraco installation process. > Enter your RDS instance database connection details. > Once completed, you will be directed to Umbraco.

Page 31: McrUmbMeetup 22 May 14: Umbraco and Amazon

agebase.co.uk

elastic beanstalk

Page 32: McrUmbMeetup 22 May 14: Umbraco and Amazon

agebase.co.uk

elastic beanstalk: step one

create elastic beanstalk app !> Create a new application. > Choose IIS as its predefined configuration. > Choose a single instance environment type. > Create an RDS instance to install within the environment. > Use a key pair to be able to RDP into your EC2 instance behind your ELB.

Page 33: McrUmbMeetup 22 May 14: Umbraco and Amazon

agebase.co.uk

elastic beanstalk: step two

check cname !> Once created, check your environment address to see if Amazon’s default application has been installed. > For Elastic Beanstalk environments, CNAMEs can only be routed. If you require an A Record pointing to the environment, Amazon’s Route 53 should be used.

Page 34: McrUmbMeetup 22 May 14: Umbraco and Amazon

agebase.co.uk

elastic beanstalk: step three

amend rds security group !> Allow your IP address through MSSQL connections.

Page 35: McrUmbMeetup 22 May 14: Umbraco and Amazon

agebase.co.uk

elastic beanstalk: step four

create umbraco solution !> Using Visual Studio, create a new empty Web Application and install the UmbracoCms NuGet package. > Run the solution locally. > Install Umbraco against the RDS instance created in your Elastic Beanstalk environment. > Once installed, add the connection string to your web.release.config transform file and turn off custom errors (just for now). > Include all files and folders within your solution as only included files will be deployed to your Elastic Beanstalk environment. > Create a ProjectName.wpp.targets file in the root of your application to set folder permissions correctly once deployed. See http://ageba.se/SgaOuo for an example.

Page 36: McrUmbMeetup 22 May 14: Umbraco and Amazon

agebase.co.uk

elastic beanstalk: step five

deploy to amazon !> Using the Amazon AWS Toolkit extension, deploy the project the AWS. > As the environment already exists, choose the redeploy application option. Make sure to change your region in order to see your application. > You can re-use a previous deployment details if you have already deployed before. > Deploy the project.

Page 37: McrUmbMeetup 22 May 14: Umbraco and Amazon

agebase.co.uk

elastic beanstalk: step six

visit the site !> Wait for the Elastic Beanstalk environment to deploy the version. > Once deployed, visit the environments CNAME to verify the site works correctly. You shouldn’t have to go through the installation process again.

Page 38: McrUmbMeetup 22 May 14: Umbraco and Amazon

agebase.co.uk

auto scaling

Page 39: McrUmbMeetup 22 May 14: Umbraco and Amazon

agebase.co.uk

auto scaling: step one

turn on auto scaling !> Set a minimum and maximum count for your Elastic Beanstalk Environment. A minimum of 1 and maximum of 4 is default. > Change Auto Scaling metric to CPU Utilisation. > Set a maximum threshold of 70%. > Set a minimum threshold of 20%. !This will allow your environment to be automatically scaled out and in depending on your applications performance. If more visitors are directed to your application and one EC2 instance struggles, another EC2 instance will automatically be created and added to the environment.

Page 40: McrUmbMeetup 22 May 14: Umbraco and Amazon

agebase.co.uk

auto scaling: step two

extended distributed calling !> Install the AgeBase Extended Distributed Calling package locally. This package allows content to be edited on any EC2 instances and updates other, unknown EC2 instances within your environment. See http://ageba.se/1p1nFJX for more details. > Once installed, reference the package’s assemblies within your solution. > Add the configuration elements mentioned in the package’s documentation. > Add environment configuration values as per the documentation to your Elastic Beanstalk environment. > Add your VPC IP address to the Elastic Beanstalk’s security group on port 80. This allows each EC2 instance to communicate with each other. > Re-deploy.

Page 41: McrUmbMeetup 22 May 14: Umbraco and Amazon

agebase.co.uk

extras

Page 42: McrUmbMeetup 22 May 14: Umbraco and Amazon

agebase.co.uk

centralised media

creating a media san !When auto scaling your Umbraco application within an Elastic Beanstalk environment, media should be centralised. To accomplish this, a shared media SAN could be created to be used across all your environments. !> Create an ec2 instance to act as a SAN. > Create a share on the SAN to contain media folders. > Map the appropriate share as a virtual directory in IIS when the application is being deployed. To map the virtual directory, create a power shell script to dynamically create a virtual directory when being deployed. > The power shell script can be stored in S3 and downloaded to the current EC2 instance being deployed. > To execute the script, use an ebextensions folder to download the script and run on the current ec2 instance. See http://ageba.se/1sROhza for more details.

Page 43: McrUmbMeetup 22 May 14: Umbraco and Amazon

agebase.co.uk

ses

using simple email service !An Amazon SES service is automatically created for each account. Although production access has to be authorised by Amazon. !To use Amazon SES within your application, obtain SMTP details from the console and update your web.config settings accordingly. The EnableSsl attribute must be set to true. Emails can only can sent from domains which have been previously verified via the console

Page 44: McrUmbMeetup 22 May 14: Umbraco and Amazon

agebase.co.uk

deployment config

automate environments !Environment creation can be automated via deployment configuration files. Using AWS Deploy and a deployment configuration file, Elastic Beanstalk applications and environments can created automatically. The configuration file allows developers to specify such things instance type, instance size, instance counts and network configuration. !See http://ageba.se/1nmawfa for more details regarding configuration settings.

Page 45: McrUmbMeetup 22 May 14: Umbraco and Amazon

thanks any questions?

!

@dan_lister