









Estude fácil! Tem muito documento disponível na Docsity
Ganhe pontos ajudando outros esrudantes ou compre um plano Premium
Esta página não é visível na pré-visualização
Não perca as partes importantes!










(Please consult for the latest version of this paper)
used. AWS helps eliminate both the need for costly hardware and the administrative pain that goes with owning and operating it. Owning hardware and IT infrastructure usually involves a capital expenditure for a 3−5 year period, where most development and test teams need compute or storage for hours, days, weeks, or months. This difference in timescales can cause friction due to the difficulty for IT operations to satisfy simultaneous requests from project teams, even as they are constrained by a fixed set of resources. The result is that project teams spend a lot of time justifying, sourcing, and holding onto resources. This time could be spent focusing on the main job at hand.
By provisioning only the resources needed for the duration of development phases or test runs^1 , your company can achieve important savings compared to investing upfront in traditional hardware. With the right level of granularity, you can allocate resources depending on each project’s needs and budget. In addition to those economic benefits, AWS also offers significant operational advantages, such as the ability to set up a development and test infrastructure in a matter of minutes rather than weeks or months, and to scale capacity up and down to provide the IT resources needed, only when they are needed.
This document highlights some of the best practices and recommendations around development and test on AWS. For example, in the development phase, we discuss how to securely and durably set up tools and processes such as version control, collaboration environments, and automated build processes; in the testing phase, we discuss how to set up test environments in an automated fashion, and how to run various types of test including side-by-side tests, load tests, stress tests, resilience tests, and more.
Development Phase
Regardless of team size, software type being developed, or project duration, development tools are mandatory to rationalize the process, coordinate efforts, and centralize production. Like any IT system, development tools require proper administration and maintenance. Operating such tools on AWS not only relieves your development team from low-level system maintenance tasks such as network configuration, hardware setup, etc., but also facilitates the execution of more complex tasks. The following sections describe how to operate the main components of development tools on AWS.
Source Code Repository
The source code repository is a key tool for development teams. As such, it needs to be available, and the data it contains (source files under version control) needs to be durably stored, with proper backup policies. Ensuring these two characteristics—availability and durability—requires resources, expertise, and time investment that typically aren’t a core competency of a software development team.
Building a source code repository on AWS involves creating an Amazon Elastic Compute Cloud^2 (Amazon EC2) instance and remotely installing version control software on it. Within minutes, developers can create Amazon EC instances, which are virtual machines over which they have complete control. A variety of different operating systems and distributions are available as Amazon Machine Images (AMIs). An AMI is a template that contains a software configuration (operating system, application server, and applications) that you can run on Amazon EC2. Once you’ve properly installed and configured the source code repository instance, we recommend you create an
(^1) Or complete test campaigns (^2) See: http://aws.amazon.com/ec2/
AMI from this setup in order to be able to quickly recreate that instance without having to reinstall and reconfigure the version control software.
You can store the repository’s data separately from the host system to simplify maintenance or migration operations. Amazon Elastic Block Store^3 (Amazon EBS) provides off-instance storage volumes that persist independently from the life of an instance. Once you create a volume, you can attach it to a running Amazon EC instance. As such, an Amazon EBS volume is provisioned and attached to the instance to store the data of the version control repository.
You achieve durability by taking point-in-time snapshots of the EBS volume containing the repository data. EBS snapshots are stored in Amazon Simple Storage Service^4 (Amazon S3), a highly durable and scalable data store. Objects in Amazon S3 are redundantly stored on multiple devices across multiple facilities in an Amazon S3 Region. You can then use these snapshots as the starting point for new Amazon EBS volumes, and can protect your data for long term durability. By using EBS snapshots, you can easily manage backups of the source code repository. In case of a failure, you can recreate the repository data volume from the snapshots durably stored in Amazon S3, and recreate the source repository instance from an AMI.
An Elastic IP Address provides a static endpoint to an Amazon EC2 instance, and can also be used in combination with DNS (for example, behind a DNS CNAME). This helps teams to access their hosted services such as the source code repository in a consistent way, even if infrastructure is changed underneath, for example, when scaling up or down, or when a replacement instance is commissioned.
As the source code repository grows and requires more storage capacity, two solutions are available: provision and attach additional Amazon EBS volumes to the repository instance, or provision a new larger Amazon EBS volume (up to 1 TB) based on a recent snapshot of the existing repository data. The new volume will then replace the existing volume, which you can delete. In both cases, those new Amazon EBS volumes are additional capacity that you create on-demand, in a matter of minutes.
Project Management Tools
In addition to the source code repository, teams often use additional tools such as issue tracking, project tracking, code quality analysis, collaboration, content sharing, etc. Most of the time, those tools are provided as web applications. Like any other classic web application, they require a server to run and also frequently a relational database. Both components can be installed on Amazon EC2 instances following similar deployment procedures to those used in classic environments, with the database using Amazon EBS volumes for data storage.
Project management tools have the same needs as source code repositories: they need to be available and data has to be durably stored. While you can mitigate the loss of code analysis reports by recreating them against the desired repository version, losing project or issue tracking information might have more serious consequences. You can address the availability of the project management web application service by using AMIs to create replacement Amazon EC2 instances in case of failure, just as you would for source code repositories. Achieving proper durability for a database requires more effort and more attention: even by using Amazon EBS volumes, snapshots must be taken on a frozen file system in order to be consistent. Also, restoring a database might require additional operations other than restoring a volume from a snapshot and attaching it to an Amazon EC2 instance.
(^3) See: http://aws.amazon.com/ebs/ (^4) See: http://aws.amazon.com/s3/
control, unit test suites, IDEs, etc.), and then bundle them as AMI(s). When an environment is needed, you can easily start the right environment and have it up and running in minimal time and with minimal effort. Then, when you no longer need the environment, you can shut it down to free up resources. This can also be helpful if you need to switch context in the middle of having code checked out and work in progress. Instead of managing branches or dealing with partial check-ins, you can spin up a new temporary environment.
On AWS, you have access to a variety of different instance types, some with very specific hardware configurations. If you are developing specifically for a given configuration, it may be helpful to have a development environment on the same platform where the system is going to run in production as well.
The concept of hosted desktops is not limited to development environments, but can apply to other roles or functions as well. For more complex working environments, AWS CloudFormation makes it easy to set up collections of AWS resources. This topic is discussed further in the Testing section below, in the context of setting up test environments. In many cases, such environments are set up within Amazon Virtual Private Cloud (Amazon VPC), which lets you extend your on-premise private network to the cloud. You can then provision the development environments as if they were on the local network, but instead they are running in AWS. This can be helpful if such environments require any on-premise resources (such as LDAP).
The following diagram shows a deployment where development environments are running on Amazon EC2 instances within an Amazon VPC. Those instances are remotely accessed from an enterprise network, through a secure VPN connection.
Whenever development environments are not used, for example, during the hours when you are not working, or when a specific project is on hold, you can easily shut them down to save resources and cost. There are two possibilities: stop the instances, which is roughly equivalent to hibernating the operating system; or terminate them, which is roughly equivalent to discarding the operating system.
When you stop an instance (possible for Amazon EBS−backed AMIs), the compute resources are released and no further hourly charges for the instance apply. The Amazon EBS volume stores the state, and next time you start the instance, it will have the working data as it did before you stopped it—this is equivalent to reopening the lid of a laptop. (Note: any data stored on ephemeral drives will not be available after a stop/start sequence).
When you terminate an instance, the root device and any other devices attached during the instance launch are automatically deleted (unless the DeleteOnTermination flag of a volume is set to “false”), meaning that data may be lost if there is no backup or snapshot available for the deleted volumes. A terminated instance doesn’t exist anymore and needs to be recreated from an AMI if needed. You would typically terminate the instance of a development environment if all work has been committed and/or the specific environment will not be used anymore.
Integrating with AWS APIs and IDE Enhancements
With AWS, you can now code against and control IT infrastructure, either if the target platform of your project is AWS, or if the project is about orchestrating resources in AWS. For such cases, you can use the various AWS SDKs to easily integrate their applications with AWS APIs, thereby taking the complexity out of coding directly against a web service interface and dealing with details around authentication, retries, error handling, etc. The AWS SDK Tools are available for multiple languages: Java^7 , .Net^8 , PHP^9 , Ruby^10 , and for mobile platforms^11 Android and iOS.
AWS also offers tools^12 like the AWS Toolkit for Visual Studio and the AWS Toolkit for Eclipse, making it easier for you to interact with AWS from within your IDEs.
Build Phase
The process of building an application involves many steps, including compilation, resource generation, and packaging. For large applications, each step involves multiple dependencies such as building internal libraries, using helper applications, generating resources in different formats, generating the documentation, etc. Some projects might even require building the deliverables for multiple CPU architectures, platforms, or operating systems. At the end, the complete build process can take many hours, which has a direct impact on the agility of the software development team. This impact is even stronger on teams adopting approaches like continuous integration^13 where every commit to the source repository triggers an automated build, followed by test suites.
(^7) See: http://aws.amazon.com/sdkforjava/ (^8) See: http://aws.amazon.com/sdkfornet/ (^9) See: http://aws.amazon.com/sdkforphp/ (^10) See: http://aws.amazon.com/sdkforruby/ (^11) See: http://aws.amazon.com/mobile/ (^12) See: http://aws.amazon.com/developertools/ (^13) See: http://en.wikipedia.org/wiki/Continuous_integration
Storing and Distributing Build Output
Every time you produce a build, you need to store the output somewhere. For this, Amazon S3 is an appropriate service. Initially, the amount of data to be stored for a given project is small, but it grows over time as you produce more builds. Here the pay-as-you-go and capacity characteristics of Amazon S3 are particularly attractive. When you no longer need the build output, you can delete it, or use Amazon S3’s data retention policies to do it.
To distribute the build output—for example, to be deployed in test, staging, or production, or to be downloaded to clients—AWS offers several options. You can distribute build output packages directly out of Amazon S3, either publically, or by configuring bucket policies and/or ACLs to restrict the distribution. Another option is to use Amazon CloudFront^19 , a web service for content delivery, which makes it easy to distribute packages to end users with low latency and high data transfer speeds, thereby improving the end user experience. This can be helpful, for example, when a large number of clients are downloading install packages or updates. Amazon CloudFront offers several options, for example, to authorize and/or restrict access, though a full discussion is out of scope for this document.
Testing Phase
Tests are a critical part of software development. They ensure software quality, but more importantly, they help find issues early in the development phase, lowering the cost of fixing them later during the project. Tests come in many
(^19) See: http://aws.amazon.com/cloudfront/
forms: unit tests, performance tests, user acceptance tests, integration tests, etc., and all require IT resources to run. Thus, test teams face the same challenges as development teams: the need to have enough IT resources, but only during the limited duration of the test runs. Besides, test environments change frequently and are different from project to project, and as a result may well require different IT infrastructure or have varying capacity needs.
AWS’s on-demand and pay-as-you-go value propositions are well adapted to those constraints. AWS enables your test teams to eliminate both the need for costly hardware and the administrative pain that goes along with owning and operating it. AWS also offers significant operational advantages for testers: test environments can be set up in minutes rather than weeks or months, and a variety of resources, including different instance types, are available to run tests whenever they need to be run.
Automating Test Environments
There are many software tools and frameworks available for automating the process of running tests, but in order to run those tests, proper infrastructure has to be in place. This involves provisioning infrastructure resources and initializing them with a sample dataset, deploying the software to be tested, orchestrating the test runs, and collecting results. The challenge here is not only to have enough resources to deploy the complete application with all the different servers or services it might require, but also to be able to initialize the test environment with the right software and the right data over and over. Test environments should be identical between test runs; otherwise it is more difficult to compare results.
Another important benefit of running tests on AWS is the ability to automate them in various ways. You can operate AWS programmatically using the AWS APIs or the command line interface (CLI) tools. Tasks that require human intervention in classic environments (allocating a new server, allocating and attaching storage, allocating a database, etc.) can be fully automated on AWS. For testers, designing tests suites on AWS means being able to automate a test down to the operation of the components, which are traditionally static hardware devices. Automation makes test teams more efficient by removing the effort of creating and initializing test environments, and less error prone by limiting human intervention during the creation of those environments. An automated test environment can be linked to the build process, following continuous integration principles^20. Every time a successful build is produced, a test environment can be provisioned and automated tests executed on it.
The following sections describe how to automatically provision Amazon EC2 instances, databases, and complete environments.
You can easily provision Amazon EC2 instances from AMIs^21. An AMI encapsulates the operating system and any other software or configuration files, pre-installed on the instance. When you launch the instance, all of the applications are already loaded from the AMI and ready to run. For information about creating AMIs, refer to the Amazon EC2 documentation^22. The challenge with AMI-based deployments is that each time you need to upgrade software, you have to create a new AMI. Although the process of creating a new AMI (and deleting an old one) can be completely automated, this quickly imposes having to define a strategy for managing and maintaining multiple versions of AMIs.
(^20) See: http://en.wikipedia.org/wiki/Continuous_integration (^21) See: http://docs.amazonwebservices.com/AWSEC2/latest/UserGuide/launching-an-instance.html (^22) See: http://docs.amazonwebservices.com/AWSEC2/latest/UserGuide/creating-an-ami.html
performed in order to measure the behavior under heavy load conditions. The objective is to gradually increase the load of a system in order to determine the point where the performance degrades in such a way that the system cannot operate anymore.
Load tests simulate heavy inputs that exercise and stress a system. Depending on the project, inputs can be a large amount of concurrent incoming requests, a huge dataset to process, etc. One of the main difficulties in load testing is being able to generate large enough amounts of inputs to push the tested system to its limits. Typically, it implies having large amounts of IT resources to deploy the system to test, and to generate the test input, which requires further infrastructure. Since load tests generally don’t run for more than a couple of hours, the AWS pay-as-you-go model nicely fits this use case.
You can also automate load tests using the techniques described in the previous section, enabling your testers to exercise them more frequently, in order to make sure that each major change to the project doesn’t adversely affect system performance and efficiency. Conversely, by launching automated load tests, it’s easy to check if a new algorithm, caching layer, or architecture design is more efficient and benefits the project.
Note: For quick and easy setup, testing tools and solutions are also available from the AWS Marketplace: https://aws.amazon.com/marketplace/b/2649283011/
Testing an application or service for network load involves sending large numbers of requests to the system being tested. There are many software solutions available to simulate request scenarios, but using multiple Amazon EC instances may well be necessary to generate enough traffic. Amazon EC2 instances are available on-demand and are charged by the hour, which makes them well suited for network load-testing scenarios. It’s important to keep in mind the characteristics of different instance types: as a general rule, larger instance types provide more I/O network capacity, the primary resource consumed during network load tests.
With AWS, test teams can also perform network load testing on applications that run outside of AWS. Having load test agents dispersed in different regions of AWS enables testing from different geographies, for example, to get a better understanding of the end user experience. In that scenario, it makes sense to collect log information from the instances that simulate the load. Those logs contain important information such as response times from the tested system. By running the load agents from different regions, the response time of the tested application can be measured for different geographies. This can help you understand the worldwide user experience. Since you can terminate load-testing Amazon EC2 instances right after the test, you should transfer log data to Amazon S3 for storage and later analysis.
Load testing an application running on AWS is useful to make sure that elasticity features are correctly implemented. Testing a system for network load is important to make sure that for web front-ends, Auto Scaling and Elastic Load Balancing^27 configurations are correct. Auto Scaling offers many parameters^28 and can use multiple conditions defined with Amazon CloudWatch to scale the number of front-end instances up or down. These parameters and conditions influence how fast an Auto Scaling group will add or remove instances. An Amazon EC2 instance’s post-
(^27) Read the technical article “Best Practices in Evaluating Elastic Load Balancing” available at
http://aws.amazon.com/articles/ (^28) Refer to the Auto Scaling documentation:
http://docs.amazonwebservices.com/AutoScaling/latest/DeveloperGuide/Welcome.html
provisioning time might also affect an application’s ability to scale up quickly enough. After the initialization of the operating system running on Amazon EC2 instances, additional services are initialized—such as web servers, application servers, memory caches, middleware services, etc.. The initialization time of these different services affects the scale-up delay, especially when additional software packages need to be pulled down from a repository. Load testing will provide valuable metrics on how fast additional capacity can be added into a particular system.
Auto Scaling is not only used for front-end systems. You might also use it for scaling internal groups of instances like consumers polling an Amazon SQS queue^29 or workers and deciders participating in an Amazon Simple Workflow Service (Amazon SWF) workflow^30. In both cases, load testing the system can help you ensure you’ve correctly implemented and configured Auto Scaling groups or other automated scaling techniques, in order to make your final application as cost-effective and scalable as possible.
Load testing can require many instances, especially when exercising systems that are designed to support a high amount of load. While you can provision Amazon EC2 instances on-demand and discard them when the test is completed while only paying by the hour, there is an even more cost-effective way to perform those tests using Amazon EC2 Spot Instances. Spot Instances^31 enable customers to bid for unused Amazon EC2 capacity. Instances are charged the Spot Price set by Amazon EC2, which fluctuates depending on the supply of and demand for Spot Instance capacity. To use Spot Instances, you place a Spot Instance request, specifying the instance type, the desired Availability Zone^32 , the number of Spot Instances to run, and the maximum price to pay per instance hour. The Spot Price history for the past 90 days is available via the Amazon EC2 API and the AWS Management Console^33. If the maximum price bid exceeds the current Spot Price, the request is fulfilled and instances will be started and run until either they are terminated or the Spot Price increases above the maximum price (whichever is sooner).
For more information about Spot Instances, visit: http://aws.amazon.com/ec2/spot-instances/. A case study on using Spot Instances for load-testing is available here: http://aws.amazon.com/solutions/case-studies/browsermob/.
User Acceptance Testing
The objective of user acceptance testing is to present the current release to a testing team representing the final user base to determine if the project requirements and specification are met. When users can test the software earlier, they can spot conceptual weaknesses that have been introduced during the analysis phase, or clarify grey areas in the project requirements. By testing the software more frequently, users can identify functional implementation errors and user interface or application flow misconceptions earlier, lowering the cost and impact of correcting them. Flaws detected by user acceptance testing may be very difficult to detect by other means. The more often you conduct acceptance tests, the better for the project, since end users provide valuable feedback to development teams as requirements evolve.
However, like any other test practice, acceptance tests require resources to run the environment where the application to be tested will be deployed. As described in previous sections, AWS provides on-demand capacity as
(^29) See the blog article: http://aws.typepad.com/aws/2011/07/additional-cloudwatch-metrics-for-amazon-sqs-and-amazon-
sns.html (^30) See the blog article: http://aws.typepad.com/aws/amazon-simple-workflow-service/ (^31) See: http://aws.amazon.com/ec2/spot-instances/ (^32) An Availability Zone is a distinct location within a Region that is engineered to be insulated from failures in other Availability
Zones and provides inexpensive, low-latency network connectivity to other Availability Zones in the same Region. (^33) Current spot price is available here: http://aws.amazon.com/ec2/spot-instances/#
build fault-tolerant architectures running on AWS, read the whitepaper “Building Fault -Tolerant Applications on AWS”^35 and the resources available in the AWS Architecture Center^36.
Many AWS customers run mission-critical applications on AWS, and they need to make sure their architecture is fault tolerant. As a result, an important practice for all systems is to test their fault-tolerance capability. While a test scenario exercises the system (using similar techniques to load testing), some components are taken down on purpose to check if the system is able to recover from such simulated failure. You can use the AWS Management Console or the command line interface to interact with the test environment. For example, you might terminate Amazon EC2 instances, and thereby test if an Auto Scaling group is working as expected and a replacement instance automatically provisioned. You can also automate this kind of test. It is a best practice is to use automated tools that, for example, occasionally and randomly terminate Amazon EC2 instances.
Resource Management
With AWS, your development and test teams can have their own resources, scaled according to their own needs. Provisioning complex environments or platforms composed of multiple instances can be done easily using AWS CloudFormation stacks or some of the other automation techniques described. In large organizations comprising multiple teams, it is a good practice to create an internal role or service responsible for centralizing and managing IT resources running on AWS. This role typically consists of:
Promoting internal development and test practices described here
Developing and maintaining template AMIs and template AWS CloudFormation stacks with the different tools and platforms used in your organization
Collecting resource requests from project teams, and provisioning resources on AWS according to your organization’s policies, including network configuration (e.g., Amazon VPC), security configurations (e.g., Security Groups and IAM credentials)
Monitoring resource usage and charges using Amazon CloudWatch, and allocating these to team budgets
While you can use the AWS Management Console to achieve the tasks above, you might want to develop your own internal provisioning and management portal for a tighter integration with internal processes. You can do this by using one of the AWS SDKs, which allow programmatic access to resources running on AWS.
Cost Allocation and Multiple AWS Accounts
Some customers have found it helpful to create specific accounts for development and test activities. This can be important when your production environment also runs on AWS and you need to separate teams and responsibilities. Separate accounts are isolated from each other by default, so that, for example, development and test users do not interfere with production resources. To enable collaboration, AWS offers a number of features that enable sharing of resources across accounts, for example, Amazon S3 objects, AMIs, and Amazon EBS Snapshots.
To separate out and allocate the cost for the various activities and phases of the development and test cycle, AWS offers various options. One option is to use separate accounts (for example, for development, testing, staging, and production), and each account will have its own bill. You can also consolidate multiple accounts, for example, to
(^35) Available at: http://d36cz9buwru1tt.cloudfront.net/AWS_Building_Fault_Tolerant_Applications.pdf (^36) Visit: http://aws.amazon.com/architecture/
simplify payments. Another option is to make use of the Cost Allocation Report, which enables you to organize and track your AWS costs by using resource tagging. In the context of development and test, tags can represent the various stages or teams of the development cycle, though you are free to choose the dimensions you find most helpful.
Conclusion
Development and test practices require certain resources at certain times for the development cycle. In traditional environments, those resources might not be available at all, or not in the necessary timeframe. When those resources are available, they provide a fixed amount of capacity that is either insufficient especially in variable activities like testing, or wasted (but paid for) when the resources are not used^37.
Amazon Web Services offers a cost-effective alternative to traditional development and test infrastructures. Instead of waiting weeks or even months for hardware, you can instantly provision resources needed, instantly scale up as the workload grows, and release resources when they are no longer needed. Whether development and test environments consist of a couple of instances or hundreds, whether they are needed for a few hours or 24/7, you still pay only for what you use. AWS is a programming-language and operating system−agnostic platform, and you can choose the development platform or programming model used in your business. This flexibility allows you to focus on your project, not on operating and maintaining your infrastructure.
AWS also enables possibilities that were difficult to realize with traditional hardware. You can fully automate resources on AWS so that environments can be provisioned and decommissioned without human intervention. You can start development environments on-demand; kick off builds when needed, unconstrained by the availability of resources; provision test resources; and automatically orchestrate entire test runs or campaigns.
AWS offers you the ability to experiment and iterate with a rapidly changeable infrastructure. Your project teams are free to use inexpensive capacity to perform any kind of tests or to experiment with new ideas, with no up-front expenses or long-term commitments, making AWS a platform of choice for development and test.
Further Reading
Whitepaper: “Operational Checklists for AWS” http://media.amazonwebservices.com/AWS_Operational_Checklists.pdf
Whitepaper: “How AWS Pricing Works” http://media.amazonwebservices.com/AWS_Pricing_Overview.pdf
AWS Architecture Center – http://aws.amazon.com/architecture
AWS Technical Whitepapers – http://aws.amazon.com/whitepapers/
(^37) See: http://aws.amazon.com/economics/