Ravindra BagaleCourses & study guides मराठी Track your progress

Chapter 16: Amazon RDS

AWS Cloud

16.3 Create a MySQL database

Open the RDS console, then Databases, then Create database. Button names below may vary. Choose Standard create to inspect the detailed settings supported by your selected engine and deployment. Review the learning account, current estimate and lifecycle plan before creating chargeable resources.

Setting Decision for the learning plan
Engine MySQL
Templates Dev/Test can be a starting point; verify all resulting settings and account-specific charges or benefits
DB instance identifier college-library-mysql-test (the managed resource identifier, not the logical database name)
Master username admin
Master password A reviewed secure password-management procedure or supported RDS-managed Secrets Manager integration; never record credentials in the worksheet
Instance class A currently supported class matching the exercise and reviewed estimate
Storage type A supported storage family and size chosen from current limits and workload needs
Storage autoscaling An explicit reviewed choice, including the maximum if enabled
Connectivity Use the intended VPC. This manual walkthrough configures connectivity explicitly; the supported automatic EC2 connection workflow can create or modify network resources and needs its own review
DB subnet group An inspected group in the intended VPC, with suitable AZ coverage and spare addresses
Public access No
VPC security group Create rds-lab-sg (you will edit it in a moment)
Database authentication Password
Initial database name librarylending (application tables require later schema setup)
Backup retention An explicit nonzero retention matching the recovery exercise; zero disables automated backups
Deletion protection A deliberate protection choice plus a reviewed retirement and retained-backup plan
Encryption Explicitly review encryption at rest and the selected KMS key ownership and lifecycle

After reviewing the final configuration and estimate, choose Create database once and inspect status and events. Available does not prove client connectivity, SQL privileges or application-table existence.

Creating can take time. Inspect the intended resource and its events rather than submit duplicates. After Available, verify the configuration and then the client, database and application objects.

Estimate and account benefits

Verify current account eligibility and the full selected configuration. A template or small class does not guarantee free usage. Record operating time, storage, backups and related-service assumptions. Choose the availability design for the exercise; an ordinary Single-AZ instance does not include a standby. Follow the stop-and-delete lesson and inspect retained resources when finishing.

Master username

On RDS for MySQL, admin is accepted. Do not use rdsadmin. RDS reserves that account for itself. The master database account has service-defined privileges; it is not host SSH access or an unrestricted self-managed root environment. Other engines have their own username restrictions, so check those rules rather than assume a universal substitute.

Security group: port 3306 only from EC2

For this private-access scenario, Publicly accessible is No. Inspect the actual network mode and address configuration as well as all effective access rules. That setting alone does not prove the client path or SQL permission. Edit rds-lab-sg:

  1. EC2 console, Security groups, rds-lab-sg, Edit inbound rules.
  2. For a listener actually configured on TCP 3306, select the matching rule and the exact security group of the intended EC2 application as source in this supported same-VPC example. Review other attached groups and the rest of the path; do not open world-wide sources to bypass a diagnostic step.
  3. Save.

A private database with a world-open security group is still a bad habit. Private, and locked to the EC2 security group, is the combination this lab wants. Chapter 15 used the same chaining idea: the database allows traffic only from the tier in front of it.

Copy the Endpoint and Port from the Connectivity & security tab. The endpoint looks like this:

college-library-mysql-test.example.invalid

This displayed hostname is a placeholder. Copy the actual endpoint and port from your intended resource; 3306 is the common MySQL default, not proof of every configuration. Always store this hostname in the application. Do not paste the IP address it resolves to. After a failover the IP can change, and the hostname follows the new host.

Lab

First complete the offline review and schema exercises below. For a separate real AWS exercise, use the reviewed account, configuration, estimate and retirement plan. After creation, record the actual resource identity, endpoint and port without credentials, then verify the intended client and database objects in the connection lesson.

1. Define the result before opening the creation form

A college library wants a lending application. Students will search the catalogue, and library staff will record which copy of a book was issued and returned. The first database task is to provide a suitable MySQL environment. That is different from building the entire lending application: creating a managed DB instance does not automatically create books, members and loans tables or populate their records.

For this lesson, the intended learning result is a clearly identified MySQL DB instance, a logical database called librarylending, a deliberate private access path and a documented plan for credentials, recovery and cleanup. A later lesson connects an EC2 client and verifies database operations. Keeping those milestones separate helps you understand what each screen has actually accomplished.

