How to Deploy MEAN (With MYSQL) Stack Application on AWS LightSail

Before we start deploying the application onto the server we need to make sure our application is working and all the components are installed in it for that you need to follow the following steps. 

Step 1:Run the Angular CLI project in IDE e.g. Webstorm

The first thing you need to do is open your project or application in your preferred Integrated Development Environment(IDE). We are using WebStorm for this particular application.

node js project opened in webstorm

Step 2:Install the node modules using npm install

Now you need to run the following command to install the node module.

 npm install

Step 3: Run Ng Serve and access the application at http://localhost:4200/

Run the following command and then open http://localhost:4200/ to see the new app run in your browser. 

Note: When you use the ng serve command to build an app and serve it locally, the server automatically rebuilds the app and reloads the page when you change any of the source files.

 ng serve
ng serve command

Step 4: Run the Node JS project in IDE and Install the node modules 

Now you need to open your nodejs project or in the Integrated Development Environment(IDE).

After restarting the scripts you need to run the following command to install the node module.

 npm install    

Then Connect the node application with MYSQL.

Once connected we will start our application on the server by running this command.

 npm start

Once the application is working fine at http://localhost:4200/ – it’s time to start the deployment.

Go to the Angular project and update the rest API URL from http://localhost:3000/ to your domain name where you are deploying e.g. or if it’s an IP address then change it to http://XX.XXX.XX.XXX/

Now we will run the ng build command in the terminal. ng build is the command you use when you’re ready to build your application and deploy it. The CLI will analyze the application and build the files, all while optimizing the application as best as it can

ng build
ng build command screenshot of IDE

Once the project is built. Go to the Angular directory and copy the files in the dist folder. Then navigate to the public folder of Node JS and paste the files there.

Step 1: Create the Database

Lightsail makes database administration more efficient by managing your common maintenance and security tasks. You can create your Mysql database by following the steps given here.

Step 2: Update the database connection settings 

Once the database is created you need to connect and configure it. you can use any standard MySQL client application or utility to connect to it. You can connect your MySQL database by following the steps given here.

Step 3: Archive the MEAN Stack application Folder

Locate the folder of the application you created on your local machine. Select the folder and compress it to create a zip executable file.

To set up your project you first need to login into the AWS account and go to the Lightsail dashboard and then perform the following steps.

Login and Create Instance

  • Click on create an instance.
  • Select a platform Linux/Unix.
  • Select a blueprint Apps + OS (checked by default) 
  • Click Change SSH key pair Select existing key pair or create a new one.
  • Choose your instance plan for example USD 4.5.
  • Identify your instance (Your Lightsail resources must have unique names.) eg: firstnode_app.
  • Click on Create instance button.

Connect and Configure the Instance 

Once the instance is created you have to click on the terminal icon to connect the instance and write the following command in the terminal.

cd stack


cd apps
Sudo mkdir myapp
sudo mkdir /opt/bitnami/apps/myapp/conf
sudo mkdir /opt/bitnami/apps/myapp/htdocs
sudo mkdir /opt/bitnami/apps/myapp/htdocs
sudo nano /opt/bitnami/apps/myapp/conf/httpd-prefix.conf
  •  Add Include "/opt/bitnami/apps/myapp/conf/httpd-app.conf"
sudo nano /opt/bitnami/apps/myapp/conf/httpd-prefix.conf Add Include "/opt/bitnami/apps/myapp/conf/httpd-app.conf"
sudo nano /opt/bitnami/apps/myapp/conf/httpd-app.conf
Add ProxyPass /

ProxyPassReverse /
sudo nano /opt/bitnami/apache2/conf/bitnami/bitnami-apps-prefix.conf
  • Include "/opt/bitnami/apps/myapp/conf/httpd-prefix.conf

FileZilla is a powerful and free software for transferring files over the Internet. It is a very popular FTP client and is used by webmasters from all over the world. Here you can download FileZilla software.

We need this to transfer our files between our local computer and Linux instance on Amazon Lightsail. For this, we will connect our instance using SFTP (SSH File Transfer Protocol).To do this, we need to get the private key for our instance, and then use it to configure the FTP client

You can follow the steps given at the link here.

Locate the folder of the application you created on your local machine. Select the folder and compress it to create a zip executable file.

To upload your project you need to log into the Lightsail console. Once logged in you need to select the terminal of the instance you created and go to the folder you created or in our case “myapp” and upload the zip folder there.

