Deploying a web server to AWS Elastic Beanstalk
At iCHEF, test automation matters. We execute about 600 tests everyday. Besides executing, how do we review automation achievements is quite important.
In the beginning, we built up a local web server so that we can easily review our accomplishments. As time goes on, it turns out that we should take this service more seriously. One thing we can do is migrating it to cloud.
We decided to use AWS Elastic Beanstalk.
Preparation
We built our web server using Docker container. To deploy a single docker to Elastic Beanstalk, besides Dockerfile, we need Dockerrun.aws.json. It’s for Elastic Beanstalk to determine which port to forward requests.
{
"AWSEBDockerrunVersion": "1",
"Ports": [{
"ContainerPort": 80,
"HostPort": 80
}]
}
Steps to create a web server by Elastic Beanstalk
- Go to Elastic Beanstalk management console.
- Create a new application.
- Create environment. As we plan to deploy a simple web server, select web server environment.
4. Fill in more information for your environment. In the platform section, select Docker. In the application code section, select Upload your code and upload a zip file.
The Dockerfile and Dockerrun.aws.json must be at the top level of the archive.
Archieve.zip
├── Dockerfile
├── Dockerrun.aws.json
├── app
│ ├── __init__.py
│ ├── main.py
5. (Optional) If you intend to use RDS, select Configure more options and configure network and database.
Due to Amazon policy, you may not allow to create RDS instances out side of a VPC.
6. Last, click Create environment. The service will be ready in a few minutes.
7. Now, we can access our web service through the URL which is provided by Elastic Beanstalk.
Elastic Beanstalk provides a simple way for us to maintain a web server. The web server provides services that really matter to quality team.
First, the report of test automation. As we perform hundred tests every day, how to view the result and dig out issues efficiently is important. Thus, we generate HTML report which can help us easily complete our jobs.
The other one is the progress of test automation. We all know that the quantity of automated tests is a key element for testing. To evaluate that, we built a dashboard to keep tracking automation progress.
Leveraging existing cloud service, moving local services to cloud is more easily. It also reduces the effort of maintenance, which is too often to be ignored.
Of course it does cost some money, but we enjoy the benefits of it 😆.