The console walkthrough explains a real creation workflow, which can create chargeable resources when performed in an AWS account. Use a designated learning environment and an agreed configuration and spending limit. The two executable exercises on this page use only fictional settings and local temporary SQLite data. They let you practise the decisions without provisioning an AWS database.

Prepare a small configuration record before starting. Include the account and Region, engine and version, DB instance identifier, logical database name, deployment type, VPC, subnet group, security groups, capacity, encryption choice and lifecycle owner. This is not an invitation to record passwords. The record explains the intended environment so another student can compare it with the result.

Do not treat the shortest possible creation path as the learning objective. A database can exist with an unintended network configuration, unnecessary capacity or no usable application tables. The useful outcome is an environment whose choices you can explain and whose next verification steps are clear.

2. Confirm the account, Region and operating identity

Start by checking the AWS account and selected Region. A resource created in the wrong account is not made correct by giving it the expected name. A resource created in the wrong Region may use a different network and available configuration. For an application already running in a selected VPC, identify that VPC and its Region before choosing the database location.

Use the organisation's assigned access method and an identity with the required permissions. Creating the database can involve RDS operations plus access to related network, encryption, monitoring or secret-management facilities. The exact permissions depend on the choices you make. An error about a missing permission is a reason to inspect the intended operation and access policy, not to share root credentials.

Inventory the existing resources that the lesson will use. Record the application instance's identifier and security group, the intended VPC and the eligible database subnets. Names are helpful labels, but identifiers make the comparison precise. Two security groups can have similar names while referring to different resources or networks.

The creation console can offer automatic connectivity setup with an EC2 compute resource. This is a supported workflow that can configure network resources and rules. It is not merely a convenience label with no side effects. For the manual learning path here, select the option to configure the network explicitly and inspect the existing resources yourself. If you choose automatic setup instead, review the resources and rules it creates.

Write down what this identity is allowed to do during the exercise. The person creating an RDS resource and the database user who later queries books are different identities at different boundaries. Understanding that separation now prevents confusion when AWS creation succeeds but a SQL client still needs its own login and privileges.

3. Choose MySQL and a supported version deliberately

Open the RDS console, choose Databases and the create-database action. Select the detailed creation workflow, commonly called Standard create, so you can inspect the configuration. Console grouping and labels can change; follow the meaning of each setting and compare it with the current documentation rather than rely only on its position in a screenshot.

Select MySQL for this lesson. Do not accidentally select Aurora MySQL merely because its name also contains MySQL. Aurora has a different cluster and storage arrangement. Both can be useful, but the resource type, settings and later procedures must agree with the lesson you intend to perform.

Choose a currently supported engine version offered for the selected Region and configuration. Check the application's driver and any required SQL features against that version. A familiar version number from an old tutorial can be approaching or past its standard support lifecycle. Conversely, the newest displayed version is not automatically compatible with every existing application.

Understand major and minor version choices at a practical level. A major change can introduce compatibility differences that require a migration or application adjustment. Minor updates also deserve release-note review and testing. Selecting automatic minor updates does not mean every future change is harmless, and selecting a maintenance window does not make compatibility testing unnecessary.

Record the exact selected engine version in the configuration sheet. This gives later troubleshooting a concrete starting point. If another student sees different options, compare account, Region, deployment type and current service support before concluding that either screen is wrong.

4. Treat a template as suggested settings

Templates such as Production, Dev/Test or account-specific introductory options can preselect several settings. They are a starting arrangement, not a promise about the final bill or the suitability of every choice. Changing later fields can produce a configuration very different from the initial template.

For a disposable development exercise, a Dev/Test starting point can make the form easier to work through. Still inspect availability, capacity, storage, backups, monitoring and other selected features. A production template may choose capabilities appropriate to a different reliability objective. The library's actual requirements should determine the final configuration.

Free usage, credits and introductory benefits depend on the account and current terms. A small instance class is not proof that every component will be free. Review the current account eligibility, selected Region, configuration estimate and relevant pricing before creation. Keep an estimate with its assumptions rather than copying a permanent zero-cost claim into your notes.

Separate the resource estimate from expected operating time. A small database left running for weeks is different from the same configuration used for a short session. Retained snapshots, storage and related resources can continue to matter after the application test ends. Assign a cleanup owner and a review time while planning the exercise.

