Automatically setup a AWS Environment - amazon-web-services

I wanted to know if there is a way to setup a cloud environment using Amazon Web Services automatically (like by just invoking a batch file...).
I have a scenario where i want to setup the Environment with all the requisite things like OS, Platforms etc. I want to automate the entire process of setting up the environment. Is this possible?
I am trying to do Continuous Integration and as a part of CI i want to first set up the environment for the application to be deployed, deploy the application and then run automated and performance tests. i am using Jenkins to run my automated and performance test cases with Selenium and Jmeter. Kindly help me.

You can use different tools based on your requirement.
If you also want to configure VPC and other network level configuration, you can use cloud formation, basically you'll create a template and launch your infrastructure using this template file.
https://aws.amazon.com/cloudformation/cloufformation
if you need to launch an project with a database, application server (tomcat, java, python, ...) and with load balancing and autoscaling configuration, you can use elasticbeanstalk
http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/Welcome.html
opswork, docker could be also an option depending on your requirements. But they need pre configuration.
Would be more easy to advise a solution if you extend question with your use case.

Related

Which is the best way on AWS to set up a CI/CD of a Django app from GitHub?

I have a Django Web Application which is not too large and uses the default database that comes with Django. It doesn't have a large volume of requests either. Just may not be more than 100 requests per second.
I wanted to figure out a method of continuous deployment on AWS from my source code residing in GitHub. I don't want to use EBCLI to deploy to Elastic Beanstalk coz it needs commands in the command line and is not automated deployment. I had tried setting up workflows for my app in GitHub Actions and had set up a web server environment in EB too. But it ddn't seem to work. Also, I couldn't figure out the final url to see my app from that EB environment. I am working on a Windows machine.
Please suggest the least expensive way of doing this or share any videos/ articles you may hae which will get me to my app being finally visible on the browser after deployment.
You will use AWS CodePipeline, a service that builds, tests, and deploys your code every time there is a code change, based on the release process models you define. Use CodePipeline to orchestrate each step in your release process. As part of your setup, you will plug other AWS services into CodePipeline to complete your software delivery pipeline.
https://docs.aws.amazon.com/whitepapers/latest/cicd_for_5g_networks_on_aws/cicd-on-aws.html

How can I create realistic traffic on an AWS network via CLI

I'm working as an intern on a project where I have to create a CTF mission (like hackthebox and other CTF-related websites). Making use of Terraform, I automatically deploy instances which are fully configured in VPC's/Subnets/AZ's etc..
Ultimately I'm struggling to create realistic, yet fake, traffic in this dynamically deployed environment to which I only have access to the "local-exec" and "data-template", rendering GUI tools useless seeing as I need it to be done via CLI.
Does anyone have any suggestions as to tools I could use to simplify this task?

How to choose between AWS Elastic Beanstalk and App Runner services?

Similarities that I see are:
They are PaaS offerings.
They make AWS more similar to Heroku.
They abstract away load balancing and auto scaling stuff.
The only difference that I see is that App Runner uses docker but Elastic beanstalk may not use it. Correct me if I am wrong, but seems like it is not a requirement to containerize your app first to be able to use it on App Runner as you can just supply the Github Url and App Runner will containerize it for you.
So what is the difference between the two and how do I make a decision to choose one over the other?
It depends. AWS App Runner (AR) is container based only. Not every application nor developer want to use containers, nor their application is suited for container deployments. AR also gives you very little control over your resources and operating system. Many application may require such control (e.g. gpu) Also AWS EB gives you much more control over your resources, including operating system.
As Cloud Guru said that
Behind the scenes, the core of App Builder is that it builds an Amazon
ECS Cluster and uses Fargate to execute your containers
So as you can see
Elastic Beanstalk belonging to PaaS
App Runner is serverless belonging to FaaS
Furthermore, App runner just works with Container only. So it really depends on what kind of your app is.

Spring boot/cloud microservices on AWS

