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

Chapter 5: Amazon EC2 (Elastic Compute Cloud)

AWS Cloud

5.2 What is EC2? Key concepts

Think of EC2 as renting a furnished flat – you don't have to build the house yourself. You choose the size of the flat (instance type), the setup inside (AMI), the lock and key (key pair) and the society gate rules (security group). Most introductory EC2 launches use virtual instances in the Region you choose. A hypervisor isolates virtual machines on the underlying hardware. EC2 also offers bare-metal options for supported types. Come on, now look at the key terms:

Amazon EC2 provides compute resources called instances in the AWS cloud. They include virtual servers and supported bare-metal options.

 AWS Region: Asia Pacific (Mumbai) ap-south-1
 +---------------------------------------------------------------------+
 |  Availability Zone ap-south-1a        Availability Zone ap-south-1b |
 |  +---------------------------+        +---------------------------+ |
 |  | VPC subnet                |        | VPC subnet                | |
 |  |  +---------------------+  |        |  +---------------------+  | |
 |  |  | EC2 instance        |  |        |  | EC2 instance        |  | |
 |  |  | AMI: Ubuntu 24.04   |  |        |  | AMI: AL2023         |  | |
 |  |  | Type: t3.micro      |  |        |  | Type: t3.small      |  | |
 |  |  | SG: web-sg          |  |        |  | SG: web-sg          |  | |
 |  |  +----------+----------+  |        |  +----------+----------+  | |
 |  |             | EBS vol     |        |             | EBS vol     | |
 |  +---------------------------+        +---------------------------+ |
 +---------------------------------------------------------------------+