The offline configuration exercise deliberately treats pricing review as a required piece of recorded evidence rather than computing an invented AWS bill. It cannot check your real account eligibility. Its purpose is to catch missing decisions before a student treats a template name as an answer to every cost question.

5. Name the instance and initial database separately

Use a unique DB instance identifier such as college-library-mysql-test, subject to the service's naming rules and the team's conventions. This identifier names the AWS managed resource. The initial database name, librarylending in our example, names a logical database inside MySQL. Giving the two fields the same text is possible in some arrangements, but it can hide the difference from beginners.

For this RDS MySQL creation field, use the documented naming requirements: a letter first and only letters and numbers, within the allowed length. The example librarylending avoids an underscore even though MySQL itself can support names that the service creation field restricts. Supplying an initial database name asks the creation process to create that logical database. It does not design the application's tables. If the initial name is omitted, the intended application database may need to be created later through an appropriate SQL operation. Do not infer its existence from the resource identifier alone.

Imagine the console shows college-library-mysql-test as available while the application reports that librarylending is unknown. Both observations can be consistent. The managed environment may exist while the application selected a name that was never created or a different destination. Inspect the exact database context rather than recreating the entire resource immediately.

Agree on names for later application objects as well: books, copies and loans are possible examples. Those names belong to the schema design, not the RDS creation form. The second local exercise demonstrates this distinction by creating an empty database environment and showing that the expected books table still does not exist until schema creation runs.

Add useful ownership and purpose tags where the organisation uses them. A tag can help identify the learning environment and cleanup responsibility, but it does not grant SQL access or prevent every mistaken deletion. Use it as inventory context alongside the actual resource identity and configuration.

6. Separate the administrative user from the application user

The master username identifies the database administrative account created with the instance. Choose a supported name that follows the current MySQL and RDS restrictions. RDS reserves internal identities such as rdsadmin. The master account has service-defined administrative privileges; it is not unrestricted SSH access to the underlying operating system.

Use the administrative identity for the appropriate setup work, such as creating application objects and constrained database users. The everyday lending application should have a separate identity with the permissions it needs. A request to search books or record a loan does not ordinarily need authority to administer every database user or remove the whole database.

Do not assume the creation form creates that application identity automatically. Record it as a subsequent setup task with an explicit privilege plan. A successful administrative login is not evidence that the application's own credentials and permissions are correct. Later verification should use the identity the application will actually use.

Choose the master password-management method supported by the selected configuration. One option is a securely managed password under the team's own procedure. Another is RDS integration with Secrets Manager, where RDS generates and manages the master credential in a secret. The latter has its own permissions, charges and feature compatibility limits; it is not simply a different text box.

For a real account, enter credentials only through the intended secure workflow. Do not put them in course screenshots, Git files, shell history or a shared configuration worksheet. This page's examples use labels describing credential handling and never require a real password. A record can say how authorised access will retrieve credentials without containing the credentials themselves.

Credential rotation also needs application planning. Managing a master secret does not automatically convert an unrelated application user into a rotating identity or make every running connection reload its credentials. Identify which user the application uses and how its connection configuration responds to the chosen rotation process.

7. Select compute and storage for the exercise's workload

The DB instance class provides compute and memory characteristics for MySQL. The class available and suitable for your exercise depends on the selected version, Region, deployment and workload. Choose a supported learning configuration after reviewing its estimate. Do not assume a class named in an older screenshot is universally offered or covered by account benefits.

Storage settings determine allocated capacity and supported performance characteristics. For a new small learning database, inspect the minimums and options for the chosen storage family. The amount of space must accommodate more than a displayed table of book titles: indexes, logs, temporary work and expected growth also matter. A simple introductory workload is different from the college's complete production history.

Storage autoscaling, when available and enabled, can increase allocated storage under documented conditions up to the configured maximum. It does not increase CPU or memory, and it does not provide an unlimited guarantee against storage exhaustion. The maximum and timing conditions matter. Turning it off is also a decision to observe and manage capacity manually.

For the learning record, state the selected storage type, initial size, autoscaling choice and any maximum. Explain why those values match the intended exercise. If you change one field, inspect dependent settings and the estimate again. A configuration that was sensible before the change may no longer have the same performance or cost assumptions.

Keep performance claims modest until measured. A provisioned storage value is not a promise that every SQL statement achieves a particular response time. The library query design, indexing, connection demand and other resource limits all influence the result. Provisioning creates a capacity arrangement; testing tells you how the application behaves within it.

