Deployment to AWS

1

Hello beautiful people, I'm trying to build this food blog where I can post food-related content, allow users to register and log in to interact with posts/articles, and a bunch of other stuff. As a backend developer, I want to use nodejs and mongodb for the backend and database, I am also going to use s3 bucket to handle heavy data like articles, videos, and pictures. My question now is, what's the best way to go about hosting such a web app on aws? Do you a better tool choice than the ones I've decided to use for such an app? Your opinion no matter how small will be highly appreciated.

Sam
asked 9 months ago182 views
2 Answers
2

I recommend using Amazon EC2, this will provide you with a virtual machine, there is a lot of documentation about it on the internet to be able to deploy your application, now I can write you some important architecture recommendations.

  • Use an IAM Role together with your EC2 instance to be able to access Amazon S3 APIS
  • You can Use DocumentDB that is compatible with MongoDB, before reviewing its cost and your budget.
  • Make sure you configure the security groups correctly.

I hope I have been helpful

profile picture
EXPERT
answered 9 months ago
  • Thank you so much Max, I'd keep all you said in mind

1
Accepted Answer

Hi Sam, there are many considerations to be made here. For example, do you want to containerize your application? Do you want to manage those containers? Do you want to manage the servers/instances/resources that you deploy or do you want AWS to manage them? Same considerations for the MongoDB layer. You can make this as complicated or as simple as you want, and have as little or as much control over the resources as you desire :)

For example, if you wanted to do this AWS opinionated way and remain serverless (meaning you let AWS do the heavy lifting of maintaining the servers), with that specific technology stack, you could do something like the following:

  1. Host your NodeJS code on using AWS Lambda ( serverless compute service that runs your code in response to events and automatically manages the compute resources for you ).
  2. Use AWS DocumentDB (A fully managed MongoDB-compatible database service that provides fast, scalable, and highly available document databases) for your MongoDB deployment.
  3. Use Amazon Cognito (service that provides user sign-up, sign-in, and access control to web and mobile apps without requiring any backend infrastructure) for user sign up/registration.
  4. Store objects on Amazon S3, it's perfect for storing and serving static assets like images, videos, and even your frontend website content.
  5. Consider using Amazon CloudFront in front of S3 to distribute content globally and reduce latency.
  6. Front your Lambda functions with Amazon API Gateway. It's a managed service that allows you to create, publish, and secure APIs. It integrates seamlessly with Lambda and can be used to expose your backend functionality.

For example, if you want to manually control your compute resources with this specific technology stack, and don't want AWS to do the heavy lifting:

  1. Host your NodeJS code on EC2 instances (web service that provides resizable compute capacity in the cloud, allowing you to run virtual servers and scale compute capacity based on your requirements).
  2. Host your MongoDB on EC2 instances.
  3. Implement custom authentication on your EC2 instances.
  4. Using Amazon EBS (Elastic Block Store, a high-performance block storage service designed for use with Amazon EC2 for both throughput and transaction-intensive workloads) for your storage of your instances.
  5. Use Amazon Elastic Load Balancing(service that automatically distributes incoming application traffic across multiple targets, such as EC2 instances, containers, and IP addresses, in one or more Availability Zones) to distribute traffic to your instances.

If you were open to changing your technology stack, you could also look into AWS Amplify. AWS Amplify is a complete solution that lets frontend web and mobile developers easily build, ship, and host full-stack applications on AWS, with the flexibility to leverage the breadth of AWS services as use cases evolve. No cloud expertise needed.

Finally, check out AWS Elastic Beanstalk - Elastic Beanstalk is a service for deploying and scaling web applications and services. Upload your code and Elastic Beanstalk automatically handles the deployment—from capacity provisioning, load balancing, and auto scaling to application health monitoring.

I can't recommend a specific service or way to go about doing this as there are pros and cons to everything really, but if you have any questions or concerns please let me know! I'd also be happy to share workshops and other resources if they would help. Apologies for this overkill answer but it's because there's no right or wrong way to do anything, and this is just one answer - just wanted to give you some food for thought.

If this answer helped, please accept the answer,

Dylan

  1. AWS Overview - https://aws.amazon.com/what-is-aws/
  2. AWS Lambda Developer Guide - https://docs.aws.amazon.com/lambda/latest/dg/welcome.html
  3. Amazon DocumentDB Documentation - https://docs.aws.amazon.com/documentdb/latest/developerguide/what-is.html
  4. Amazon Cognito User Guide - https://docs.aws.amazon.com/cognito/latest/developerguide/what-is-amazon-cognito.html
  5. Amazon S3 User Guide - https://docs.aws.amazon.com/AmazonS3/latest/userguide/Welcome.html
  6. Amazon CloudFront Developer Guide - https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/Introduction.html
  7. Amazon API Gateway Developer Guide - https://docs.aws.amazon.com/apigateway/latest/developerguide/welcome.html
  8. Amazon EC2 User Guide - https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/concepts.html
  9. MongoDB on AWS - https://aws.amazon.com/nosql/mongodb/
  10. Implementing Authentication in Node.js - https://nodejs.org/en/docs/guides/authentication/
  11. Amazon EBS User Guide - https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/AmazonEBS.html
  12. Elastic Load Balancing Guide - https://docs.aws.amazon.com/elasticloadbalancing/latest/userguide/what-is-load-balancing.html
  13. AWS Amplify Documentation - https://docs.aws.amazon.com/amplify/latest/userguide/welcome.html
  14. AWS Elastic Beanstalk Documentation - https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/Welcome.html
profile pictureAWS
answered 9 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions