CDP:Cloud DI Pattern
External Placement of Parts That Are Frequently Updated
Contents |
Problem to Be Solved
In large-scale systems, large numbers of servers are added when there is growth in, for example, the number of accesses. Manually performing all of the installation and setup operations required for configuring the individual servers would be extremely time-consuming in such a case, and often would be difficult to achieve in a limited time. While you may use a technique where system management tools are used to automate the server configuration, this approach has issues in terms of cost.
Explanation of the Cloud Solution/Pattern
The internal structure of a server may be configured automatically, depending on the purpose for the server, when launching a virtual server. In particular, you may use the Scale Out Pattern and Scheduled Autoscaling Pattern if you want to automate these operations. In these cases, you may use the Bootstrap Pattern, but if there is lots of information you want to locate externally (for example, an IP address of a database connection destination, a server name, a security number, or the like), you can initialize the server more flexibly through the use of the Cloud DI Pattern.
Implementation
There is a function that lets you add arbitrary tags to an EC2 instance when starting up the EC2 instance. You can use this function to readout tag information when starting up an EC2, to perform the setup accordingly.
- Set tags as information that is unique to the EC2 instance. (For example, set up an Elastic IP (EIP) as a tag.) * Set up so as to launch an application for acquiring the tags when an EC2 instance is launched.
- In the application, initialize the EC2 using the tag information (where the EIP that has been set will be assigned automatically to the EC2 instance).
Configuration
Benefits
This provides unique settings to the general-use base image that uses the Stamp Pattern or the Bootstrap Pattern.
- Because the parameters are set using the tag information, you can set and confirmed them easily using the Amazon Management Console.
- You can perform the setup automatically to reduce errors during operation.
- You can use this not only when configuring an EC2 instance, but also when creating a system for producing Amazon Machine Images (AMIs) and snapshots automatically.
Cautions
- Sometimes there is a limit to the number of characters that can be contained in a tag. In such a case, set the tag to information pointing to the information you wish to transfer, such as an S3 URL or a network file path.
Other
- In addition to tags, you can also use metadata, known as "user data," to pass information.