8. Choose availability and the intended private access path

For the specifically disposable development example, choose an ordinary Single-AZ DB instance if that matches the agreed learning requirements. This does not supply the conventional Multi-AZ instance's standby. A real lending service may require a different availability design. Choose the deployment from the required outcome and inspect the resulting estimate, rather than assume all RDS creation choices produce the same topology.

Select the intended VPC and a suitable DB subnet group. Ordinary regional DB instance groups cover at least two AZs even for a Single-AZ selection. Inspect the member subnets, zone coverage and spare address capacity. The group supplies eligible locations; it does not change a Single-AZ choice into a Multi-AZ deployment.

For this manual learning path, choose private database access and the reviewed database security group. Publicly accessible set to No is an important configuration observation, but it is not the entire access policy. The application still needs an effective path and allowed traffic, and the database still needs authentication and SQL permissions.

For a MySQL listener configured on TCP 3306, the database security group can allow that port from the application instance's security group in the supported same-VPC arrangement. Select the exact source group identifier. This rule identifies permitted network sources; it does not copy the source group's own rules into the database group or grant a database username.

Check all attached security groups, because their allowed traffic combines. One narrowly written rule does not cancel a broader allowance in another attached group. Also review application egress, route tables and any relevant network ACLs. A correct inbound database rule cannot compensate for every missing condition elsewhere in the path.

Do not replace this application's source group with a world-wide IPv4 or IPv6 range merely to make an error disappear. Equally, do not assume that your laptop's address is the source of a connection sent by the EC2 application. Follow where the client operation actually originates and use the intended access arrangement for that environment.

9. Make encryption and key ownership explicit

Review encryption at rest in the creation form and select the appropriate KMS key for the intended environment. The key choice is an operational dependency, not decorative metadata. The key and permissions must remain usable for the database and retained encrypted recovery material.

An AWS managed key and a customer managed key have different administration arrangements. A customer managed key can provide additional policy control, but someone must own its lifecycle and access decisions. Do not disable or schedule deletion of a key merely because a particular database exercise has ended when other resources or retained snapshots still depend on it.

For an encrypted DB instance, the key cannot simply be changed in place later. A supported snapshot-copy and restore process can be relevant when changing encryption arrangements. Therefore identify requirements before creation instead of assuming every setting is a harmless toggle that can be corrected after the instance is running.

Encryption at rest and TLS for client connections protect different stages. Encrypted storage does not automatically prove the application's network connection uses the intended TLS verification. Record the later client-verification task separately. The course's connection lesson should establish that behavior with the selected MySQL client and current trust configuration.

Also distinguish protection from permission. An authorised SQL account can still perform a damaging operation against encrypted data if its privileges allow that operation. Use suitable application privileges, recovery facilities and operational controls alongside encryption rather than expecting one setting to replace the others.

10. Configure recovery, maintenance and retirement before creation

Choose automated-backup retention according to the information the exercise needs to recover and the time over which mistakes might be discovered. An RDS DB instance supports retention from zero to 35 days; zero disables automated backups. Multi-AZ DB clusters have a different supported range of one to 35 days. Changing a DB instance between zero and a nonzero retention value causes an outage, so this is not an inconsequential later toggle. Do not call one day sufficient for every student exercise or every real application.

The console and API can apply different creation defaults when retention is omitted. That is a reason to record the selected value explicitly. A configuration copied into another workflow should preserve the intended outcome rather than rely on an unnoticed default. A backup setting also needs later evidence that the desired recovery window exists and can be used.

Select backup and maintenance preferences that fit the environment. Some maintenance can affect availability. Understand the automatic minor-version setting and pending changes, and plan the application's verification after a change. A preferred window is useful scheduling information, not a guarantee that the library never experiences interruption.

Decide whether deletion protection should remain enabled for this resource. It helps block DB instance deletion until the protection is changed; it is not a backup and does not prevent a permitted SQL command from deleting rows. For a valuable environment, accidental deletion protection and recoverable history address different failure scenarios.

Write the retirement plan before the learning session begins. Identify the resource owner, final-snapshot decision, retained automated-backup decision and any related resources that should remain. Retained copies can have ongoing charges. Deleting the running instance does not mean every manual snapshot or other associated resource disappears.

