Tag: Elastic Beanstalk

  • AWS Elastic Beanstalk

    Here are some useful command working with AWS Elastic Beanstalk

    eb init = initialize environment
    eb list
    eb logs
    eb console = open aws console
    eb open = open application in web browser
    eb appversion = show application versions
    eb health = show health of application
    eb codesource = select local or codecommit
    eb deploy = deploy code
    eb events = Gets recent events.
    eb create = Creates a new environment.
    eb labs download = download application to local computer
    

    Application get stored in folder

    /var/app/ondeck
    
  • Deploy Docker Image using Elastic Beanstalk

    Deploy Docker Image using Elastic Beanstalk

    First create a file docker-eb-run.json with following content

    {
        "AWSEBDockerrunVersion": "1",
        "Image": {
            "Name": "bitnami/tomcat"
        },
        "Ports": [
            { "ContainerPort": "8080" }
        ]
    }
    

    here i used docker container bitnami/tomcat, you can use any container.

    Login to AWS Console, go to AWS Elastic Beanstalk page. Click Get Started.

    On next page, it ask for

    Application Name  = put anything you like here
    Platform = Docker
    

    For Application code, select Upload your code, click upload button and select “docker-eb-run.json” file you created.

    Click “Create application” button. AWS will start deploying your docker container in Elastic Beanstalk, it will take a few minutes to complete.

    Once deployment is completed, you get URL like

    http://serveroktest-env.ap7uahtfyh.ap-south-1.elasticbeanstalk.com
    

    aws

  • Getting Started with Amazon Elastic Beanstalk

    Getting Started with Amazon Elastic Beanstalk

    AWS Elastic Beanstalk is a PaaS (Platform As Service) allow you to quickly deploy applications. To install AWS Elastic Beanstalk command line tool, run

    sudo pip install awsebcli
    

    Starting your first Project

    Create a folder with a php file.

    mkdir ~/www/eb-project-1
    cd  ~/www/eb-project-1
    echo "" > index.php
    

    Add our project to git.

    git init
    git add .
    git commit -a -m "initial commit"
    

    Initialise Elastic Beanstalk project

    run

    eb init
    

    It will ask you to select a region

    Select a region near to you. It will ask for Application name, you can use default name or enter your own. Since you have PHP file, it will auto detect you are using PHP and ask if you want to create PHP project.

    It ask for if you need SSH access, answer yes, it will create an SSH key.

    Creating your Environment

    Now your project is ready, lets make it live in Amazon Elastic Beanstalk.

    eb create
    

    This ask you few questions like environment name, DNS name (this need to be unique).

    You will be able to see the link for the application in the terminal, in this case, the URL is http://eb-project-1-dev.us-west-2.elasticbeanstalk.com, you can open the URL in browser to see the application. You can also use

    eb open
    

    This will open the application in your default web browser.

    Updating Your Application

    Make some changes to index.php and commit the changes. To deploy new version of your application to Amazon Elastic Beanstalk, run

    eb deploy
    

    SSH Access

    To get SSH access to EC2 instance running your application, run

    eb ssh
    

    Terminate your application

    Once you are done with you application, you can terminate it with command

    eb terminate
    

    aws

  • Amazon AWS Elastic Beanstalk Command Line Interface

    To install Amazon AWS Elastic Beanstalk Command Line Interface (EB CLI), run

    pip install awsebcli
    

    To create a project.

    mkdir serverok 
    cd serverok
    git init
    eb init
    

    To create servers in AWS, run

    eb create
    

    It ask some question, once you done, it shows URL like following

    In this cause, the URL http://serverok-dev.us-west-2.elasticbeanstalk.com/ can be used to access my application.

    To deploy an application, create a file, commit to git.

    In few minutes, you will be able to see the file on your Elastic Beanstalk application url

    http://serverok-dev.us-west-2.elasticbeanstalk.com/test.php

    When you are done with it, you can terminate the environment with command

    eb terminate
    

    It will show in AWS Console > Elastic Beanstalk with info “Waiting for EC2 instances to terminate.”