I have created a Spring cloud microservices based application with netflix APIs (Eureka, config, zuul etc). can some one explain me how to deploy that on AWS? I am very new to AWS. I have to deploy development instance of my application.
Do I need to integrate docker before that or I can go ahead without docker as well.
As long as your application is self-contained and you have externalised your configurations, you should not have any issue.
Go through this link which discusses what it takes to deploy an App to Cloud Beyond 15 factor
Use AWS BeanStalk to deploy and Manage your application. Dockerizing your app is not a predicament inorder to deploy your app to AWS.
If you use an EC2 instance then it's configuration is no different to what you do on your local machine/server. It's just a virtual machine. No need to dockerize or anything like that. And if you're new to AWS, I'd rather suggest to to just that. Once you get your head around, you can explore other options.
For example, AWS Beanstalk seems like a popular option. It provides a very secure and reliable configuration out of the box with no effort on your part. And yes, it does use docker under the hood, but you won't need to deal with it directly unless you choose to. Well, at least in most common cases. It supports few different ways of deployment which amazon calls "Application Environments". See here for details. Just choose the one you like and follow instructions. I'd like to warn you though that whilst Beanstalk is usually easier then EC2 to setup and use when dealing with a typical web application, your mileage might vary depending on your application's actual needs.
Amazon Elastic container Service / Elastic Kubernetes Service is also a good option to look into.
These services depend on the Docker Images of your application. Auto Scaling, Availability cross region replication will be taken care by the Cloud provider.
Hope this helps.

efficient way to administer or manage an auto-scaling instances in aws

As a sysadmin, i'm looking for an efficient way or best practices that you do on managing an ec2 instances with autoscaling.
How you manage automate this following scenario: (our environment is running with autoscaling, Elastic Load Balancing and cloudwatch)
patching the latest version of the rpm packages of the server for security reasons? like (yup update/upgrade)
making a configuration change of the Apache server like a change of the httpd.conf and apply it to all instances in the auto-scaling group?
how do you deploy the latest codes to your app to the server with less disruption in production?
how do you use puppet or chef to automate your admin task?
I would really appreciate if you have anything to share on how you automate your administration task with aws
Check out Amazon OpsWorks, the new Chef based DevOps tool for Amazon Web Services.
It gives you the ability to run custom Chef recipes on your instances in the different layers (Load Balancer, App servers, DB...), as well as to manage the deployment of your app from various source repositories (Git, Subversion..).
It supports auto-scaling based on load (like the auto-scaling that you are already using), as well as auto-scaling based on time, which is more complex to achieve with standard EC2 auto-scaling.
This is relatively a young service and not all functionality is available already, but it might be useful for your.
patching the latest version of the rpm packages of the server for
security reasons? like (yup update/upgrade)
You can use puppet or chef to create a cron job that takes care of this for you (the cron would in its most basic form download and or install updates via a bash script). You may want to automatically upgrade, or simply notify an admin via email so you can evaluate before apply updates.
making a configuration change of the Apache server like a change of
the httpd.conf and apply it to all instances in the auto-scaling
group?
I usually handle all of my configuration files through my Puppet manifest. You could setup each EC2 instance to pull updates from a Puppet Server, then you can roll out changes on demand. Part of this process should be updating the AMI stored in your AutoScale group (this is done with the Amazon Command Line tools).
how do you deploy the latest codes to your app to the server with less
disruption in production?
Test it in staging first! Also a neat trick is to versioned deployments, so each time you do a deployment it gets its own folder (/var/www/v1 /var/www/v2 etc) and once you have verified the deployment was successful you simply update a symlink to point to the lastest version (/var/www/current points to /var/www/v2).
OpsWorks handles all this sort of stuff for you so you can look into that if you don't want to do it all yourself.
how do you use puppet or chef to automate your admin task?
You can use Chef or Puppet to do all sorts of things, and anything they can't (or you don't know how to) do can be done via a bash/python script that you invoke from Chef or Puppet.
I normally do things like install packages, build custom packages, set permissions, download things, start services, manage configuration files, setup cron jobs etc
I would really appreciate if you have anything to share on how you automate your administration task with aws
Look into CloudFormation. This can help you setup all your servers and related services (think EC2, LBS, CloudWatch) through configuration files, thus helping you to automate your entire stack (not just the EC2's Operating System).