Stopping an eligible DB instance is a temporary operational state, not permanent cleanup. Stopped resources can retain storage-related charges and are subject to the service's restart behavior. Review the dedicated stop-and-delete lesson when completing a cloud exercise, and verify the final inventory instead of assuming the last button ended every cost.

11. Review the final configuration and submit once

Before choosing Create database, compare the form with your configuration record. Confirm the engine, version, instance and database names, administrative identity method, deployment type, compute and storage, network, encryption, backups and lifecycle choices. Inspect the current estimate and any explanatory notices attached to the selected options.

Use the following sequence as a review path through the console. These steps describe an actual creation action when you perform them in AWS; the local exercises below do not submit anything.

  1. Open RDS in the intended account and Region and start the detailed database creation workflow.
  2. Select MySQL, its reviewed version and the starting template, then verify the availability deployment type.
  3. Enter the instance identifier, supported master username and selected credential-management method.
  4. Choose compatible compute and storage settings, including the explicit autoscaling decision and any maximum.
  5. Select manual connectivity for this walkthrough, the intended VPC, suitable DB subnet group, private accessibility and reviewed security groups.
  6. Set the initial logical database name in the relevant additional configuration area and verify encryption, key, retention, maintenance and deletion settings.
  7. Review the completed form and current estimate against the agreed learning plan, then submit the creation action once.
  8. Record the new resource identity and inspect its status and events until the service reaches the appropriate state or reports a specific problem.

Creation takes time and can have intermediate states. Do not repeatedly submit because the first screen has not finished refreshing. Locate the intended resource and inspect its status and events. If an error identifies incompatible settings or permissions, investigate that specific cause before making another request that could create an unintended duplicate.

The exact console order can vary. Some settings appear only after choosing a compatible engine or deployment. If a field is unavailable, first inspect those dependencies and the current documentation. A missing option does not justify silently substituting a different database product and continuing with mismatched instructions.

12. Verify the created environment in layers

The status Available is a service observation. It does not prove that an EC2 client can reach the endpoint, that the application identity can authenticate or that the books table exists. Keep those as separate milestones. This prevents a student from declaring the whole lending service complete while only the managed infrastructure has been created.

First inspect the resource configuration: the intended identity, Region, engine and version, deployment, storage, VPC, subnet group, accessibility, security groups, encryption, retention and pending modifications. Record the actual endpoint and port from the resource. The illustrative endpoint shown in an old course page is not a value to reuse.

Next, use the designated client environment for the connection lesson. Verify the intended hostname, network path and TLS configuration, then authenticate with the appropriate database identity. Check the logical database and application objects. An unknown database or missing table has a different meaning from an inability to establish a network connection.

Finally, test a small agreed application operation with fictional learning data. For a library example, read a known book record and perform an authorised test change that can be checked and reversed. Use the actual application identity for its acceptance test. Administrative access alone can conceal missing application privileges.

Document what is complete and what remains. A useful handoff might say: “Resource configuration matches the plan; logical database exists; application tables and restricted-user verification remain.” That statement is more precise than “RDS done” and gives the next student a concrete starting point.

13. Post-creation SQL observations

After establishing an authorised MySQL connection using the connection lesson's network and TLS procedure, you can inspect the selected database context with read-only SQL. These statements are MySQL examples for that connected environment; they were not executed against a cloud database as part of the offline exercises. They do not create the missing application schema.

SELECT VERSION() AS engine_version,
       DATABASE() AS selected_database,
       CURRENT_USER() AS authenticated_account;

SELECT SCHEMA_NAME
FROM information_schema.SCHEMATA
WHERE SCHEMA_NAME = 'librarylending';

SELECT TABLE_NAME
FROM information_schema.TABLES
WHERE TABLE_SCHEMA = 'librarylending'
ORDER BY TABLE_NAME;

The first statement reports the server version, the currently selected logical database and the account used for privilege checking. A null selected database can mean that the session connected without choosing a default database. It does not mean the entire server contains no databases. Compare the observation with the driver's intended database setting before changing the infrastructure.

The second statement searches metadata for the exact intended database name. Metadata visibility depends on the connected account's privileges. If the result is empty, investigate both the intended database's existence and the account's visibility. Do not automatically grant broad permissions simply to make every database name appear in a list.

The third statement lists visible table names in that logical database. A newly created database can exist without the application's tables. If books and loans are absent, review the application's schema setup or migration process. If the expected tables are present, meaningful record and privilege checks remain necessary; a familiar name alone does not establish correct content.

