Amazon AWS OpsWorks is a configuration management service that enables you to turn your Infrastructure into code; deploy AWS resources, install applications and deliver complete end to end application solutions using Chef. Designing and Orchestrating several AWS resources is often required to build out applications and solutions to meet the requirements of the business. The Amazon AWS platforms offer a host of different services such as Storage, EC2 Instances, Relational Databases, Elastic Load Balancers etc. The grouping of all these resources to deliver an end application solution is called a Stack. This article, Amazon AWS OpsWorks Exam Tips gives you an overview of the concepts you need to learn for both the AWS Certified Solutions Architect Associate Exam and the AWS Certified SysOps Administrator Associate Exam.
Stacks
A stack is the main component of OpsWorks and will contain a host of AWS resources such as EC2 instances, RDS database instances, elastic load balancers etc. AWS OpsWorks Stacks offers a way to create and manage these resources in the stack. When you use OpsWorks to build out a stack, you will need to utilise these various resources which are themselves grouped into layers.
Layers
As mentioned above, a stack is a collection of a logical group of resources which are themselves considered layers of the stack. For example, one layer could be a collection of EC2 instances that will be used to host web services and another layer could be the back-end relational databases instances. You must then use ‘Chef’ recipes to carry out tasks like install applications on instances, deploy scripts etc. Layers enable you to control what packages are installed and how the resources are configured within the layer. Thus, you can automate configuration and deployments rather than having to configure all layers manually. OpsWorks comes with many preconfigured layers
What is Chef?
Chef enables you to automate how your infrastructure is deployed by turning infrastructure configuration and deployment tasks into a series of scripts or code. You can automate how you build, deploy and manage your infrastructure and this also enables you to recreate the deployment by following ‘recipes’. Chef will store your recipes as configuration information. Chef clients are installed on your nodes and these will poll Chef servers to check for policy updates etc.
Layers and Lifecycle Events
AWS resources within layers will be configured using Chef recipes. Key to managing the stack effectively involves configuring series of events called lifecycle events that is broken down into
- Setup
- Configure
- Deploy
- Undeploy
- Shutdown
Thus, each layer will have a set of recipes for each of the above lifecycle events that will execute tasks for that event and in that layer. For example, if you have a Load Balancer Layer, the Configure Event might involve modifying the load balancers configuration to accommodate new instances added to the web servers layer. For instances that belong to multiple layers, AWS OpsWorks will run recipes for each layer in the stack, for example, if you have an instance that supports a PHP application server and a MySQL database server.
Instances
OpsWorks can be used to create instances and add them to a specific layer, for example, the Application Layer. When the instance starts, OpsWorks Stacks will configure the instance per the specified configuration setting and the settings of the instance’s layer. For example, if an instance needs to have a public IP Address assigned or amount of storage volume added. Once the instance is up and running, OpsWorks will install an agent to handle communication and run various recipes in response to lifecycle events.
Depending on your business requirements, you may need to configure how and when instances are started and stopped in your stack. OpsWorks support the following instance types:
- 24/7 Instances – these are started manually and run until you stop them
- Time-based instances – these are run by OpsWorks stacks on a specified day and weekly schedule. You can adjust the number of instances to accommodate usage patterns.
- Load-based instances – OpsWorks will start and stop instances based on metrics like CPU Utilisation or Incoming Traffic. Note Load-based instances are available for Linux-based stacks only.
Note – It is possible to incorporate Linux-based servers into a stack that was created outside of OpsWorks like an EC2 instance you manually setup or an on-premise instance on your own hardware.
Deploying Apps
Applications can be used in recipes which need to be deployed to your instances as they are launched. These applications or apps are stored in repositories such as an S3 bucket or Git repo. AWS OpsWorks will trigger the Deploy event when you need to deploy the app and this can be carried in one of two ways:
- Automatically – when an instance starts
- Manually – you can manually run online instances Deploy recipes for example to update an existing app.
Customising your Stack
You can customise your AWS OpsWorks Stacks such as modifying how AWS OpsWorks Stacks configures packages and override any attributes that represent configuration settings. You can override the templates used to create configuration files. You can extend an existing layer by providing your own recipes for performing tasks such as running scripts.
Security and Permissions
AWS OpsWorks integrates well with AWS Identify and Access Management IAM services to enable you to control users access to the AWS OpsWorks Stacks. You can control
- Which users can interact with each stack and what action they can perform or access levels you grant them on the various layers.
- Control how OpsWorks will act on your behalf to interact with AWS resources such as EC2 Instances
- Control how apps that run on OpsWorks Stacks can access resources such as S3 buckets
- Manage public SSH keys and RDP passwords
Monitoring and Logging
Amazon AWS OpsWorks also monitors the health of the stack and will provision new instances or resources using Auto Healing and Auto Scaling. Auto healing is where if an agent stops communicating with the service, AWS OpsWorks Stacks automatically stops and restarts the instance.
You can use CloudTrail logs to record API calls made by users or on behalf of OpsWorks stacks. You can also manage event logs that list events in your stack. Finally, you can review Chef logs that detail all lifecycle events and which recipes were executed with any errors if they occurred.
AWS Certification – 540 Practice Exam Questions – Get Prepared for your Exam Day!
Our AWS Exam Simulator with 540 practice exam questions comes with comprehensive explanations that will help you prepare for one of the most sought-after IT Certifications of the year. Register Today and start preparing for your AWS Certification.