mcrumbmeetup 22 may 14: umbraco and amazon
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
umbraco and amazon agebase // dan lister
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.
agebase.co.uk
amazon aws part one
agebase.co.uk
service types
wfoundation services
Nsapplication services
gadministration
services
agebase.co.uk
Our Comitment !
e
administration services
Monitoring
Deployment & Automation
Identity & Access
g
agebase.co.uk
Our Comitment !
e
application services
Messaging
Content Distribution
Search
Distributed Computing
Workflow
NsMedia
Transcoding
agebase.co.uk
Our Comitment !
e
foundation services
Storage
Networking
Compute
wDatabase
agebase.co.uk
services of interest
VPC S3
ELB SES
Cloud WatchEC2
AMI Auto Scaling
RDS
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
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
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
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
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
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
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
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
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
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.
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
agebase.co.uk
hosting umbraco in amazon part two
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.
agebase.co.uk
hosting methods
Nauto scaling
2elastic beanstalk
1single ec2 instance
agebase.co.uk
single ec2 instance
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.
agebase.co.uk
single ec2 instance: step two
amend security groups !> Allow all HTTP connections. > Allow your IP address through RDP connections.
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.
agebase.co.uk
single ec2 instance: step four
amend rds security group !> Allow internal VPC MSSQL connections. > Allow your IP address through MSSQL connections.
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.
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.
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.
agebase.co.uk
elastic beanstalk
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.
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.
agebase.co.uk
elastic beanstalk: step three
amend rds security group !> Allow your IP address through MSSQL connections.
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.
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.
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.
agebase.co.uk
auto scaling
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.
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.
agebase.co.uk
extras
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.
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
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.
thanks any questions?
!
@dan_lister