For the library handoff, record the observations separately. For example, the administrative session may select librarylending and see no application tables. That is a clear intermediate result: the next job is reviewed schema setup, followed by restricted-user and application testing. It is not evidence that RDS must be recreated or publicly exposed.

Run observations only against the intended learning destination and keep any returned account or environment details within the team's normal handling process. You do not need to publish those details to complete this course exercise. The useful learning outcome is understanding what each query proves and which conclusion would go beyond its evidence.

14. Lab: find missing creation decisions before provisioning

Save the following code as library_review.py and run it with Python 3. This is a deliberately small fictional configuration worksheet. It is not an AWS request, does not include credentials and does not check real service availability or account pricing. Passing means only that the supplied example satisfies the checks written in this exercise.

Read the scenario first. It describes a disposable, ordinary regional Single-AZ MySQL exercise with private access, encryption and a limited application-source rule. The retention value of three days belongs only to the invented two-day session and review period. It is not a general recommendation for every learning or production database.

from copy import deepcopy

# This is a fictional worksheet, not an AWS API request or pricing estimate.
plan = {
    'account_label': 'assigned-learning-account',
    'region_reviewed': True,
    'engine': 'mysql',
    'version_and_class_review': 'current supported combination checked',
    'instance_id': 'college-library-mysql-test',
    'initial_database': 'librarylending',
    'master_user': 'library_admin',
    'application_user_plan': 'library_app with limited SQL privileges',
    'credential_method': 'managed-secret',
    'cost_review': 'estimate and account eligibility recorded',
    'deployment': 'single-az-instance',
    'subnet_azs': ['AZ-A', 'AZ-B'],
    'public_access': False,
    'inbound': [{'protocol': 'tcp', 'port': 3306,
                 'source_group': 'fictional-library-app-group'}],
    'encrypted': True,
    'key_owner': 'assigned learning operator',
    'backup_retention_days': 3,
    'retention_reason': 'fictional exercise spans two days plus review',
    'deletion_protection': True,
    'retirement_plan': 'review final snapshot and retained resources with owner',
}


def review(candidate):
    errors = []
    for field in ['account_label', 'version_and_class_review', 'instance_id',
                  'application_user_plan', 'cost_review', 'key_owner',
                  'retention_reason', 'retirement_plan']:
        if not candidate.get(field):
            errors.append('Missing decision: ' + field)
    if candidate.get('region_reviewed') is not True:
        errors.append('Region not reviewed')
    if candidate.get('engine') != 'mysql':
        errors.append('Different engine from this standard MySQL exercise')
    if candidate.get('initial_database') != 'librarylending':
        errors.append('Expected initial database not requested')
    if candidate.get('master_user') == 'rdsadmin':
        errors.append('Reserved administrative identity')
    if candidate.get('credential_method') not in {'managed-secret', 'team-managed-password'}:
        errors.append('Credential management method not selected')
    if candidate.get('deployment') != 'single-az-instance':
        errors.append('Different deployment from this disposable scenario')
    if len(set(candidate.get('subnet_azs', []))) < 2:
        errors.append('Ordinary regional group lacks two-zone coverage')
    if candidate.get('public_access') is not False:
        errors.append('This scenario requires private accessibility')
    if candidate.get('inbound') != plan['inbound']:
        errors.append('Inbound source differs from reviewed application group')
    if candidate.get('encrypted') is not True:
        errors.append('This scenario requires encryption at rest')
    retention = candidate.get('backup_retention_days')
    if type(retention) is not int or not 1 <= retention <= 35:
        errors.append('This scenario requires nonzero supported retention')
    if type(candidate.get('deletion_protection')) is not bool:
        errors.append('Deletion protection decision is missing')
    return errors


assert review(plan) == []
print('Complete fictional worksheet: PASS within listed checks')
for label, changes in [
    ('Template is not a cost review', {'cost_review': ''}),
    ('Available does not create an initial database', {'initial_database': ''}),
    ('Public access differs from plan', {'public_access': True}),
    ('Zero disables automated backups', {'backup_retention_days': 0}),
    ('Repeated zone is not two zones', {'subnet_azs': ['AZ-A', 'AZ-A']}),
    ('No cleanup owner procedure', {'retirement_plan': ''}),
]:
    candidate = deepcopy(plan)
    candidate.update(changes)
    errors = review(candidate)
    assert errors
    print(label + ': REJECT - ' + '; '.join(errors))
