How does AWS Deployment work?
Tags: cloud, tutorial, aws, codenewbie
Published: 2022-06-12 22:23:45

## What is AWS? 
Are you considering deploying your application with Amazon Web Services(commonly known as AWS)? Not entirely sure what deployment service to use for your code? Maybe you're just curious about how AWS works, or if their services would be something you want to use. Well there's a reason more than 45 percent of the world is using AWS today. It is widely used by many small businesses, large-scale companies and government agencies. AWS has a variety of services from data centers to compute services to cloud platforms, just to name a few. Actually, AWS has over 200 services. Some of the few AWS services that we'll be exploring to deploy your next application:  

- [Amazon Elastic Compute Cloud(EC2)](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/concepts.html)
- [Amazon Elastic Load Balancing(ELB)](https://docs.aws.amazon.com/elasticloadbalancing/latest/userguide/what-is-load-balancing.html)
- [AWS Auto Scaling](https://aws.amazon.com/autoscaling/)
- [AMI(Amazon Machine Image)](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/AMIs.html)
- [AWS CodeDeploy](https://docs.aws.amazon.com/codedeploy/latest/userguide/welcome.html)

---

## Deployment before AWS
Let's take it back once more to see how developers would deploy their code. Before AWS dominated the cloud computing industry, developers would manually log into the server and run deployment scripts. The problem with this was that it was extremely risky. Businesses would have to plan for and acquire servers and IT infrastructure weeks or months ahead of time. 

**Amazon EC2**

Amazon EC2 makes it easy for you to obtain virtual servers(also known as compute instances in the cloud) quickly. AWS gives you the freedom to launch as many or as few virtual servers as you need, configure security and networking, and manage storage.


**Mutable Infrastructure**

Manually connecting to a single Amazon EC2 instance to deploy new code has certain drawbacks. There's a possibility something may go wrong with your code or scripts, causing all users to be affected. If you test your code on a development server, there's always the possibility that it won't work on the production server.
This is referred to as mutable infrastructure. 

Assume someone logged in, made a change, and then failed to update the development server. Your deployment in one mutable server may respond differently in another mutable server.

---

![Mutable Infrastructure vs Immutable Infrastructure](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/faude2pkqo4bo6c2cyqn.gif)

---

**Immutable Infrastructure**

With immutable infrastructure, there are no changes taking place on the production server. Which allows us to implement control changes so that our running code updates in a predictable manner. The running code only updates when it is completely replaced with a new instance that contains all the necessary changes. 

Consider the example above. 

With two instances, one instance can be for deployment and while the other one keeps serving the traffic. What happens when an instance fails or has an increase in traffic? AWS has a service to solve that problem also.

**AWS Auto Scaling**

![Auto Scaling](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/k3c6dlf6xcrtd3igllvn.png)

[Auto scaling](https://docs.aws.amazon.com/autoscaling/ec2/userguide/what-is-amazon-ec2-auto-scaling.html) is an effective method of ensuring the availability and predictable performance of many instances that serve traffic. As the demand on your instances varies, Amazon EC2 Auto Scaling allows you to dynamically raise or reduce the number of instances. When an instance fails or there is a spike in traffic, auto scaling automatically creates new instances immediately by utilizing an [AMI (Amazon Machine Image)](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/AMIs.html). The operating system and all software packages required to run the application are included in AMIs.

**Amazon Elastic Load Balancing(Amazon ELB)**     

Your incoming application traffic is dynamically distributed across all of your running EC2 instances using Elastic Load Balancing. Elastic Load Balancing distributes incoming requests across several servers, ensuring that no one server is congested.

Attach the load balancer to your Auto Scaling group if you want to use Elastic Load Balancing with it. This connects your Auto Scaling group to the load balancer, which serves as a central point of contact for any and all incoming web traffic.

Individual EC2 instances do not need to be registered with the load balancer while using Elastic Load Balancing with your Auto Scaling group. The load balancer automatically registers instances that are launched by your Auto Scaling group. Similarly, instances removed from your Auto Scaling group get deregistered from the load balancer automatically.


## The Ease of Deploying with AWS CodeDeploy
[AWS CodeDeploy](https://docs.aws.amazon.com/codedeploy/latest/userguide/welcome.html) makes it simple to automate code deployments while still maintaining application uptime. Its automated deployment capabilities make it an excellent solution for updating application and promptly release new features without the risk of errors. 

---

**Conclusion**

Every coder, programmer, developer(call it what you will) will deploy their application to a server at some point throughout their career. It doesn't matter if it's a large server or a small server. It might be one or a hundred servers. Whatever your requirements are, you'll most likely want to have servers as quickly and efficiently as possible.

Understanding a bit about AWS can help you advance in your profession and find your next job. You can pursue a variety of certifications and positions that Amazon offers. It's perfectly fine if you're not interested in working for Amazon. AWS skills, on the other hand, are in high demand for almost any developer position. So, are you planning to use any of Amazon's online services?

- [https://aws.amazon.com/about-aws/](https://aws.amazon.com/about-aws/)

- [https://docs.aws.amazon.com/codedeploy/latest/userguide/welcome.html](https://docs.aws.amazon.com/codedeploy/latest/userguide/welcome.html)

- [https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/concepts.html](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/concepts.html)

- [https://docs.aws.amazon.com/autoscaling/ec2/userguide/what-is-amazon-ec2-auto-scaling.html](https://docs.aws.amazon.com/autoscaling/ec2/userguide/what-is-amazon-ec2-auto-scaling.html)

- [https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/AMIs.html](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/AMIs.html)

- [https://docs.aws.amazon.com/elasticloadbalancing/latest/userguide/what-is-load-balancing.html](https://docs.aws.amazon.com/elasticloadbalancing/latest/userguide/what-is-load-balancing.html)