How To Deploy Applications on Amazon Elastic Beanstalk

Elastic beanstalk is an app deployment service provided by Amazon web services. It is more of a management wrapper where the core services like ec2, load balancing and auto scaling are deployed in the backend without manual intervention. You can deploy your php, ruby, java etc.,, applications from the management console using amazon elastic beanstalk.

Beanstalk is not a pure PaaS solution. It is a mix of IaaS and Paas, because you get to choose the instance types, and scaling properties. In a pure PaaS solution, you just have to upload the application in war or other format and you don’t have to worry about the backend infrastructure, the provider will take care of that. In beanstalk you decide your infrastructure, like which type of instance to launch, auto scaling should be enabled or not etc etc,. as opposed to other PaaS solution like cloudbees.

Also read: Hosting highly available static website using cloudfront, route53 and S3

Advantages:

  1. Versioning of application
  2. Environment setup helps you setup dev and prod environments and you can deploy the application from dev to prod anytime.
  3. Saving application log files to s3
  4. Pay only for the backend resources like ec2, elb etc,.There is no charge for the beanstalk service.
  5. Application monitoring and notification serive.

You can read the beanstalk review here

Getting started:

Note: AWS wont charge you for using the beanstalk service, but it will charge you for the resources deployed in the backend. If you are on a free tier , then you can test beanstalk for free using t1.micro instances.

  1. Sign in to AWS management console
  2. Click elastic beanstalk service to open the elastic beanstalk dashboard.
  3. Click “create an new application” option from top right corner.
  4. Give your application a name and description and click create
5. Select the environment tier which has two options. Webserver and worker. In this am going to deploy a sample app , so am selecting the webserver option.

Select a platform in the predefined configuration option. In my case it is PHP

If you are going to host your web app using a single instance, select single instance under environemt type. If you want application to be hosted in one or more instances, then select load balancing and autoscaling option.Am going to select the later.

6. If you have an PHP application ready , then you can upload the application using upload option. You can upload the application in Zip format. The uploaded application will be save in S3 first and them copied to /var/www when the instance with web server is ready.Am goin to select sample application.

7. Give your environment a name like, development, production etc,.Type in a unique identifier for your application endpoint. This end point is used for mapping your custom domain to your beanstalk application.

8. In the additional resources option there is RDS and VPC. If you are going to use RDS service for your applications database you can tick this option.

If you want your application in any of the new or existing VPC’s , you can select the VPC option.
Am not going the select either of the options. Am going to deploy the application in the default VPC

9. In the configuration details part , select eh instance type, key pair to ssh in the instance which will be created after creating the application. Enter the email address to get notifications regarding your application.

Application health check url is the specific path of your application which elb sends request to check the status of your application . eg : http://developement.elasticbeanstalk.com/index.php.
Enter the details and click continue.

10. Review you application configuration and click create.

11. Environment creation takes a while. Once the environment is created , you can access your application using the elastic beanstalk url (eg: development.beanstalk.com). In this sample app you will see a page like the figure below.

Once the application is deployed , you can configure, upload and redeploy your application from the dashboard.

You can deploy applications to beanstalk using eb and git. For more info visit this link 

You can make custom changes to the application environment by ssh in to the instance created.

If you want to terminate the application and all the resources associated with that application, you can simply use the terminate option in the actions tab. It will automatically terminate the aws resources which got provisioned during application creation( eg: instances, load balancers, autoscaling groups etc).

If you are using database for your application, you can have a database in the EC2 instance which is created in the backend or you can create a RDS instance and use the database endpoint in your application.

Kindly share this post and leave a comment for more info.

POST REPLY

Pin It on Pinterest

Shares
Share This