print('No AWS calls. Supplied review labels are not independently verified.')

Each rejected example removes or changes one important decision. The cost example shows that selecting a template cannot supply a missing estimate review. The initial-database example shows that naming an instance does not request the logical application database. The repeated-zone example shows that two entries are not necessarily two distinct AZs.

The model trusts its supplied labels. It does not independently verify that the class is available, that an estimate is current or that a real operator reviewed a key. This limitation matters: automated worksheets can catch omissions, but a string saying checked is not evidence that the underlying check happened. Keep the actual supporting evidence with a real deployment review.

For your task, explain three rejection messages without reading the code aloud. Name the consequence of the missing decision and the evidence needed to resolve it. Then add a hypothetical unexpected security-group rule to a copied candidate and predict why it differs from the scenario. Do not use real resource identifiers or credentials in this local exercise.

15. Lab: a database connection is not an application schema

This exercise uses SQLite in a temporary directory to demonstrate the difference between an accessible database environment and application objects. It does not create an RDS DB instance, reproduce MySQL's privilege system or test a network connection. Save it as library_schema.py and run it with Python 3 containing the SQLite module.

Three different database learning milestonesFirst the environment is created. Then the logical database and application tables are established. Finally the application identity and meaningful record operation are verified. An earlier milestone does not prove the later ones.1. Managed environmentResource state and settings2. Application objectsDatabase, tables, data rules3. Useful operationRight identity, right destination,expected record and behavior
The local lab demonstrates the gap between an open database and its application tables. A real RDS acceptance check also verifies the actual client, network and identity.
from pathlib import Path
from tempfile import TemporaryDirectory
import sqlite3

with TemporaryDirectory(prefix='library-schema-') as directory:
    root = Path(directory)
    database = root / 'librarylending.db'
    connection = sqlite3.connect(database)
    try:
        tables = connection.execute(
            "SELECT name FROM sqlite_master WHERE type='table'"
        ).fetchall()
        assert tables == []
        try:
            connection.execute('SELECT title FROM books').fetchall()
        except sqlite3.OperationalError as error:
            assert 'no such table' in str(error).lower()
            print('Database connection succeeds; books table is MISSING')
        else:
            raise AssertionError('Unexpected application table')
        connection.execute('''CREATE TABLE books (
            book_id TEXT PRIMARY KEY,
            title TEXT NOT NULL,
            total_copies INTEGER NOT NULL CHECK(total_copies >= 0),
            available_copies INTEGER NOT NULL
                CHECK(available_copies >= 0 AND available_copies <= total_copies)
        )''')
        connection.execute('INSERT INTO books VALUES (?, ?, ?, ?)',
                           ('BK101', 'Engineering Mathematics', 10, 4))
        connection.commit()
        row = connection.execute(
            'SELECT title, total_copies, available_copies FROM books WHERE book_id=?',
            ('BK101',)
        ).fetchone()
        assert row == ('Engineering Mathematics', 10, 4)
        print('Schema plus known record:', row)
        try:
            connection.execute(
                'UPDATE books SET available_copies=? WHERE book_id=?', (11, 'BK101')
            )
            connection.commit()
        except sqlite3.IntegrityError:
            connection.rollback()
            print('Application data rule rejects 11 available out of 10 copies')
        else:
            raise AssertionError('Invalid quantity unexpectedly accepted')
        assert connection.execute(
            'SELECT available_copies FROM books WHERE book_id=?', ('BK101',)
        ).fetchone()[0] == 4
    finally:
        connection.close()
assert not root.exists()
print('Temporary library database cleaned')

The first query fails because the books table does not yet exist, even though the program has an open database connection. The next steps deliberately create the schema and insert a known fictional record. That is application setup work, separate from obtaining a database environment.

The quantity check adds one small business rule: available copies cannot exceed total copies or be negative. The attempted update to eleven available copies out of ten is rejected, and the verified value remains four. The database enforces a rule that the application designer supplied; a managed service could not invent that library-specific rule by itself.

Record the three observations separately: connection established, schema and known row present, invalid quantity rejected. None proves that a real EC2 application can authenticate to RDS. This separation lets you use the small experiment as an explanation while preserving the need for the later service-specific connection and application tests.

16. Interview questions with explained answers