Once the folder is uploaded you needed to unzip the folder containing your project.

Now you need to run the following commands in the terminal.

This command will restart the scripts on your server.


 sudo /opt/bitnami/ restart apache  

After restarting the scripts you need to run the following command to install the node module.

 npm install    

Once installed we will start our application on the server by running this command.

 npm start

Now that everything is set up we will check if our application is successfully deployed or not. 

For that, you need to copy the IP address of the instance you created shown on your Lightsail dashboard. Copy the IP address and paste it into the URL bar of the browser.

If it’s successful this will appear upon loading

Now that our application is deployed we need to make sure that the process keeps running by itself even when we have closed our local machine. To do that you need to run this command in the terminal.

Forever start  bin/www

We have successfully deployed a MEAN Stack application on (AWS) Lightsail. We hope you find this article helpful. Feel free to contact us if you need any help regarding this topic. 

Do let us know the topics you want us to cover in the comment section or reach out to us with your queries by clicking the contact form below.

136 thoughts on “How to Deploy MEAN Stack Application on AWS LightSail”

  1. I wish to show thanks to the writer for rescuing me from this particular challenge. After looking out throughout the world wide web and getting tricks which were not powerful, I was thinking my life was over. Existing devoid of the strategies to the issues you’ve solved through your good write-up is a serious case, and the ones which may have in a negative way damaged my career if I had not noticed your web blog. Your primary expertise and kindness in dealing with all the stuff was invaluable. I’m not sure what I would have done if I hadn’t come across such a thing like this. It’s possible to at this time look ahead to my future. Thank you very much for your skilled and results-oriented help. I will not think twice to endorse your web page to anyone who should get care on this subject matter.

  2. F*ckin’ remarkable issues here. I am very happy to peer your article. Thank you so much and i am having a look ahead to touch you. Will you please drop me a mail?

  3. I wanted to thank you for this wonderful read!! I definitely enjoyed every little bit of it. I have got you book marked to check out new things you postÖ

  4. I do not even know how I ended up here, but I thought this post was great.I do not know who you are but certainly you’re going to a famous blogger if you are not already 😉 Cheers!

  5. Great info! I recently came across your blog and have been reading along. I thought I would leave my first comment. I don’t know what to say except that I have enjoyed reading. Nice blog. I will keep visiting this blog very often

  6. Thank you for another fantastic article. Where else could anybody get that kind of information in such an ideal way of writing? I’ve a presentation next week, and I am on the look for such information.

  7. hello!,I like your writing so much! percentage we keep in touch extra about your article on AOL? I require an expert in this area to solve my problem. Maybe that’s you! Having a look forward to look you.

  8. Outstanding post however , I was wanting to know if you could write a litte more on this subject? I’d be very thankful if you could elaborate a little bit more. Appreciate it!

  9. Thanks on your marvelous posting! I really enjoyed reading it,you happen to be a great author. I will be sure to bookmark your blog and will often come backvery soon. I want to encourage continue your great posts, havea nice day!

  10. I read this article fully concerning the difference of newest and preceding technologies, it’s remarkable article.

  11. I’m really enjoying the design and layout of your blog.It’s a very easy on the eyes which makes itmuch more pleasant for me to come here and visit more often. Did youhire out a developer to create your theme? Great work!

  12. Awsome info and straight to the point. I am not sure if this is truly the best place to ask but do you guys have any thoughts on where to get some professional writers? Thanks 🙂

  13. Excellent read, I just passed this onto a colleague who was doing some research on that. And he just bought me lunch as I found it for him smile Therefore let me rephrase that: Thanks for lunch!

  14. I blog often and I seriously thank you for your content. This article has really peaked my interest. I am going to bookmark your blog and keep checking for new information about once a week. I opted in for your RSS feed as well.

  15. I really like what you guys tend to be up too.

    This kind of clever work and coverage! Keep up the excellent
    works guys I’ve added you guys to our blogroll.

  16. Hi Dear, are you genuinely visiting this web page on a regular basis, if so afterward you will without doubt take pleasant knowledge.

  17. I used to be recommended this blog via my cousin. I am not sure whether or not this submit is written through him as nobody else know such detailed approximately my difficulty. You’re incredible! Thanks!

  18. I just like the valuable info you supply for your articles.I’ll bookmark your blog and test again here regularly. I am reasonablysure I will be informed many new stuff proper right here!Best of luck for the following!

  19. I do agree with all of the concepts you’ve introduced in your post. They’re very convincing and can definitely work. Nonetheless, the posts are very brief for novices. Could you please lengthen them a little from next time? Thanks for the post.

  20. It’s nearly impossible to find knowledgeable people in this particular topic,
    but you sound like you know what you’re talking about!


  21. What i do not understood is in truth how you are not actually much more well-appreciated than you may be right now. You are so intelligent. You realize thus significantly when it comes to this matter, produced me in my opinion believe it from a lot of various angles. Its like men and women don’t seem to be fascinated unless it is something to do with Woman gaga! Your personal stuffs nice. All the time maintain it up!

  22. Hi, I do think this is a great blog. I stumbledupon it 😉 I am going to come back yet again since I bookmarked it. Money and freedom is the greatest way to change, may you be rich and continue to help others.

  23. Hi there! I could have sworn I’ve been to this website before but after browsing through some of the
    post I realized it’s new to me. Nonetheless, I’m definitely
    happy I found it and I’ll be book-marking and checking back frequently!

  24. Today, I went to the beach with my kids. I found a sea
    shell and gave it to my 4 year old daughter and said “You can hear the ocean if you put this to your ear.” She put the
    shell to her ear and screamed. There was a hermit crab inside and it pinched her ear.

    She never wants to go back! LoL I know this is totally off topic but I had to tell someone!

  25. Hi, I think your blog might be having browser compatibility issues.
    When I look at your blog site in Firefox, it looks fine but when opening
    in Internet Explorer, it has some overlapping.
    I just wanted to give you a quick heads up! Other then that, excellent blog!

  26. Hi! I just wanted to ask if you ever have any issues with hackers? My last blog (wordpress) was hacked and I ended up losing months of hard work due to no back up. Do you have any solutions to prevent hackers?

  27. What’s the interest rate on this account? neomycin polymyxin b sulfates dexamethasone ophthalmic suspension eye drops Many Sunderland fans vacated the premises at half-time with the team trailing to Villa

  28. Привет всем, это мой первый нанести визит этого веб-блога; этот веб-блог несет замечательно и на самом деле хорошо данные для читателей.

    Предлагаю также ознакомиться с моей страничкой о продвижении сайтов
    в интернете и привлечению посетителей


  29. Привет! Вы знаете, делают ли они какие-либо плагины для защиты от хакеров? Я немного параноик по поводу потери всего, над чем я так много работал. Любые рекомендации?

    Предлагаю также ознакомиться с моей страничкой о продвижении сайтов
    в интернете и привлечению посетителей


  30. Hello, i read your blog occasionally and i own a similar
    one and i was just wondering if you get a lot of spam remarks?
    If so how do you stop it, any plugin or anything you can suggest?
    I get so much lately it’s driving me crazy so any help is very much appreciated.

  31. Excellent weblog right here! Additionally your website quite a
    bit up fast! What web host are you using? Can I get your associate hyperlink to your host?
    I wish my website loaded up as fast as yours lol

  32. First off I want to say fantastic blog! I had a quick question that I’d like to ask if
    you do not mind. I was interested to know how you center yourself and clear your thoughts prior to writing.
    I’ve had a tough time clearing my mind in getting my thoughts out.

    I do take pleasure in writing but it just seems like the first 10
    to 15 minutes are usually lost simply just trying to figure out how to begin. Any
    recommendations or tips? Thank you!

  33. I love your blog.. very nice colors & theme. Did you
    design this website yourself or did you hire someone to
    do it for you? Plz respond as I’m looking to create my own blog and
    would like to find out where u got this from.

  34. Howdy outstanding website! Does running a blog like this
    take a massive amount work? I’ve absolutely no knowledge of computer programming
    but I had been hoping to start my own blog in the near future.
    Anyway, should you have any ideas or tips for new blog owners please share.
    I know this is off topic but I just wanted to ask. Thanks!

  35. Can I simply just say what a relief to find somebody who actually knows what they are discussing on the
    net. You actually understand how to bring an issue to light and make
    it important. More people must read this and understand this side of your story.
    I was surprised you are not more popular since you
    certainly possess the gift.

  36. Howdy! This article couldn’t be written much better!
    Going through this article reminds me of my previous roommate!
    He always kept preaching about this. I’ll send this information to him.
    Fairly certain he’s going to have a great read. Thanks for sharing!

Leave a Comment

Your email address will not be published. Required fields are marked *