Term What it is Example / notes
Instance A compute resource, typically a virtual server. Some types offer bare metal. i-​0abc123def4567890
AMI (Amazon Machine Image) Template with OS + software used to launch instances Amazon Linux 2023, Ubuntu 24.04, CentOS Stream 9, your own custom AMI
Instance type Hardware size: vCPU, RAM, network t3.micro (2 vCPU, 1 GiB), t3.medium (2 vCPU, 4 GiB)
Key pair An authentication key pair for supported instance access workflows such as SSH on Linux For a key generated by EC2, save the private key at creation in the approved secure location. An imported public key has a private counterpart you manage.
Security group (SG) Stateful network permission control for its associated resources Allow the intended application connection from its approved caller. Use a separate approved administration path.
EBS volume Network-attached block storage (virtual hard disk) Root volume 8 GiB gp3
Instance store Temporary disk physically attached to host Data lost on stop/terminate (only on some types)
Elastic IP Static public IPv4 address Survives stop/start; re-mappable
Region Geographic area with multiple data centres ap-south-1 Mumbai, us-east-1 N. Virginia
Availability Zone (AZ) One or more isolated data centres inside a region ap-south-1a, ap-south-1b, ap-south-1c
VPC / subnet Your private network / a slice of it in one AZ Default VPC 172.31.0.0/16
User data Launch input that an image or configuration can use for scripts or cloud-init during setup Install Nginx on launch
IAM role and instance profile The profile associates a role. The role gives the workload supported temporary AWS API credentials and scoped permissions. Allow instance to read from S3 (e.g. a Nashik grape exporter's app reading its invoices bucket)

In Mauli Dairy's terms: their website will run on one instance. For the OS the AMI is Amazon Linux 2023, for the size t3.micro, for login the key pair mauli-key.pem, and the security group has only three doors – 22 (only My IP), 80 and 443. For customers in Maharashtra, Mumbai (ap-south-1) is one Region to evaluate with the actual client path, workload requirements and service availability. A security group is stateful (it automatically lets the reply to an allowed incoming request go back out) – so you don't need a separate outbound rule for the reply to an allowed request.

Instance type naming

      t  3  a  .  micro
      │  │  │     └── size: nano, micro, small, medium, large, xlarge, 2xlarge ...
      │  │  └──────── extra attribute: a = AMD, g = Graviton (ARM), i = Intel, d = local NVMe, n = network
      │  └─────────── generation (compare the documented specs and measured workload performance)
      └────────────── family: t = burstable general purpose
Family Category Use case Examples
T General purpose, burstable (CPU credits) Dev/test, small websites, labs t3.micro, t3.small, t4g.small
M General purpose, balanced App servers, small databases m7i.large, m7g.large
C Compute optimised Batch processing, gaming, high-traffic web c7i.xlarge
R / X Memory optimised Large databases, in-memory caches r7i.large
I / D Storage optimised NoSQL, data warehouses i4i.large
P / G / Inf / Trn Accelerated (GPU/ML chips) Machine learning, video g5.xlarge

Burstable (able to use more CPU for a short time when needed) means the T family: low CPU at normal times, and when a rush comes it uses CPU credits to run faster for a while. A T-family instance can fit a small, bursty workload such as a Mauli training site after you check memory, sustained CPU, credit mode and cost.

Graviton (ARM) instances

Types with g (e.g. t4g, m7g) use AWS Graviton ARM processors. Choose a compatible arm64 AMI and check application packages and binaries before launch. Compare price and performance using the workloads you need.

Pricing models

Model How it works Discount vs On-Demand Best for
On-Demand Pay per second (Linux, min 60 s); no commitment — Labs, unpredictable workloads
Savings Plans Commit to an eligible level of hourly usage spend under the chosen plan for one or three years Varies by offer and eligible usage Steady long-term usage
Reserved Instances Purchase a one- or three-year billing benefit for instances that meet the selected offer and attributes. Coverage and flexibility depend on its class and scope. Varies by offer and eligible usage Always-on production servers
Spot Instances Use spare capacity that AWS can interrupt. Interruption notices are best effort, and a hibernation action can begin immediately. Varies by instance type, time and location Fault-tolerant batch jobs, CI, rendering
Dedicated Hosts / Instances Dedicated Hosts provide host-level allocation and visibility. Dedicated Instances run on hardware isolated from other accounts under AWS tenancy rules. Premium Licensing, compliance

What you pay for: instance running time, EBS storage (even when the instance is stopped), snapshots, public IPv4 addresses (including Elastic IPs), and data transfer out to the internet.

Free tier

AWS Free Tier terms depend on when the account was created and whether it uses a current free plan, another plan, or older eligibility rules. Check the account’s billing and credits, the current program terms, and the priced resources planned for the lab. An AWS Budget alert can notify you of spending, so also verify what will remain allocated after the exercise.

Ravindra Bagale's Tip

Friends, the first job in a new AWS account is not launching an instance – first create an AWS Budget with an e-mail alert (even a small amount like ₹500 equivalent will do) and turn on MFA for the root user. For daily work, use the account’s approved role-based access with temporary credentials. Security and cost control first, experiments later.

Ravindra Bagale's Tip

In interviews many students mix up Region and AZ. Remember: a Region is an area (Mumbai ap-south-1), and an AZ is one or more isolated data centres inside that region (ap-south-1a). An instance always runs in one AZ, and the console shows you only the resources of the selected region.

Practice task

Mauli Dairy sathi ek launch checklist lihun kadha: Region, AZ, AMI, instance type, key pair che naav, security group rules aani root volume size. Pratyek line samor ek chhota karan liha – udaharan mhanje "Mumbai, karan customers Maharashtra madhe aahet".

Fill in the decisions behind a request to launch a server

Mauli Dairy wants a training copy of its order status service. The app should serve example results without connecting to customer data. The practical request to the infrastructure team is “Give this worker a known Linux starting point, enough CPU and memory, a place to store its logs, and the permissions and network paths it needs.” A launch request translates that statement into several independent choices. Learning their names helps you find the right place to check when something goes wrong.

An EC2 instance is the running or otherwise allocated compute resource with its own lifecycle. Most introductory EC2 exercises use virtual instances. Some instance types offer bare-metal access to the underlying server, so “instance” covers more than a virtual machine. A learner usually controls the guest operating system and its applications under the service's shared responsibility. AWS operates the underlying infrastructure. The console helps assemble that environment from an image, instance type, storage, network and access settings.

Think of an instance ID as the cloud record for that specific resource. The human-readable Name tag is a label. Two resources can have the same label. Record the training account, Region and instance ID whenever you need to identify what actually launched. A running instance entered in inventory might still have its application starting. Resource existence, instance state, operating system login and application operation each supply evidence at a different level.

For this page, Mauli expects to launch a Linux worker from a trusted regional image, put it into an app subnet, and give it permission to read a small training object from S3. The app needs no public IP of its own. Its intended callers can reach it over an approved private path. Keep those requirements visible as you fill in each concept. An instance with an available image and small size can still fail the actual job if it cannot reach or authenticate to its dependency.

Choose the image and confirm it matches the instance type

An Amazon Machine Image, or AMI, supplies the information needed to launch an EC2 instance. For a typical EBS-backed Linux instance it includes a root volume template and a block device mapping for storage on launch, along with the image's launch permissions. The root volume template contains an operating system and any installed software prepared in that image. Launching two workers from the same AMI produces two instance resources with separate ordinary boot volumes. Changing one worker does not alter the shared source image.

Start from the intended operating system and publisher. An Amazon Linux, Ubuntu or other supported image can have different package commands, default login names and update practices. Use an official or approved publisher and choose the documented version and architecture. If your system requires a particular runtime version, list it and verify the image or installation process provides it. Do not assume that a word like Linux gives the exact same launch and login procedure for every distribution.

An AMI belongs to an AWS Region. Find the relevant image ID in the Region where the subnet and intended instance are located. A known image name may also exist in another Region under a different image ID. A cross-region move needs an appropriate image copy or another approved equivalent image in the destination, along with destination encryption and access considerations when applicable. Use the appropriate Region and publisher in a repeatable launch record rather than inventing an AMI ID from a tutorial.

Architecture is the instruction set exposed to the guest. The common image choices include x86_64 and arm64. An AWS Graviton type uses Arm. Choose a compatible arm64 image and check packages, binaries and application dependencies for that architecture. Some applications can be built for both, while others supply only one binary. A working x86 image cannot be substituted as a boot image for an Arm-only instance type.

Keep the AMI and installed application version separate in the worksheet. One deployment can use a fixed approved base image and install a tested package version during startup. Another can bake the tested application into a new image. The first pattern needs an available and controlled installation path. The second needs an image build and update process. Both make it possible to explain which version is actually running and how another instance would be recreated.

Match the type to the work the application actually performs

An instance type defines a particular resource configuration. Record the vCPU count, memory, architecture, storage options, network properties and service support that matter to your app. A vCPU is a unit of CPU capacity presented to an instance. An instance type can have a different physical CPU design from another type with the same vCPU count. Application performance also depends on memory, storage, network and software, so vCPU count alone is insufficient to predict speed.

Read an example name such as t3a.micro in pieces. The naming convention includes a series, a generation, optional attributes and a size. In that example the series is T, the number is 3, the a identifies an AMD variant in that series, and micro is the size. Use the current AWS type specification to confirm the actual resources and supported features. The name is a navigation aid. Higher generation does not prove that every operation runs faster or costs less for your workload.

Workload patternInformation to inspectUseful experiment
Small web worker with a low baseline and occasional CPU peaksMemory needs, typical CPU demand and burst configuration.Check the representative operation at ordinary load and during a planned peak.
Worker spends most time on calculationsArchitecture compatibility, sustained CPU and workload throughput.Measure completed jobs and relevant cost under the tested configuration.
Application handles an in-memory indexMemory use and growth, and how the app behaves when memory is exhausted.Fit the representative index and verify latency with usual concurrent requests.
Service processes many files or compressed objectsStorage transfer, network capacity, CPU and any local temporary-device dependency.Measure the complete file operation and identify the limiting stage first.

Burstable EC2 families earn and use CPU credits according to their documented baseline and settings. In a simplified view, unused baseline capacity can build credits. Periods above baseline can draw on them. In Standard mode CPU above the baseline is constrained when credit capacity is exhausted. In Unlimited mode the instance can continue bursting using surplus credits, which can incur additional charges under the applicable rules. The right choice depends on sustained demand and cost, not only on the small size label beside the type.

An introductory app can begin with a measured small requirement. Compare the chosen type against the operating system, software and known sample load. For a shared production app, measure a meaningful operation and plan growth and recovery. A test in one Region or zone does not establish that every type will be available on launch. Check the selected placement and account before treating your amount of capacity as guaranteed.

Predict what happens to files stored on each disk

The root volume holds the system that boots the machine, including its ordinary system files. An EBS volume is network-attached block storage presented to the EC2 instance as a disk device. In the typical lab it is created from the image's mapping. Other EBS volumes can be attached for application data where the design calls for them. An EBS volume belongs to an Availability Zone and normally attaches to an appropriate instance in the same zone. Identify the actual volume and filesystem before changing any disk configuration.

Keep three storage questions distinct. “Does the filesystem survive an ordinary stop and start?” asks what happens to an attached volume when compute stops. “Does the EBS volume get deleted on termination?” asks about the delete-on-termination setting and its ownership. “Can we recover last week's files after a bad release?” asks about recovery and snapshots or another appropriate data backup. A disk can survive a stop without protecting a file that the application accidentally overwrote.

Instance store is temporary block storage on supported instance types. Its availability and device details depend on the type. An ordinary reboot can preserve that storage while the hardware and instance remain present. Stopping, hibernating or terminating the instance or certain underlying failures can lose the data. Use an instance store only for working data the application can regenerate or safely replace. A build cache or temporary file can fit. The only copy of a confirmed order cannot be expected to survive on that volume.

A simple Mauli inventory includes the root volume for the OS, durable data in the approved database or storage service, and temporary working files the app can recreate. Make a table with columns for location, reason for using it, what survives stop, what survives replacement and how recovery is verified. If a column depends on a launch or retention flag, write the exact setting you must inspect. “Stored in AWS” is too broad to establish a file's lifetime.

The volume request can also cost money independently from running compute. A server whose state reads stopped may still have allocated EBS volumes and retained snapshots. When you finish an isolated lab, identify the test volumes and copies that the account's rules allow you to remove. Recovery planning and cleanup both need resource ownership, not a blanket delete command.

Choose where the instance is placed and where its traffic can travel

Start from the software and operating requirements. A Region defines the geographic area and available zones for the resource. Choose a supported Region with the expected service availability and approved location. Measure access performance from the relevant clients when latency matters. Mauli can evaluate Mumbai and Hyderabad for its users and dependencies rather than assuming there is one fastest choice for every network. Use the training account's permitted Region for the exercise.

Each EC2 instance belongs to an Availability Zone selected through its subnet and launch settings. The VPC is regional, a subnet belongs to one zone, and the instance's network interface uses addresses and security groups in that connected environment. Watch for similarly named resources in different Regions. An AMI listing, subnet choice and instance display can all appear empty when the console is set to a different Region than the one you intended.

An Elastic Network Interface represents a network interface in the VPC. It has properties such as private IPs and attached security groups. A security group is a stateful permission control. It permits specific protocol, port and source or destination combinations for its associated resources. An approved reply to a permitted flow does not need a separate security group rule just for that reply. Routing, relevant subnet controls and an application listener are also needed. Public reachability is an intentionally configured path, not a property of the instance's Name tag or its image.

For Mauli, start with the purpose of each flow. The worker can receive the intended private target connection. An allowed management path lets an authorized operator inspect the machine. A third flow lets the application reach an S3 training object with the necessary identity and network reachability. The application workers do not each need a direct public IPv4 to do those jobs. If an isolated lab uses one for a direct test, write down its association and path separately.

An Elastic IP is a static public IPv4 allocation that can be associated with a supported resource under the chosen configuration. An ordinary EC2 auto-assigned public IPv4 can be replaced on stop and start. That distinction can matter if a caller has to use the same address. A stable service name and public load balancer can provide a separate stable entry pattern for an app distributed across targets. In a design worksheet, state whether a client needs a stable address or a stable name before choosing a resource.

Keep machine login and applications’ AWS permissions separate

A person logging into a Linux instance and a program calling the S3 API are two different actors. A chosen EC2 key pair can supply the public key prepared for the intended guest login under the image and launch behavior. The private part belongs in the approved secure location held by its authorized user. AWS may provide it once for a key pair generated by EC2. If your organization imports a public key, the corresponding private key is managed separately. A label on the instance identifies an intended key pair. It does not guarantee that you have its private material or that the correct guest user accepts it.

Other access mechanisms have their own prerequisites. Systems Manager Session Manager, for example, can be appropriate when the instance is managed and the account and network prerequisites are met. The choice of human access should match the account policy, approved client path and installed operating system. Keep private keys and credentials out of course notes, public repositories and bootstrap content. An administrator's operating system session is not permission for an application to access any object in AWS.

An IAM role gives an AWS principal or workload the permissions granted for the actions and resources it needs. For an EC2 workload the associated instance profile is the container used to attach the role to the instance. Supported AWS SDKs or tools can obtain temporary credentials from the configured environment instead of embedding permanent access keys in the app. Give the worker only the required S3 actions on the approved training bucket and prefixes. The intended operating system user, proper endpoint path, account and bucket policies can still affect whether a particular request works.

Trace the difference with a failure. An operator logs into the test worker and can see its process. The worker's attempt to retrieve its configuration object returns an AWS authorization error. Check which role or other approved credentials the process actually uses and whether its allowed action matches the intended resource. The management login worked. That result is independent of the application's permission. Do not respond by adding long-lived account keys to the launch script. Fix the actual permission or endpoint issue under the lab's policy.

Separate the boot image from the startup instructions

Imagine a known Amazon Linux image boots successfully, but the dedicated Mauli status worker is missing its configuration. The image provides the starting operating system. It does not automatically know which training bucket, service port or output format this particular deployment needs. Startup configuration supplies those choices. It can be built into an approved image, supplied when the instance starts or obtained from a managed deployment system.

EC2 user data is a way to pass startup information. For common Linux images with cloud-init the default behavior is to run user data scripts during the first boot cycle. The behavior depends on the image, platform and configuration. Do not assume it runs on every reboot. A long package installation might still be running after the instance reports running. Check the actual startup record and approved configuration before marking the application ready.

Make bootstrap steps reproducible. A step that installs a known supported version and verifies its result gives stronger evidence than a step that guesses the latest available package and ignores failure. Every dependency needs a reachable source, permissions and a compatible architecture. If you expect a script to be rerun, decide how it handles pre-existing files, users and application settings. An idempotent operation can be repeated to achieve the same intended state under the same inputs without creating duplicates.

Keep passwords, private keys and access keys out of the launch data. User data and instance metadata are part of the instance's configuration environment, and supported controls such as IMDSv2 can help govern access to metadata. Supply sensitive application information through the approved identity and secret handling system. A bootstrap file can reference a permitted secret or object under the workload role. It should not contain the secret itself.

A simple readiness record includes instance running, expected platform and architecture, startup complete, approved access working, and the expected application result. If the last check fails, trace which earlier observation still holds. A launch succeeded even if a later package setup failed. A known operating system can boot even if an S3 permission prevents the application from reading its intended configuration. Those distinctions help identify where to work next.

Choose a payment and capacity model separately from the instance type

An instance type such as t3.micro describes a hardware-resource choice. A purchase option describes how you acquire or are billed for eligible capacity. For introductory work, an On-Demand example is easier to reason about because it does not rely on a long-term usage commitment. The actual price still depends on platform, Region, billing rules and additional resources used. Check your account's program eligibility rather than assuming that the name of a small type makes it free.

For a steady measured workload, AWS Savings Plans involve commitments to an eligible level of hourly spend for a selected term. Reserved Instance offerings have their own attributes and pricing rules. Some offerings have different flexibility and capacity implications. For instance, a discount benefit and a reservation of actual capacity are different requirements. Read the terms for the selected commitment and Region before concluding which designs it covers. A change from one instance family or Region can affect coverage depending on the option.

Spot uses spare compute capacity under a model where an instance can be interrupted. A worker running an independent queued task can be designed to save progress and retry through the supported application workflow. A single training web instance with no substitute can lose its service when interrupted. Do not rely on a notice as the only safeguard. The action and notification timing depend on the documented Spot behavior. Build durable state and interruption handling into the workload if you choose that option.

Dedicated Instances and Dedicated Hosts address some workloads' tenancy or machine-licensing needs. They have different operating and resource characteristics. Select them when a documented requirement calls for them and review actual licensing and costs. An ordinary first launch lesson needs to explain what the choice does rather than imply that everybody should select or buy one. The existing instance type, OS architecture and lifecycle choices remain relevant under any payment model.

For a training checklist, record the proposed capacity, expected hours and storage and network resources that might outlive it. AWS Free Tier terms depend on when the account was created and its current plan or eligibility. Use the account's current billing information and resource inventory. A billing alert can tell an authorized owner about cost changes. It does not serve as proof that every unneeded resource was removed.

Test a proposed image and instance assignment with a compatibility worksheet

This exercise needs only Python 3 or a sheet of paper. Mauli's example app has an Arm build and requires two imaginary memory units for its training minimum. The worksheet type names represent architectures and memory values. They are invented models, not actual EC2 specifications. The example checks compatibility and sizing separately. A type can match the architecture and still be too small.

python3 - <<'PY'
image_arch = "arm64"
required_memory = 2
types = [
    ("example-x86-small", "x86_64", 1),
    ("example-arm-small", "arm64", 1),
    ("example-arm-medium", "arm64", 4),
    ("example-x86-medium", "x86_64", 4),
]
for name, arch, memory in types:
    if arch != image_arch:
        decision = "architecture mismatch"
    elif memory < required_memory:
        decision = "too little memory"
    else:
        decision = "passes these two worksheet checks"
    print(f"{name}: {decision}")
PY

Expect an architecture mismatch on the first and fourth rows, too little memory on the second, and a pass on the third. An Arm image that meets your memory target still needs a compatible type, permitted placement and actual service availability. The final row demonstrates why more memory does not make an x86 type boot an Arm image. Change the app to an x86-only binary and explain why you now need a compatible image and type pair even before measuring the application.

Add three paper columns: whether the Region offers the type, whether the planned local or EBS storage fits the requirements, and whether the app can reach its approved dependency. Do not copy the outcome from the script into those columns. They need their own evidence. A small checklist makes it less likely that a beginner fixes an app deployment error by changing random console choices. If your shell has no here-document syntax, run the Python body in an interpreter or answer on paper. The commands allocate no AWS resources and create no files.

Read an existing training instance as a structured launch record

If you have permission to inspect a disposable training instance, open its EC2 console details. Write the instance ID or approved scratch alias, Region, image ID, instance type, Availability Zone, subnet, private IPv4 status and associated role or profile. Check the storage view for volume identifiers and relevant lifecycle flags. If the account shows nothing, confirm the correct account and Region and ask whether the lab provides read permissions. An empty screen does not prove that a resource disappeared.

With approved AWS CLI access, set the placeholders to your existing training profile, region and instance ID. Use only a resource intended for the exercise. The command below reads instance metadata from the EC2 API. It neither logs in to the guest nor prints credentials. Keep the returned identifiers within the place the training account permits.

LAB_PROFILE='REPLACE_WITH_TRAINING_PROFILE'
LAB_REGION='REPLACE_WITH_TRAINING_REGION'
LAB_INSTANCE='REPLACE_WITH_TRAINING_INSTANCE_ID'

aws ec2 describe-instances \
  --profile "$LAB_PROFILE" --region "$LAB_REGION" \
  --instance-ids "$LAB_INSTANCE" \
  --query 'Reservations[].Instances[].{Image:ImageId,Type:InstanceType,Architecture:Architecture,State:State.Name,Zone:Placement.AvailabilityZone,Subnet:SubnetId,Private:PrivateIpAddress,Public:PublicIpAddress,Profile:IamInstanceProfile.Arn,Volumes:BlockDeviceMappings[].Ebs.VolumeId}' \
  --output json

The output returns one record for the selected visible instance in this example. A private-only instance can show no ordinary public IPv4 value. An absent Profile can mean that no instance profile is associated. Compare those findings with the original plan. An instance status of running is one lifecycle observation. It does not provide evidence of an operating system login or the app's ability to access its object. You can follow the same process on paper with the sample below.

Observed fieldSample resultWhat to check against the plan
Image and architectureApproved Arm training image, arm64Correct publisher and guest architecture for the chosen type and app.
Placement and addressesPrivate app subnet, private IPv4 present, no direct public IPv4Correct path for the intended private callers and service dependencies.
ProfileTraining-reader profileThe attached role has only the access required for the training object.
Root storageEBS volume from the launch mappingExpected size and retention rules, verified separately from the instance lifecycle.

If you see a command error, distinguish a missing CLI profile from an authorization or wrong Region error. Follow approved access policy to resolve it. If the app cannot access the object, compare the intended role, service policy and network path using separate records from the actual permitted request. A profile name by itself does not prove the role's grants. The inspection step does not create new resources, alter credentials or require cleanup.

Mark what a replacement worker recreates and what it reuses

Assume the training worker misbehaves after an approved package update. The team wants to build a fresh worker from its known tested release and move one synthetic request to it. Draw two columns for inputs reused from the plan and outputs created for this instance. An approved regional AMI, an application build, interface policy and intended workload role can often be selected again. The replacement gets its own instance ID and usually a new boot volume, network interface and ordinary private address. Configuration that depends on the old machine's exact address must be deliberately reviewed.

Pay attention to attached storage. If the old worker keeps the only copy of the application data on its root volume, a replacement AMI will not copy changes made since the image was created. If the worker reads a named training object in S3 and has no unique local data, the next worker can use the same logical data source with its own authorized role. That pattern can make recovery simpler. An AMI provides a starting environment. A separate data plan identifies the authoritative records and whether a replacement has access to them.

Placement can also change what gets reused. A new worker in a different zone may still be in the same regional VPC. An EBS volume cannot simply be attached across zones as though it were a free-floating folder. A design may use an approved snapshot and new volume for a suitable recovery operation, or keep application data in a service designed for the needed access. Verify the replacement's Region, subnet, route, storage and role independently. The new worker can be healthy as a machine while unable to reach the correct dependency.

Use the replacement to test the dependency list. Confirm the image, type and zone first. Check that startup used the intended application version and that the permitted app role works from the new path. Send one representative synthetic request through the intended listener and check the training response. Keep the earlier resource available under the rollout plan while the owner verifies the replacement. When approved, record which old test resources and retained data are no longer needed. A rollback needs an actual working configuration and data path, not merely a previous instance ID.

Make the launch record usable by the next operator

Someone opening the console next week may see several resources called web-server. A reusable record describes a workload rather than relying on one label. Include the training account alias, Region, role of the worker, image source and operating system version, compatible type and placement, bootstrap version, security boundaries and storage behavior. Record the current instance ID only when documenting an actual run. Put the reason for choosing each value beside the value. Another operator can then tell which choices belong to the application requirement and which ones came from the temporary classroom.

Tags can identify an environment, owner, purpose, or cleanup date when used under the account's agreed conventions. A tag is generally metadata for organization, and some AWS access or billing features can use it when explicitly configured. A tag alone does not create network reachability, turn a worker into a database or grant permission to delete it. Treat metadata as one clue, then verify which infrastructure record matches and what the account allows. Keep secrets and personal data out of tags and records shared outside approved systems.

Suppose one test machine has an image ID that does not match the course example and a different subnet label. Ask whether the image publisher and app support are still correct, and whether the actual resource IDs belong to the training design. Do not copy the sample type or AMI ID blindly. Console options change over time and the same workload might use another acceptable type or supported OS version. A useful runbook states compatibility and verification conditions along with example values. That lets you recreate the behavior even when the displayed option or identifier changes.

Record any manual step you had to perform after an instance launched: a package installed later, a route approved during the exercise, a role permission corrected or a system service enabled by an operator. If those details are part of an intended repeatable setup, capture them in the approved build or launch configuration. A successful first instance can hide work done by hand. The launch record is complete when an authorized teammate can explain which state is automated, which state needs verification and which pieces should never be copied across environments.

Write a launch decision for each part of the worker

  1. Pick an approved software version and architecture for the Mauli reader. Choose an image and instance type that match it. State which package or binary you would verify first. A reviewer should be able to reject an incompatible pairing without launching a test machine.

  2. Specify where the application writes temporary files and where it can retrieve its durable data. State what happens after stop and start, after termination and after a file gets overwritten. Each answer should depend on a named resource or recovery control rather than the generic fact that the app uses AWS.

  3. Draw two access paths, one for a human operator and one for the app retrieving its S3 training object. Label the required network, process or identity choices for each. Explain why access for one actor cannot be used to prove the other actor is permitted. Leave secret values out of your answer.

  4. Build a readiness record for a training machine. Under each fact write the source of evidence: cloud API, guest boot log, configured path, administrative login or approved application operation. Explain when you would return to the launch plan and when you would inspect the app's startup instead.

Interview questions and worked answers

What is the difference between an AMI and an instance type?

An AMI supplies the compatible boot setup, including the starting system and block device mapping. An instance type specifies computing resources and supported features. A Region, image architecture, application binaries and type must fit together before the launch meets the stated requirement.

Which identifier tells you which machine a change affected?

Use the instance ID in the intended account and Region. A Name tag helps people recognize the role but can be reused. Check both the location and the resource record before acting. The image ID helps identify which template launched the instance and is a different identifier.

Why can an EBS-backed worker stop without losing its volume?

The volume is independent block storage attached to the worker. Ordinary stop and start can preserve it. Termination and retention can depend on each volume's settings. Backups and restore tests are separate because an attached volume can contain changed or damaged data.

How does a key pair differ from an instance profile?

An EC2 key pair can participate in guest authentication for the chosen login mechanism. An instance profile attaches an IAM role that gives the workload allowed AWS API actions with temporary credentials under supported tools. A successful SSH session cannot demonstrate that the app has S3 permission.

What is a CPU credit useful for?

It accounts for burst behavior on supported types under the configured mode. Below-baseline use can accrue credits, and above-baseline use can consume them. Unlimited mode can use surplus credits and incur charges, so compare the workload's real sustained demand.

Why can an instance be running before the site is usable?

Guest software can still be starting, installing or waiting for a dependency. The chosen listener and expected application operation need their own verification. Inspect startup output, identity, network path and useful response under the intended environment.

Check the relationships in a launch request

  1. What should match a Graviton instance type? A. An image and application that support Arm. B. Any x86-only AMI. C. A security group name beginning with an a.

    Show answer

    A. The processor architecture must be supported by the image and application. An instance selection cannot make an incompatible image boot. Security group names do not choose an instruction set.

  2. Where does the app get its allowed AWS API actions in the instance-profile design? A. The human SSH private key. B. The attached IAM role's permissions and applicable policies. C. The instance's Name tag.

    Show answer

    B. The profile associates the role. An SDK or tool can use temporary credentials under the configured environment. Guest login and tagging do not grant S3 permissions.

  3. What may remain after a supported EC2 instance stops? A. Its allocated EBS volume. B. All instance-store data by guarantee. C. A working application listener.

    Show answer

    A. EBS can remain allocated separately from compute. Instance store is temporary and ordinary stop does not protect it. The stopped guest cannot serve application requests.

  4. Which choice determines the instance's Availability Zone in an ordinary VPC launch? A. The selected subnet. B. Its Name tag. C. The last digit of the port number.

    Show answer

    A. A subnet is created in one zone, so the subnet places an ordinary launch there. The VPC and its image and network resource selection must be in compatible regional context.

  5. What should you check when the first boot is finished but a package was never installed as expected? A. The startup configuration, approved dependencies and boot logs. B. A new public IP for every instance. C. The number of browser tabs open.

    Show answer

    A. A missing package after boot points to the provisioning steps, permissions, compatibility or dependency path. Identify the observed error before treating it as a sizing or public network issue.

Revision cards

Instance and AMI
The instance has its own lifecycle. The AMI defines the reproducible starting image and device mapping.
Instance type
Verify architecture, memory, CPU, storage and networking against the actual work the app performs.
Subnet and zone
A VPC subnet is in one Availability Zone. The launch uses that placement and its intended network settings.
Storage lifetime
Separate EBS persistence, termination policy, temporary instance store and recovery.
Human and workload identity
Guest login and AWS API access are separate. Use the approved access mechanism for each actor.
Boot and readiness
A running instance needs the intended configuration, dependency permissions and verified application response to serve.

References

Quick revision cards

Revise this lesson in two minutes. Save the cards on your phone or download them as PNG files. The QR code on each card opens its lesson.

Comparison card: On-Demand vs Savings Plans / Spot. On-Demand: Pay per second or hour, no commitment. Savings Plans / Spot: Savings Plans: commit for 1 or 3 years. Spot: use spare AWS capacity.
Comparison: On-Demand vs Savings Plans / Spot · Download PNG

More cards: Ravi Sir's Cards.