1. The instance is Available, but the application says its table does not exist. Explain the next investigation.

Available describes the managed resource state, not the application's schema. Confirm the selected endpoint and logical database, then inspect whether the intended schema migration created the table and whether the application identity can access it. A successful connection followed by a specific SQL error provides different evidence from a network timeout. Do not recreate infrastructure before understanding that distinction.

2. Why are the instance identifier and initial database name different fields?

The instance identifier names the AWS resource used for management operations. The initial database name requests a logical database inside the selected engine, where supported. Application tables require further schema work. Using different descriptive names in a lesson makes those levels visible and prevents the assumption that an AWS resource label automatically creates the application's database and records.

3. Does a Dev/Test or introductory template guarantee a free exercise?

No. A template preselects settings. Actual charges and benefits depend on the account, current eligibility, Region, selected resources and operating time. Review the estimate and related services, including retained resources after cleanup. The useful answer explains the configuration and assumptions, rather than relying on a template name or a remembered small instance class.

4. Why should the library application use a separate database identity?

The application's normal operations need a limited set of data privileges. The administrative identity has a different purpose and can perform broader setup work. Keeping those purposes separate reduces the impact of application mistakes and makes permission testing meaningful. Creating the RDS instance does not necessarily create the restricted user; that must be configured and tested as part of application setup.

5. What does a security-group source reference accomplish here?

In the supported same-VPC example, it permits the selected database traffic from network interfaces associated with the referenced application group. It does not grant SQL privileges or copy the application's security-group rules. Check the effective rules across all attached groups and the rest of the network path, then verify database authentication separately.

6. Can deletion protection replace a backup and restore plan?

No. Deletion protection helps block the DB instance deletion operation until changed. It does not undo an incorrect SQL update or supply historical records after an application mistake. Backups and tested restoration address recovery, while protection addresses one administrative action. The library needs responsibilities and evidence for both where its data matters.

17. Quiz: reason about the selected settings

Make a prediction before opening an answer. A good explanation connects the setting to a concrete effect on the lending application.

1. Backup retention is zero. Does this mean keep an unlimited history?

No. For an RDS DB instance, zero disables automated backups. Choose and verify the intended nonzero retention when automated recovery history is required. Do not infer a recovery window from a setting that disables the mechanism.

2. The database allows the application group, but another attached group allows everyone. Is access limited to the application group?

No. Security-group allowances combine. Review all attached groups and remove unintended broad access through the appropriate managed change. One narrow rule does not override another group's broader permission.

3. Storage autoscaling is enabled. Will CPU and memory grow too?

No. Storage autoscaling addresses allocated storage under its conditions and configured limits. Compute capacity is a separate choice. Investigate the actual workload constraint before expecting one capacity facility to solve every performance problem.

4. A managed master secret exists. Has the application user been created and tested?

That does not follow. The master secret belongs to the administrative credential arrangement. A restricted application user, its privileges and its credential-handling behavior require their own setup and verification.

5. The running instance is deleted. Can you assume all charges and retained copies are gone?

No. Manual snapshots, retained backups and other resources can remain according to the selected lifecycle choices. Inspect the final inventory and account for intentionally retained resources instead of treating instance deletion as a complete resource audit.

18. Revision cards and tasks

Creation template
A starting set of selections. Review the final fields and account-specific estimate.
Initial logical database
A named database inside MySQL, distinct from the resource identifier and application tables.
Administrative identity
An account for appropriate setup tasks. It should not automatically become the everyday application login.
Private connectivity
An intended network path and effective access rules, followed by separate authentication and SQL authorization.
Encryption dependency
The selected key and its continued availability matter to the database and retained encrypted recovery material.
Application acceptance
Verified operations through the intended client and identity with meaningful records. Service status alone does not prove it.

Task 1: Prepare the fictional library creation record without credentials. Add a reason for each capacity, availability and recovery choice. Mark every assumption requiring current account or regional verification.

Task 2: Explain the empty-database lab to another student in three stages. Identify exactly which stage creates application objects and which observation proves the quantity rule works.

Task 3: Write a handoff note for an environment where the instance and initial database exist but application-user permissions have not yet been checked. Make the incomplete milestone explicit and give the next verification action.

Task 4: Draft a retirement inventory showing the running instance, manual snapshots, retained backups and related resources. State which items should remain and their owner, without executing deletion commands as part of this paper exercise.

Primary sources