天天看点

[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.

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:

after running the <code>eb init</code> command and following the guided setup will create a new directory in our project named <code>.elasticbeanstalk</code>. within this configuration file, there is a configuration file named <code>config.yml</code>. 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:

 elasticbeanstalk only interests in source code, put all the code into zip with package.json. you can also upload zip using mangement console.

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 <code>package.json</code> file. as described in the video, we've included the <code>build</code> command to perform these steps for us.

it creates `/www` folder and `archive.zip`.

runing:

choose:

after successfully deploy to elastic beanstalk, open aws management console -&gt; elastic beanstalk -&gt; configuration -&gt; software -&gt; edit button

[AWS] Using AWS Elastic Beanstalk

add all necessary environment properties.

in "configuration" -&gt; "security", can see that it is using 

[AWS] Using AWS Elastic Beanstalk

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