zoukankan      html  css  js  c++  java
  • [AWS] Using AWS Elastic Beanstalk

    Elastic Beanstalk is a powerful Development Operations tool (Dev Ops) to deploy your code to AWS services and infrastructure with minimal effort.

    EB CLI

    We'll be using the Command Line Interface to work with Elastic Beanstalk. This will provide us with a set of commands to create new applications and deploy code to these systems. Before continuing, you must install the EB CLI by reading the AWS Doc Instructions for Install for your platform.

    Run:

    eb --version
    eb init

    After running the eb init command and following the guided setup will create a new directory in our project named .elasticbeanstalk. Within this configuration file, there is a configuration file named config.yml. This is the set of instructions Elastic Beanstalk will follow when provisioning your AWS infrastructure and deploying your code.

    config.yml:

    Add following code to the file:

    branch-defaults:
      default:
        ...
    deploy:
      artifact: ./www/Archive.zip
    global:

     ElasticBeanstalk only interests in source code, put all the code into zip with package.json.

    You can also upload zip using mangement console.

    Creating Deployable Build Archives and Deploying

    Now that you have a running Beanstalk instance, we must package our code into a format that is usable by Elastic Beanstalk. We do this by transpiring our typescript into javascript and then zipping the contents into a single file which we can upload. NPM allows us to define simple script commands in the package.json file. As described in the video, we've included the build command to perform these steps for us.

    "clean": "rimraf www/ || true",
    "build": "npm run clean && tsc && cp -rf src/config www/config && cp .npmrc www/.npmrc && cp package.json www/package.json && cd www && zip -r Archive.zip . && cd ..",

    Run:

    npm run build

    It creates `/www` folder and `Archive.zip`.

    Deploy to AWS

    Runing:

    eb create

    Choose:

    Environment Name,
    DNS CNAME prefix,
    load balance type: 2) application
    Spot Fleet request: N

    After successfully deploy to Elastic Beanstalk, open AWS Management Console -> Elastic Beanstalk -> Configuration -> Software -> Edit button

    Add all necessary Environment properties.

    In "Configuration" -> "Security", can see that it is using 

    Need to assign: AmazonRDSDataFullAccess, AmazonS3FullAccess, AdministratorAccess-AWSElasticBeanstalk and AWSElasticBeanstalkReadOnly.

    Since we need to modify s3, database, and ElasticBeanstalk needs to setup EC2 and load balancer.

    After the settings, application should work

  • 相关阅读:
    JSON学习笔记
    Java面试题之对static的理解
    【知了堂学习笔记】java基础知识之继承
    【知了堂学习笔记】多态基本知识
    Final关键字
    子父类构造函数特点
    原来学编程这么简单,如何理解程序的本质(今天听了【遇见狂神说】发布的《从HelloWorld到程序本质的思考》这个视频,有了自己的一些感悟,在这里和大家做一个分享)
    浅谈c3p0连接池和dbutils工具类的使用
    Mysql数据库重要知识点
    Express安装与调试
  • 原文地址:https://www.cnblogs.com/Answer1215/p/14569737.html
Copyright © 2011-2022 走看看