Вы находитесь на странице: 1из 52

Pro .

NET on Amazon Web Services:


Guidance and Best Practices for
Building and Deployment 1st Edition
William Penberthy
Visit to download the full and correct content document:
https://ebookmass.com/product/pro-net-on-amazon-web-services-guidance-and-best-
practices-for-building-and-deployment-1st-edition-william-penberthy/
Pro .NET on
Amazon Web
Services
Guidance and Best Practices for
Building and Deployment

William Penberthy
Steve Roberts
Pro .NET on Amazon
Web Services
Guidance and Best Practices
for Building and Deployment

William Penberthy
Steve Roberts
Pro .NET on Amazon Web Services: Guidance and Best Practices for Building
and Deployment
William Penberthy Steve Roberts
Seattle, WA, USA Seattle, WA, USA

ISBN-13 (pbk): 978-1-4842-8906-8 ISBN-13 (electronic): 978-1-4842-8907-5


https://doi.org/10.1007/978-1-4842-8907-5

Copyright © 2023 by William Penberthy and Steve Roberts


This work is subject to copyright. All rights are reserved by the Publisher, whether the whole or part of the
material is concerned, specifically the rights of translation, reprinting, reuse of illustrations, recitation,
broadcasting, reproduction on microfilms or in any other physical way, and transmission or information
storage and retrieval, electronic adaptation, computer software, or by similar or dissimilar methodology now
known or hereafter developed.
Trademarked names, logos, and images may appear in this book. Rather than use a trademark symbol with
every occurrence of a trademarked name, logo, or image we use the names, logos, and images only in an
editorial fashion and to the benefit of the trademark owner, with no intention of infringement of the
trademark.
The use in this publication of trade names, trademarks, service marks, and similar terms, even if they are not
identified as such, is not to be taken as an expression of opinion as to whether or not they are subject to
proprietary rights.
While the advice and information in this book are believed to be true and accurate at the date of publication,
neither the authors nor the editors nor the publisher can accept any legal responsibility for any errors or
omissions that may be made. The publisher makes no warranty, express or implied, with respect to the
material contained herein.
Managing Director, Apress Media LLC: Welmoed Spahr
Acquisitions Editor: Jonathan Gennick
Development Editor: Laura Berendson
Coordinating Editor: Jill Balzano
Cover image designed by Freepik (www.freepik.com)
Distributed to the book trade worldwide by Springer Science+Business Media LLC, 1 New York Plaza, Suite
4600, New York, NY 10004. Phone 1-800-SPRINGER, fax (201) 348-4505, e-mail orders-ny@springer-sbm.
com, or visit www.springeronline.com. Apress Media, LLC is a California LLC and the sole member (owner)
is Springer Science + Business Media Finance Inc (SSBM Finance Inc). SSBM Finance Inc is a Delaware
corporation.
For information on translations, please e-mail booktranslations@springernature.com; for reprint,
paperback, or audio rights, please e-mail bookpermissions@springernature.com.
Apress titles may be purchased in bulk for academic, corporate, or promotional use. eBook versions and
licenses are also available for most titles. For more information, reference our Print and eBook Bulk Sales
web page at http://www.apress.com/bulk-sales.
Any source code or other supplementary material referenced by the author in this book is available to
readers on GitHub. For more detailed information, please visit http://www.apress.com/source-code.
Printed on acid-free paper
This book is dedicated to you, our readers.

Hopefully, we have saved you at least one bout of


“Why isn’t this working?”
Table of Contents
About the Authors����������������������������������������������������������������������������������������������������xv

About the Technical Reviewer�������������������������������������������������������������������������������xvii


Acknowledgments��������������������������������������������������������������������������������������������������xix

Introduction������������������������������������������������������������������������������������������������������������xxi

Part I: Getting Started������������������������������������������������������������������������������������� 1


Chapter 1: The Core Essentials��������������������������������������������������������������������������������� 3
The Essentials of AWS������������������������������������������������������������������������������������������������������������������� 3
Regions and Availability Zones������������������������������������������������������������������������������������������������ 4
The AWS Free Tier������������������������������������������������������������������������������������������������������������������� 5
Hosting Your Code – Compute Services���������������������������������������������������������������������������������� 6
Storage���������������������������������������������������������������������������������������������������������������������������������� 10
Databases������������������������������������������������������������������������������������������������������������������������������ 12
Networking���������������������������������������������������������������������������������������������������������������������������� 14
Infrastructure As Code����������������������������������������������������������������������������������������������������������� 16
Identity and Access Management����������������������������������������������������������������������������������������� 17
A Short Note for Enterprise Administrators��������������������������������������������������������������������������� 21
Introducing the AWS Management Console�������������������������������������������������������������������������������� 21
Creating a User Account for Development���������������������������������������������������������������������������������� 25
Creating the IAM User������������������������������������������������������������������������������������������������������������ 26
Signing into the AWS Management Console�������������������������������������������������������������������������� 31
Introducing Credential Profiles���������������������������������������������������������������������������������������������� 33
Summary������������������������������������������������������������������������������������������������������������������������������������ 34

v
Table of Contents

Chapter 2: AWS Tools for .NET�������������������������������������������������������������������������������� 35


Integrated Development Environment (IDE) Toolkits������������������������������������������������������������������� 35
AWS Toolkit for Visual Studio������������������������������������������������������������������������������������������������� 35
AWS Toolkit for JetBrains Rider��������������������������������������������������������������������������������������������� 44
AWS Toolkit for Visual Studio Code���������������������������������������������������������������������������������������� 51
Command-Line Tools������������������������������������������������������������������������������������������������������������������� 56
AWS Extensions for .NET CLI������������������������������������������������������������������������������������������������� 56
AWS Tools for PowerShell������������������������������������������������������������������������������������������������������ 59
AWS SDK for .NET����������������������������������������������������������������������������������������������������������������������� 68
Summary������������������������������������������������������������������������������������������������������������������������������������ 77

Chapter 3: Additional Tools������������������������������������������������������������������������������������� 79


AWS Command Line Interface (AWS CLI)������������������������������������������������������������������������������������ 79
AWS CloudFormation������������������������������������������������������������������������������������������������������������������ 83
Using the Console for Creating CloudFormation Stacks�������������������������������������������������������� 85
Using the AWS Toolkit for Visual Studio for Creating CloudFormation Stacks����������������������� 91
AWS CloudFormation Project in Visual Studio����������������������������������������������������������������������� 95
Deleting CloudFormation Stacks������������������������������������������������������������������������������������������� 97
AWS Cloud Development Kit������������������������������������������������������������������������������������������������������� 99
Understanding the CDK��������������������������������������������������������������������������������������������������������� 99
Using the CDK���������������������������������������������������������������������������������������������������������������������� 100
AWS Serverless Application Model (SAM) CLI��������������������������������������������������������������������������� 108
AWS Cloud9������������������������������������������������������������������������������������������������������������������������������� 116
Summary���������������������������������������������������������������������������������������������������������������������������������� 118

Part II: Hosting Your Applications��������������������������������������������������������������� 119


Chapter 4: Virtual Machines��������������������������������������������������������������������������������� 121
Virtual Machines and EC2��������������������������������������������������������������������������������������������������������� 121
When Should You Consider EC2?���������������������������������������������������������������������������������������������� 124
Key Components of EC2������������������������������������������������������������������������������������������������������������ 124
Amazon Machine Images (AMIs)����������������������������������������������������������������������������������������� 124
Storage�������������������������������������������������������������������������������������������������������������������������������� 132

vi
Table of Contents

Controlling Access with Security Groups����������������������������������������������������������������������������� 136


Customizing an Instance on Creation���������������������������������������������������������������������������������� 139
Instance Role and Permissions������������������������������������������������������������������������������������������� 141
Creating and Configuring an EC2 Instance������������������������������������������������������������������������������� 150
Connecting to the Instance with the Management Console������������������������������������������������ 157
Remote Desktop Connections to Windows Instances���������������������������������������������������������� 159
Deleting the Instances��������������������������������������������������������������������������������������������������������� 165
Summary���������������������������������������������������������������������������������������������������������������������������������� 166

Chapter 5: Containers������������������������������������������������������������������������������������������� 167


Explaining Containers��������������������������������������������������������������������������������������������������������������� 167
Docker��������������������������������������������������������������������������������������������������������������������������������� 170
Container Image������������������������������������������������������������������������������������������������������������������ 171
Container Registries������������������������������������������������������������������������������������������������������������ 172
Example Container File�������������������������������������������������������������������������������������������������������� 174
Immutability������������������������������������������������������������������������������������������������������������������������� 177
Amazon Elastic Container Registry (ECR)��������������������������������������������������������������������������������� 178
Pull Through Cache Repositories����������������������������������������������������������������������������������������� 181
Other Approaches for Creating an ECR Repo����������������������������������������������������������������������� 183
Amazon Elastic Container Service (ECS)����������������������������������������������������������������������������������� 189
Amazon Elastic Kubernetes Service (EKS)�������������������������������������������������������������������������������� 192
Kubernetes�������������������������������������������������������������������������������������������������������������������������� 192
Kubernetes with Amazon EKS��������������������������������������������������������������������������������������������� 195
AWS Fargate����������������������������������������������������������������������������������������������������������������������������� 197
AWS App Runner����������������������������������������������������������������������������������������������������������������������� 199
What Container Offering Should Be Used?������������������������������������������������������������������������������� 208

Chapter 6: Serverless������������������������������������������������������������������������������������������� 209


Levels of Compute Abstraction������������������������������������������������������������������������������������������������� 210
Serverless Compute with AWS Lambda������������������������������������������������������������������������������������ 211
Your Function’s Compute Environment�������������������������������������������������������������������������������� 211
Event-Driven Compute��������������������������������������������������������������������������������������������������������� 212

vii
Table of Contents

Long-Term Support (LTS) vs. Non-LTS Runtimes����������������������������������������������������������������� 213


Tooling – dotnet CLI, SAM CLI, Visual Studio, Visual Studio Code, or
JetBrains Rider? Oh my…��������������������������������������������������������������������������������������������������� 214
Serverless Functions���������������������������������������������������������������������������������������������������������������� 215
Installing the Tools��������������������������������������������������������������������������������������������������������������� 215
Creating a Serverless Function������������������������������������������������������������������������������������������� 216
Writing the Function������������������������������������������������������������������������������������������������������������ 220
Deploying the Function�������������������������������������������������������������������������������������������������������� 224
Updating the Function Permissions������������������������������������������������������������������������������������� 230
Invoking (Running) the Function������������������������������������������������������������������������������������������ 232
Debugging��������������������������������������������������������������������������������������������������������������������������� 235
The Mock Lambda Test Tool and Asynchronous Functions�������������������������������������������������� 237
Cleaning Up������������������������������������������������������������������������������������������������������������������������� 239
Serverless Applications������������������������������������������������������������������������������������������������������������� 239
Installing the Tools��������������������������������������������������������������������������������������������������������������� 240
Creating a Serverless Application���������������������������������������������������������������������������������������� 241
Writing the Application�������������������������������������������������������������������������������������������������������� 242
Deploying the Application���������������������������������������������������������������������������������������������������� 248
Running the Application������������������������������������������������������������������������������������������������������ 251
Debugging��������������������������������������������������������������������������������������������������������������������������� 253
Cleaning Up������������������������������������������������������������������������������������������������������������������������� 257
Choosing Between dotnet CLI Extensions and SAM CLI������������������������������������������������������������ 257
Using Non-LTS .NET Runtimes�������������������������������������������������������������������������������������������������� 258
Custom Runtimes���������������������������������������������������������������������������������������������������������������� 258
Container Images���������������������������������������������������������������������������������������������������������������� 261
Summary���������������������������������������������������������������������������������������������������������������������������������� 265

Part III: Storing Your Data��������������������������������������������������������������������������� 267


Chapter 7: S3 Object Storage�������������������������������������������������������������������������������� 269
Object Storage in S3����������������������������������������������������������������������������������������������������������������� 269
Public or Private?���������������������������������������������������������������������������������������������������������������� 270
Object Versions�������������������������������������������������������������������������������������������������������������������� 272

viii
Table of Contents

Object Metadata������������������������������������������������������������������������������������������������������������������ 276


Storage Classes������������������������������������������������������������������������������������������������������������������� 277
Reading and Writing Objects����������������������������������������������������������������������������������������������������� 280
Get and Put Object��������������������������������������������������������������������������������������������������������������� 281
Multipart Upload������������������������������������������������������������������������������������������������������������������ 284
The Transfer Utility��������������������������������������������������������������������������������������������������������������� 287
Presigned URLs������������������������������������������������������������������������������������������������������������������� 290
CDNs and Amazon CloudFront�������������������������������������������������������������������������������������������������� 293
Using S3 and CloudFront with Your Application������������������������������������������������������������������� 294
Summary���������������������������������������������������������������������������������������������������������������������������������� 301

Chapter 8: Microsoft SQL Server�������������������������������������������������������������������������� 303


Unmanaged SQL Server on EC2������������������������������������������������������������������������������������������������ 303
Microsoft SQL Server Licensing Limitations on EC2������������������������������������������������������������ 304
Using SQL Server on EC2����������������������������������������������������������������������������������������������������� 306
Managed Services, SQL Server on Amazon RDS���������������������������������������������������������������������� 315
Making an RDS SQL Server Instance Accessible from Outside the VPC������������������������������ 323
Connect Your Application to a SQL Server Database on RDS���������������������������������������������������� 326
More About Using SQL Server on AWS�������������������������������������������������������������������������������������� 328

Chapter 9: Other RDS Databases�������������������������������������������������������������������������� 331


MySQL��������������������������������������������������������������������������������������������������������������������������������������� 332
MySQL and .NET������������������������������������������������������������������������������������������������������������������ 332
Setting Up a MySQL Database on Amazon RDS������������������������������������������������������������������� 333
MariaDB������������������������������������������������������������������������������������������������������������������������������������ 336
MariaDB and .NET��������������������������������������������������������������������������������������������������������������� 337
Setting Up a MariaDB Database on Amazon RDS���������������������������������������������������������������� 337
Selecting Between MySQL and MariaDB����������������������������������������������������������������������������� 340
PostgreSQL������������������������������������������������������������������������������������������������������������������������������� 340
PostgreSQL and .NET����������������������������������������������������������������������������������������������������������� 341
Setting Up a PostgreSQL Database on Amazon RDS����������������������������������������������������������� 342
Selecting Between PostgreSQL and MySQL/MariaDB��������������������������������������������������������� 345

ix
Table of Contents

Amazon Aurora�������������������������������������������������������������������������������������������������������������������������� 346


Creating an Amazon Aurora Database in RDS��������������������������������������������������������������������� 347
Amazon Aurora and .NET����������������������������������������������������������������������������������������������������� 351
Oracle���������������������������������������������������������������������������������������������������������������������������������������� 352
Oracle and .NET������������������������������������������������������������������������������������������������������������������� 352
Setting Up an Oracle Database on Amazon RDS����������������������������������������������������������������� 356
Summary���������������������������������������������������������������������������������������������������������������������������������� 360

Chapter 10: NoSQL Databases and AWS��������������������������������������������������������������� 361


Explaining NoSQL Databases���������������������������������������������������������������������������������������������������� 361
CAP Theorem����������������������������������������������������������������������������������������������������������������������� 362
Data Storage Design������������������������������������������������������������������������������������������������������������ 363
Different Types of NoSQL Databases����������������������������������������������������������������������������������� 365
Deciding Between Relational and NoSQL���������������������������������������������������������������������������� 371
Amazon DocumentDB��������������������������������������������������������������������������������������������������������������� 371
MongoDB����������������������������������������������������������������������������������������������������������������������������� 372
Setting Up a DocumentDB Database����������������������������������������������������������������������������������� 373
DocumentDB and .NET�������������������������������������������������������������������������������������������������������� 375
Amazon DynamoDB������������������������������������������������������������������������������������������������������������������� 379
Setting Up a DynamoDB Database�������������������������������������������������������������������������������������� 379
DynamoDB and AWS Toolkit for Visual Studio��������������������������������������������������������������������� 384
DynamoDB and .NET������������������������������������������������������������������������������������������������������������ 385
Summary���������������������������������������������������������������������������������������������������������������������������������� 390

Chapter 11: Purpose-Built Databases������������������������������������������������������������������ 391


Why Purpose-Built Databases Exist������������������������������������������������������������������������������������������ 391
In-Memory Databases��������������������������������������������������������������������������������������������������������������� 392
Amazon ElastiCache������������������������������������������������������������������������������������������������������������ 395
Amazon MemoryDB for Redis���������������������������������������������������������������������������������������������� 401
Time-Series Databases������������������������������������������������������������������������������������������������������������� 402
Amazon Timestream������������������������������������������������������������������������������������������������������������ 403
.NET and Amazon Timestream��������������������������������������������������������������������������������������������� 405

x
Table of Contents

Ledger Databases��������������������������������������������������������������������������������������������������������������������� 411


Amazon QLDB���������������������������������������������������������������������������������������������������������������������� 412
.NET and Amazon QLDB������������������������������������������������������������������������������������������������������� 413
Graph Databases����������������������������������������������������������������������������������������������������������������������� 419
Amazon Neptune����������������������������������������������������������������������������������������������������������������� 420
.NET and Amazon Neptune�������������������������������������������������������������������������������������������������� 423
Summary���������������������������������������������������������������������������������������������������������������������������������� 427

Part IV: Moving Existing Apps to AWS�������������������������������������������������������� 429


Chapter 12: Moving to Virtual Machines�������������������������������������������������������������� 431
Virtual Machine Services on AWS��������������������������������������������������������������������������������������������� 431
Introducing AWS Elastic Beanstalk������������������������������������������������������������������������������������������� 432
Elastic Beanstalk and .NET�������������������������������������������������������������������������������������������������� 433
Packaging Applications for Deployment������������������������������������������������������������������������������ 434
Deploying ASP.NET Applications������������������������������������������������������������������������������������������ 435
Deploying ASP.NET Core Applications���������������������������������������������������������������������������������� 443
Using Publish to AWS to Deploy to Elastic Beanstalk���������������������������������������������������������� 444
Customizing the Virtual Machines��������������������������������������������������������������������������������������� 449
Deploying to Elastic Beanstalk from Azure DevOps������������������������������������������������������������� 455
A (Short) Word About HTTPS and Elastic Beanstalk������������������������������������������������������������� 457
Deploying to Amazon EC2 Instances����������������������������������������������������������������������������������������� 458
Introducing AWS CodeDeploy���������������������������������������������������������������������������������������������� 459
Working with CodeDeploy��������������������������������������������������������������������������������������������������� 461
Summary���������������������������������������������������������������������������������������������������������������������������������� 473

Chapter 13: Containerizing����������������������������������������������������������������������������������� 475


General Requirements�������������������������������������������������������������������������������������������������������������� 475
Containers and Networking������������������������������������������������������������������������������������������������������ 476
Amazon ECS������������������������������������������������������������������������������������������������������������������������ 476
Amazon EKS������������������������������������������������������������������������������������������������������������������������ 480

xi
Table of Contents

Containerizing a .NET Framework 4.x Application�������������������������������������������������������������������� 482


Using Visual Studio�������������������������������������������������������������������������������������������������������������� 483
Containerizing Manually������������������������������������������������������������������������������������������������������ 489
Containerizing a .NET Core–Based Application������������������������������������������������������������������������� 492
Using Visual Studio�������������������������������������������������������������������������������������������������������������� 492
Using JetBrains Rider���������������������������������������������������������������������������������������������������������� 492
Containerizing a Running Application��������������������������������������������������������������������������������������� 493
What Is AWS App2Container?���������������������������������������������������������������������������������������������� 494
Using AWS App2Container to Containerize an Application�������������������������������������������������� 496
Deploying New Container Using AWS App2Container���������������������������������������������������������� 501
Summary���������������������������������������������������������������������������������������������������������������������������������� 507

Chapter 14: Migrating Your Data�������������������������������������������������������������������������� 509


AWS Database Migration Service��������������������������������������������������������������������������������������������� 509
How Does It Work?�������������������������������������������������������������������������������������������������������������� 510
Creating a Replication Instance������������������������������������������������������������������������������������������� 511
Creating Your Source and Target Endpoints������������������������������������������������������������������������ 513
Creating Your Database Migration Task������������������������������������������������������������������������������� 519
AWS Schema Conversion Tool��������������������������������������������������������������������������������������������������� 526
Configuring the Source�������������������������������������������������������������������������������������������������������� 527
Database Migration Assessment Screen����������������������������������������������������������������������������� 530
Configuring the Destination������������������������������������������������������������������������������������������������� 532
Completing the Migration���������������������������������������������������������������������������������������������������� 532
Using the New Database����������������������������������������������������������������������������������������������������������� 535
Summary���������������������������������������������������������������������������������������������������������������������������������� 537

Chapter 15: Re-platforming and Refactoring������������������������������������������������������� 539


Assistive Tools for Re-platforming and Refactoring������������������������������������������������������������������ 540
Re-platform, Then Refactor? Or Refactor, Then Re-­platform?��������������������������������������������� 540
Re-platforming to .NET������������������������������������������������������������������������������������������������������������� 541
Getting Started with the Porting Assistant for .NET������������������������������������������������������������� 541
Determining the Compatibility of Your Application�������������������������������������������������������������� 544

xii
Table of Contents

File Modifications When Porting������������������������������������������������������������������������������������������ 548


Round and Round We Go – Porting the Application������������������������������������������������������������� 551
What Did the Assistant Do for Us?��������������������������������������������������������������������������������������� 552
Refactoring to Microservices���������������������������������������������������������������������������������������������������� 554
Getting Started with the Microservice Extractor for .NET���������������������������������������������������� 555
Analyzing an Application����������������������������������������������������������������������������������������������������� 555
Visualizing an Application���������������������������������������������������������������������������������������������������� 558
Extracting a Microservice���������������������������������������������������������������������������������������������������� 560
What Did the Extractor Do for Us?��������������������������������������������������������������������������������������� 562
Summary���������������������������������������������������������������������������������������������������������������������������������� 566

Part V: Building Cloud-Native Applications������������������������������������������������ 567


Chapter 16: Events and Messaging���������������������������������������������������������������������� 569
Modern Application Design������������������������������������������������������������������������������������������������������� 569
Evolving into Microservices������������������������������������������������������������������������������������������������� 570
Deep Dive into Decoupling�������������������������������������������������������������������������������������������������� 572
Designing a Messaging or Event-Based Architecture��������������������������������������������������������������� 578
Messaging��������������������������������������������������������������������������������������������������������������������������� 578
Amazon Simple Notification Service (SNS)������������������������������������������������������������������������������� 580
Using AWS Toolkit for Visual Studio������������������������������������������������������������������������������������� 582
Using the Console���������������������������������������������������������������������������������������������������������������� 587
.NET and Amazon SNS��������������������������������������������������������������������������������������������������������� 589
Amazon EventBridge����������������������������������������������������������������������������������������������������������������� 592
.NET and Amazon EventBridge�������������������������������������������������������������������������������������������� 593
Configuring EventBridge in the Console������������������������������������������������������������������������������ 596
Modern Event Infrastructure Creation��������������������������������������������������������������������������������������� 601
Infrastructure as Code��������������������������������������������������������������������������������������������������������� 602
In-Application Code������������������������������������������������������������������������������������������������������������� 602
Summary���������������������������������������������������������������������������������������������������������������������������������� 603

xiii
Table of Contents

Chapter 17: Monitoring and Observability������������������������������������������������������������ 605


Why Do We Want to Monitor and Observe?������������������������������������������������������������������������������� 606
Instrumenting Code������������������������������������������������������������������������������������������������������������������� 607
The X-Ray Agent������������������������������������������������������������������������������������������������������������������ 615
AWS X-Ray and .NET����������������������������������������������������������������������������������������������������������� 617
Amazon CloudWatch����������������������������������������������������������������������������������������������������������������� 623
Logging�������������������������������������������������������������������������������������������������������������������������������� 625
Metrics and Alarms������������������������������������������������������������������������������������������������������������� 631
Summary���������������������������������������������������������������������������������������������������������������������������������� 635
A Final Word������������������������������������������������������������������������������������������������������������������������������ 635

Index��������������������������������������������������������������������������������������������������������������������� 637

xiv
About the Authors
William Penberthy has over 25 years’ experience in software development (almost 17 of
which is .NET) and brings a pragmatic approach to software development. With much of
that time spent in consulting, he has worked on many different projects and used many
different designs and approaches. In 2021, he joined Unify Consulting where he works
with clients in optimizing their software development process and building distributed
systems for the cloud.

Steve Roberts is a Senior Developer Advocate for .NET and PowerShell development
at AWS. Based in Seattle, Washington, Steve worked for eight years as a Senior
Development Engineer on the AWS tools for .NET before switching focus to a developer
advocacy role. He was the development lead for the AWS Tools for PowerShell and the
AWS Tools for Azure DevOps and contributed to the AWS Toolkits for Visual Studio and
Visual Studio Code, and the AWS SDK for .NET. Prior to joining AWS, Steve had over 20
years’ experience as a developer focused on IDE tools and integrations.

xv
About the Technical Reviewer
Peter Himschoot works as a lead trainer, architect, and
strategist at U2U. He has a wide interest in software
development that includes applications for the Web,
Windows, Clean Architecture, Domain-Driven Design, and
Security. He has trained thousands of developers, is a regular
speaker at international conferences, and has been involved
in many web and mobile development projects as a software
architect. He has been a Microsoft Regional Director (from
2003 to 2019) and cofounded the Belgian Visual Studio User
Group (VISUG) in 2006, which is a group of trusted advisors
to developer and IT professional audiences and to Microsoft.

xvii
Acknowledgments
Kudos to you, the reader, for deciding to learn and try something new. Though, of
course, for those of you experienced developers, this is not something new. It’s amazing
what we, the authors, learned while writing this book – and we thought we were already
experts. For those of you that are just starting out your life in software development,
know that this is something you will need to continue to do for your entire career as this
field changes about as quickly as the water in a river.
We would also like to thank Jonathan Gennick and Jill Balzano from Apress
who had the unenviable job of herding the cats. We would also like to mention our
appreciation to Brian Beach and Peter Himschoot who had the onerous job of doing our
technical review.
Lastly, but certainly not leastly (ha – let’s see if we can get it through at least once),
is the support for our wives, Jeanine and Deb, who allowed us to spend way too much of
our free time working on this project.

xix
Introduction
Cloud computing can be thought of as a way to deliver on-demand computing services.
These computing services can be as high level as complete applications, such as
Salesforce, or as low level as storage or application processing. Access to these services
is generally through the public Internet. The concept of the cloud has taken off, and
there is research that says more than one third of all IT spending worldwide is on cloud
computing and that number will continue to grow. This book is about a piece of that
overall cloud computing pie, the combination of one of the most popular software
development frameworks, .NET, and the first and largest cloud computing provider,
Amazon Web Services (AWS).
It sounds straightforward when you look at that previous sentence until you really
start to think through what that means; it sets the expectation that we will talk about the
union of .NET functionality and AWS functionality. That is simply not possible as that
union is huge and writing about it would take several volumes and likely be out of date
before we even finished the second one. Instead, in this book, we are trying to identify
some of the most commonly identified development scenarios, and we will use those to
guide our journey.
Before we move into the juicy details of using .NET on AWS, let us first go over some
of the fundamental differences between working with a cloud service and working with
“your own servers.” There are multiple different ways in which companies manage their
“own servers.” Some lease hardware from an infrastructure or hosting provider and
are responsible for everything above the iron, including OS patches, systems drivers,
installed applications, and everything in between. If those companies want to run virtual
machines, then they have to purchase the management software and maintain that as
well. Other companies purchase the server hardware outright and thus add details like
network cards or other “pieces of metal” into the areas for which they are responsible.
Regardless of the approach that you take, your company will have some system
management responsibilities.
That does not necessarily change when you move to the cloud. However, it becomes
easier to define the responsibilities that each party has. AWS calls this definition of
responsibilities the Shared Responsibility Model. This model defines what parts of the

xxi
Introduction

overall operational burden will be owned by AWS and what parts of the burden will be
owned by the customer. This is important to consider when building your applications
as you should be building them in such a way as to help minimize the operational
burden that you, as a developer/customer, have when working with AWS services. Not
only will this minimize your operational burden, it also, oddly enough, tends to decrease
your actual cloud service cost because it allows for a much finer control over the various
areas used by your application, such as processing, memory usage, and storage. We
promise there will be more on this later when we go into the details of running your .NET
application on AWS!
We will be using a sample application through our journey. We called it
TradeYourTools, and it is a simple tool-sharing application that is designed to help
members of a neighborhood group document their available hand and electrical tools
and to provide a simple process to reserve a tool and arrange their pickup and return.
The application is starting as an ASP.NET MVC v4.6 application that uses ASP.NET
Identity for registration. It has a Microsoft SQL Server back end that stores tool data,
including pictures, user information, and any uploaded pictures. It works but be warned;
it is not pretty – neither one of us claims to be a UX expert!
We will be altering this application through our journey. We are assuming that you
are an experienced .NET developer and thus will not be spending any effort talking
about the fundamentals of what we are doing. To take full advantage of the sample
application, however, requires that you have access to a .NET integrated development
environment (IDE). The most used IDE is Microsoft Visual Studio. There are several
versions of Visual Studio, each with differing sets of functionality and price points.
JetBrains offers a competing IDE, Rider, and there is always the ubiquitous Visual
Studio Code, a cross-platform IDE that also supports .NET development. Most of
the screenshots will be using Visual Studio unless we are specifically talking about a
different IDE.
You will also enhance your experience if you have access to a running SQL Server
instance so that you can work with a local, fully running application. The sample
application will come with a database creation script that will create all of the necessary
tables and relationships as well as load some sample data that will help you understand
the application and how all of the pieces go together. While this will be useful, it is by no
means required. If you must choose between an IDE and a database, choose the IDE –
you will spend more time there!

xxii
Introduction

You can download a trial version of JetBrains Rider at www.jetbrains.com/


rider/. You can download both Visual Studio and Visual Studio Code at https://
visualstudio.microsoft.com/. The Community Edition of Visual Studio is free and
is our recommended choice if you do not currently have access to a .NET IDE. You can
download Microsoft SQL Server Developer 2019, a full-featured free edition of SQL
Server that is licensed for use as a development and test database.

xxiii
PART I

Getting Started
CHAPTER 1

The Core Essentials


Getting started is always the hardest part of new systems, and AWS is no different.
Approaching the breadth of services and the functionality available in the AWS cloud
can be a daunting prospect! What services should you consider first for hosting your
application? How do terms you may be familiar with, such as virtual machines, map
to services? How do you, as a developer, authenticate to provision and work with
resources? How does your application code authenticate to be able to call AWS services?
In this chapter, we’ll look at the essentials – what you really need to know about AWS
to get started. We are not going to go particularly deep – that’s for later sections of the
book – but this chapter will give you an overview of essential services and functionality
that will be useful if you’ve never worked with AWS before. In addition to core services,
we will take our first look at the AWS Management Console and use it to set up a
“development user” identity as a recommended best practice. You’ll use this user
identity to work with AWS services, resources, and the tools (outlined in Chapters 2
and 3) during the remainder of the book.

The Essentials of AWS


AWS makes available a portfolio of over 175 services – and the portfolio continues to
grow. Let’s be honest – you are highly unlikely to make use of all the services in a single
application! There’s an old maxim – how do you eat an elephant (not that you should
of course, elephants are awesome)? The answer is – one piece at a time, and the same
applies to getting started on AWS. Once you have an initial understanding of a core set
of services and the terms you will routinely encounter working with AWS, you can then
pivot to determining how best to map them to the needs of your application.

3
© William Penberthy and Steve Roberts 2023
W. Penberthy and S. Roberts, Pro .NET on Amazon Web Services,
https://doi.org/10.1007/978-1-4842-8907-5_1
Chapter 1 The Core Essentials

Regions and Availability Zones


Let’s begin with the layout of AWS’ global infrastructure. AWS operates 24 geographic
Regions around the world (at the time of writing; more are planned). Regions are fully
isolated, and each is composed of at least two, usually three, sometimes more, isolated
and physically separate Availability Zones. Each Availability Zone (or AZ as you’ll more
commonly see them mentioned) is composed of one or more physically separated data
centers. Each data center has redundant power, networking, and high-bandwidth low-­
latency connectivity. This is different from other cloud providers who may treat a single
data center in a geographic area as a region.
Regions are identified both by name, for example, US East (N. Virginia), or US West
(Oregon), etc., and by a corresponding code. You’ll often make use of this code in your
applications. For the two regions just mentioned, US East (N. Virginia) is referred to as
us-east-1. US West (Oregon) is identified as us-west-2.
Availability Zones are identified with a combination of the parent region code and a
letter suffix – a, b, c, etc. For example, us-west-2b refers to an AZ in the US West (Oregon)
region. Your applications and the resources they consume can exist in a single AZ, or be
deployed to multiple AZs in a region for high availability. Figure 1-1 shows the logical
layout of the US West (Oregon), or us-west-2, region. Also in the figure are illustrations of
how one might choose to distribute applications (or not) across Availability Zones.

Figure 1-1. The US West (Oregon) region and zones

How does this global infrastructure benefit you? Regions and their Availability Zones
are designed to provide you the ability to run highly available, fault-tolerant applications
nearer to your customer base and to also satisfy data sovereignty laws that you may be
subject to. Running applications in a region geographically closer to users helps improve

4
Chapter 1 The Core Essentials

latency, but you can also failover to a different region if needed. Availability Zones
provide the basis of fault tolerance and scale for your applications. Assuming you’ve
made use of Availability Zones, by deploying your application to at least two AZs in a
region, a failure in a single data center – or even an entire AZ – will be transparent to
your application.
This does mean, however, that you usually need to keep this infrastructure layout
in mind when working with AWS. With very few exceptions, AWS services are regional,
meaning that resources you create in one region are not visible in the AWS Management
Console (or the various AWS tools that we’ll examine in Chapters 2 and 3) when you
are working in a different region. For now, just be aware that when you deploy your
application resources to AWS, you’ll do so in a region, and optionally across two or more
AZs if you want fault tolerance. If not, and a service does not mandate a multi-AZ setup,
then go ahead and use a single AZ to keep things simple.

The AWS Free Tier


The AWS Free Tier is a collection of offers spanning 85 products (at the time of writing)
to help when gaining experience with AWS services. Some offers in the Free Tier are
available for the first year after you create an account (and expire thereafter – so use
before you lose!); others are permanently free up to a certain amount of resource usage.
Periodically, ad hoc offers may become available during a promotional period, or after a
new service is launched. Some examples:

• AWS Lambda serverless compute: Up to 1 million requests, and


400,000 GB-seconds of compute time, per month – always free

• Amazon DynamoDB database: Up to 25GB of storage and 25


provisioned read and 25 provisioned write capacity units per month
(this is enough to handle up to 200 million requests per month) –
always free

• Amazon EC2 virtual machines: Up to 750 hours of compute on


certain instance sizes, for Windows and Linux – free for the first
12 months
• Amazon S3 storage: Up to 5GB of standard storage – free for the first
12 months

5
Chapter 1 The Core Essentials

Many other examples can be found at the Free Tier home page: https://aws.
amazon.com/free. Most of the examples in this book can be performed using offers in
the Free Tier to reduce or eliminate cost, and we will try to call out those services that
may have a charge.

Hosting Your Code – Compute Services


So you have application code to host in the cloud. But where? And using what
technology? Virtual machines (VMs)? VMs in Managed Services? Containers? Or maybe
you want to adopt a serverless approach and let AWS manage the compute infrastructure
in its entirety for you? There’s a lot of choice, so let’s quickly unpack it. In later chapters,
we’ll examine each of these areas in more detail.
First, virtual machines. Amazon Elastic Compute Cloud, or EC2 as it’s more
commonly known, is the virtual machine service on AWS. A virtual machine in EC2 is an
instance. Each instance is started from an image, known as an Amazon Machine Image,
or AMI. EC2 provides multiple “stock” images, for both Windows and multiple Linux
distributions, that you can use. These images are generally, but not always, updated
monthly to ensure they include the most recent patches and other software updates.
There are also 7,000+ images available through the AWS marketplace with each having
various software packages pre-installed. Alternatively, you can use your own images –
which can be built and snapshotted from an AWS-provided image if you so choose. You
might take this route if you have specific installation or configuration requirements and
can’t perform these actions when launching the “stock” images provided by AWS.
Once an EC2 instance is running, you are in complete control – just as with virtual
machines you might run on your own machine. You can pause (suspend), stop, or
terminate them. You can also remote into them using SSH or Remote Desktop. Figure 1-2
shows an example of some instances in various states in the AWS Management Console.

Figure 1-2. EC2 instances in the AWS Management Console


6
Chapter 1 The Core Essentials

You are responsible for keeping instances (and custom images) up to date with
patches, etc. (AWS also provides additional services that can help you do this). AWS
operates a shared responsibility model, which means that AWS protects the physical
infrastructure and network but you are responsible for the security on your resources.
How does your application get deployed onto an EC2 instance? As with the
virtual machine instance, you have complete control here too. You can write scripts to
download the application binaries and other resources and place them onto the instance
as it starts, or you can use services such as AWS CodeDeploy (among others) to perform
the deployment. In the case of CodeDeploy, you simply upload the built application
bundle and choose the instance(s) to be involved (by selecting the instance IDs, or some
other criteria such as tags or membership in a group), and CodeDeploy does the rest.
If managing running instances sounds like more work than you would like, but you
still want to retain some control, then consider services such as AWS Elastic Beanstalk or
Amazon Lightsail. Both build on top of EC2 to offer virtual machines under the hood but
abstract away some or most of the management and deployment aspects.
AWS Elastic Beanstalk is a service for deploying and scaling web applications and
services and is the fastest and simplest way to get your application up and running on
EC2 virtual machines. As a developer, your focus is on building and packaging your
application. For .NET Framework applications, you use a Web Deploy package. For
.NET Core and .NET 5+, you use dotnet publish to build the deployment package. In
both cases, you upload the bundle to AWS and instruct Elastic Beanstalk to deploy it to
the instance(s) in your application’s environment. The environment contains the EC2
instance(s) and other resources employed in hosting your application code. Elastic
Beanstalk takes care of provisioning and managing your infrastructure resources, and
handling deployments, but you can still, if you wish, work with the underlying resources.
Should you need to, and network security settings permit, it’s possible to remote into
the EC2 instances in the environment. Figure 1-3 shows an example of the resources
and their chosen configuration in a load-balanced auto-scaled Elastic Beanstalk
environment.

7
Chapter 1 The Core Essentials

Figure 1-3. Example Elastic Beanstalk environment and resources

Amazon Lightsail is another abstraction on top of EC2. Like Elastic Beanstalk,


Lightsail takes care of the provisioning of the underlying EC2 resources but takes a more
simplified view of managing them. With Elastic Beanstalk, you can tweak and adjust
almost all the settings of the underlying resources (even though the service created them
for you). With Lightsail, fewer settings are exposed, but you can still remote into the
underlying instances if needed. Offering an even more managed experience than Elastic
Beanstalk, Lightsail is ideal for simple workloads, or just getting started on AWS, but
provides the ability to “grow into” the full EC2 experience later if you need to.

8
Chapter 1 The Core Essentials

Next, we have the choice of using containers. AWS provides two container services:
Amazon Elastic Container Service (ECS) and Amazon Elastic Kubernetes Service (EKS).
In addition, each has a serverless variant known as AWS Fargate, where AWS entirely
operates the underlying container infrastructure on your behalf.
ECS runs Docker containers with no changes and supports both Windows and
Linux containers. Note, however, that if you choose to use AWS Fargate, then currently
only Linux containers are supported, so your application will need to be based on
.NET Core or .NET 5+. If your Docker images are hosted in a third-party repository,
you can still use ECS. Alternatively, you can upload your images to Amazon Elastic
Container Registry (ECR). As with EC2 virtual machines, you can take advantage of
AWS CodeDeploy to minimize downtime when updating applications by using blue/
green deployments, with full support for deployment monitoring and rollback.
If you’re using Kubernetes, then EKS will be of interest. With EKS, the Kubernetes
control plane is run across multiple AZs, and it automatically detects and replaces
unhealthy nodes. As with ECS, Windows is supported – first for worker nodes and for
scheduling Windows containers. It’s also possible to run Windows and Linux worker
nodes together in the same cluster. As you might expect, EKS manages the availability
and scalability of the control plane nodes for you, freeing you from infrastructure
management and allowing you to focus on your application code and deployment
topology. We will go deeper into the container offerings in a later chapter.
Finally, AWS offers a serverless compute service known as AWS Lambda. Lambda
enables you to run your code without provisioning or managing servers – all of that is
handled fully by AWS on your behalf. This allows you to focus entirely on your code,
which can run in response to events such as an object being created in storage, or a
request being received on a web API endpoint, and lots more (your code in Lambda can
be triggered from a variety of events across 140 AWS services). You can also configure
your code to run on a cron schedule, you can call it directly from within your own
application code, or you can even invoke functions from the command line. You might
find this latter feature useful in automation scripts, for example.

Note Lambda uses Linux as the underlying operating system host, so your code
must target .NET Core 3.1 or .NET 5+; .NET Framework is not supported for writing
Lambda functions.

9
Chapter 1 The Core Essentials

Storage
Now that you have some idea of the range of compute options available to host your
application code, let’s move on to another common need of applications – storage.
When people think of storage in conjunction with AWS, Amazon Simple Storage
Service, or S3 as it’s more commonly referred to, is usually what springs to mind. S3 is a
service for object storage in the cloud. We use the term “object storage” to distinguish it
from “file storage” – it’s important to know that S3 is not a file system so it doesn’t have a
“real” directory structure or well-defined metadata such as the file name and date it was
last modified. Obviously, it can store files, but as far as S3 is concerned, objects are just
opaque blobs of data of varying lengths. To work effectively with S3, the key elements to
understand are buckets, objects, and keys.
Buckets are the top-level organizational unit and are URL addressable – this means
that buckets must conform to DNS name rules and, most importantly, they must have a
globally unique name. If I have a bucket named myapplicationbucket in my account,
you cannot have another bucket with the same name in your account.
Objects exist solely within buckets and represent the data you want to store. Objects
can be any size up to 5 terabytes currently. You can add metadata tags to objects, as well
as various types of access controls. Furthermore, it’s possible to add life cycle policies to
objects. One example of this would be a policy where older or less frequently accessed
objects are automatically moved to different storage classes to take advantage of lower
pricing.
A key is used to identify the different objects within a bucket. At its core, S3 is a
key-value store operating at massive scale. Keys are probably what cause most people
to think S3 is a file system when they first encounter it – object keys do in fact look like
Linux file system paths. For example, consider the following key: application.images/
frontpage/logo.jpg. Notice the / delimiter in the key – this divides the key into prefixes
that resemble, but are not, subfolders. S3 keys are a flat structure, and there is no concept
of sub-buckets or subfolders. However, using prefixes can help infer a logical structure.
In fact, the AWS Management Console and the tools we’ll meet in Chapter 2 and beyond
use the prefixes to emulate a file system when working with S3. Figure 1-4 shows an
example of object keys and prefixes in a bucket (note too that the console uses the term
“Folder” for a prefix).

10
Another random document with
no related content on Scribd:
Jo pian ehti Mikko köyhiin kotinsa lämpöiseen suojaan, siellä
kohtasi hän rakkaan vaimonsa ahkerassa työssä ja pienen poikansa
terveenä ja iloisena. Se häntä vähiin suretti, ett'ei hänellä ollut
tuomisiksi sen enempää; mutta nähdessään, miten iloinen ja
tyytyväinen vaimonsa oli, haihtui surut kokonaan.

Heti läksi Mikko Pekan asunnolle. Surullinen näkö kohtasi häntä


siellä: Pekka oli hänen poissa ollessaan tullut yhä huonommaksi ja
makasi melkein tunnotonna, ja vaimo istui vuoteen vieressä täynnä
tuskaa ja toivottomuutta; ilo ja leikillisyys oli Pekan hauskasta kodista
kadonnut ja sijaan astunut synkkä murhe.

Ystävällisesti ojensi Mikko heille pakkasessa kylmettyneen


kätensä. Sairas koetti sitä tavoitella: "ei minulla enää taidakkaan olla
monta päivää elettävänä; mitenkä sitten vaimoni ja lapseni käynee?"
sanoi hän.

"Älkäämme toivottomuuteen vaipuko!" sanoi Mikko.


"Kaupungeissa käydessäni kävin erään hyväksi tunnetun lääkärin
luona; hänelle kun juttelin tautisi laadun, antoi hän minulle lääkkeitä
ja sanoi: 'mies ehkä paranee, jahka vaan käytetään nämät lääkkeet
neuvoni mukaan!'"

"Tässä on myös vähän parempaa ravintoa sairaalle", sanoi Mikko


ojentain Maijalle pienen mytyn. "Käyttäkää sitä säästävästi, sillä
enpä nyt tiedä, mistä toista saada."

Mikon lähdettyä puhkesi Maija itkemään; häntä kovin liikutti


tuollainen ansaitsematon ystävyys, eikä hän nyt osannut muuta kuin
rukoilla Jumalaa palkitsemaan Mikolle vaivojaan.

Jättäen naapurinsa hyvään toivoon, lähti Mikko kotiansa.


Kun hän ehti porstuaan, kuului sisältä pojan ääni sanovan: "Eipä
isä tuonutkaan makeeta kakkoo."

"Ei ollut tehtynä", kuului toinen ääni.

"Miks'ei isä tuo hyvää leipää, en minä saa tätä syödyksi", kuului
taas lapsen itkevä soperrus.

"Isä ei saa", kuului silloin toinenkin itkevä ääni.

Mikon käsi jähmettyi oven ripaan. Ensi kerran kävi hänen mielensä
synkäksi, toivottomaksi: hän ei parhaalla tahdollaankaan voinut
hankkia edes kunnollista leipää rakkaille omaisillensa, tämä koski
kovasti hänen lempeään, vaikka lujaan mieleensä.

Hän avasi oven ja istui tuskan valtaamana rahille lakan viereen.


Kaikki toivo oli häneltä kadonnut, ajatuksensa seisahtunut. Hän näki
edessään vaan kurjuutta ja kyyneleitä, eikä tuon kurjuuden takaa
haamoittanut yhtäkään valon pilkkua.

Kiireesti pyyhki Kerttu kyyneleet silmistänsä, mutta kovinpa hän


hämmästyi nähdessään miehensä epätoivoisin katsein tuijottavan
laattiaan. Köyhyyttä, huonoa ravintoa ja raskasta työtä voi Mikko
kyllä kestää; mutta kuullessaan itkevän sen, jota enin maailmassa
rakasti, ja luullessaan häntä onnettomaksi, tunsi hän sydämmensä
murtuvan.

Mutta löytyi yksi olento, joka voi Mikkoa epätoivossaan lohduttaa:


rakastavan naisen lumoovalla voimalla tarttui Kerttu miehensä
vapiseviin käsiin, puhuen lempeällä äänellä:

"Ah, Mikko, sinä et saa suruun vaipua, olethan meille kaikki


kaikessa, vielä taistelkaamme, vielä toivokaamme, kenties saamme
vielä parempia päiviä."

Vähitellen palasi Mikon kasvoille entinen vakavuus, hän silmäili


taas rohkeasti ympärillensä. "Kerttuseni", hän sanoi "minä kuulin
sinun itkevän, luulin sinua kokonaan onnettomaksi, ja se oli viedä
järkeni."

"Onneton en ole niin kauvan, kuin sinä olet minulla", sanoi Kerttu,
"mutta sitä itkin, kun sinulla on niin paljo huolta, ett'ei yön lepoa!"

Kahden on raskaampikin taakka keveä kantaa, toisin sitä vastoin


käy siinä, missä toinen yhä lisää painoa kuormaan, siinä on
vahvimmankin sortuminen.

Mikko oli saanut entisen rohkeutensa; hän lepäsi yönsä


rauhallisna. Aamulla varhain oli hän taas liikkeellä, otti pyssyn
olallensa, sukset seinältä jalkainsa alle ja läksi metsälle hiihtämään.

Metso istui kuusen oksalla aamuisen kuun valossa rauhallisna,


pelotonna. Ympärillä vallitsi tyyni talven kolkkous. Ainoastaan
pakkasen vaikutuksesta tuontuostakin syntyvä räiske puitten oksissa
häiritsi kuoleman kaltaista hiljaisuutta. Se oli niin tavallista, siihen oli
metso tottunut. Mutta mikä lienee tuo kummallinen, suhiseva ääni?
Metso kurottaa kaulaansa ja ääntää "ko, ko, koko!" Outo ääni lakkaa
kuulumasta, multa metso on rauhaton ja katselee ympärillensä.
Viimein keksii hän läheisen puun juurella jotakin outoa mustaa, hän
levittää siipensä lentoon. Samassa kuuluu kimeä paukaus, ja metsän
poika makaa kuolleena maassa. Tyytyväisenä pistää metsämies
saaliinsa laukkuun ja rientää edelleen.

Näin osoitteli Mikko metsän läpi kohti kartanoa, metsästys onnistui


tänä aamuna harvinaisen hyvin. Linnut, jotka koko syystalven olivat
kadoksissa, näyttivät palanneen takaisin. Mikko tiesi herra
patruunalta saavansa linnuistaan hyvät hinnat; senpä tähden
liukuivatkin sukset niin liukkaasti, sentähden silmät olivat niin tarkat
ja käsi vakava.

Kartanossa kertoili Mikko heidän tukalista oloistaan ja Pekan


sairaudesta. Siitä alkaen sai hän aina apua työtä vastaan ja
muutenkin. Uusi kevät toi mukanaan parempia päiviä.

Lääkäri ei Mikolle ollut turhia jutellut, kun arveli Pekan paranevan,


sillä ruvettuaan lääkkeitä käyttämään, rupesi hän vähitellen
paranemaankin. Kevätpuolla oli Pekka jo niin voimistunut, että voi
jättää sängyn; hän oli nyt aivan terve, mutta vielä kovin voimaton.
Mikolla ja Maijalla oli täysi työ pitäessään häntä alallaan, kunnes
ehtisi voimistua; hän tahtoi uhallakin työhön ryhtyä.

"Onpa sitä jo kylläkin tullut maattua", tuumaili Pekka, "jos ei tuolla


makaamisella jaksa, niin sitten ei jaksa ollenkaan!" Kerran hän,
vaimonsa kielloista huolimatta, sieppasi kirveen olallensa ja lähti
metsälle. Hän oli nyt jo mielestään kyllin voimakas ja terve, mutta
tuokion matkan päässä loppuivatkin hänen voimansa niin, ett'ei hän
voinutkaan palata kotia.

Kosk'ei miestä kuulunut, tuli Maija pian levottomaksi ja läksi


käymään hänen jälkiänsä myöten metsään. Vähän matkaa käytyään
näkikin hän Pekan istumassa kuusen juurella, allensa oli hän
karsinut vähäisen havuja; siinä istui mies levollisena, veitsellään
närhien jotakin lusikan tapaista.

Hieno hymy ilmestyi Pekan kuulille nähtyään vaimonsa; "mitä


muorilla nyt metsään on asiaa?" sanoi hän.
"Ei mitään liikoja", vastasi Maija, aikoen kääntyä takaisin.

Pekka silloin huutamaan: "äläs jätä, autas minuakin täältä pois,


näethän, että on minulla raskas työ tämän lusikan kanssa, olen niin
kovin väsynyt!"

"Mitäs tänne tulit, kun kielsin", torui Maija, "ole täällä nyt susien
syöttönä!"

"Äläs nyt sentään niin kova ole, ettäs minun tänne susille jätät;
mistäs sitten luulet miehen saavas," jutteli Pekka.

Taluttaen miestään kädestä käveli Maija, ehtimiseen toruen: "kyllä


ne nyt hukkaan meni koko paranemisen toiveet; kyllä siitä taas saat
maata vuoteen omana!"

"Olehan nyt", vastaa Pekka, "kun kerran kotia pääsen, kyllä siellä
pysynkin!"

Suven tullen tointui Pekka entiselleen ja ryhtyi taas töihin ja


toimiin.

Kovimmat ajat olivat nyt ohitse. Tosin kävi halla edeskinpäin


vieraana, mutta usiasti jätti hän torppareille jotakin korjattavaa;
kovina aikoina olivat he oppineet säästäväisiksi, ja niin tulivat he
hyvin toimeen.

Kertomuksemme aikoina ovat he jo päässeet jommoiseenkin


varallisuuteen: ankaralla työnteolla ovat he saaneet kokoon niin
paljon, että ovat hankkineet hevosen, jolla voivat maansa muokata ja
muut tarpeelliset ajotyöt toimittaa. Hevonen on oikeastaan Mikon,
vaikka sitä molemmat yhtäläisesti käyttävät; tamma on nyt
toisellaisessa kunnossa kuin Pekan ennen aikoin.
Rauhallinen mieli ja tyytyväisyys vähään ovat ne ominaisuudet,
jotka torppareilla on perintönä kuluneista kovista ajoista. He ovat
oppineet luottamaan Jumalaan ja omain kättensä voimaan, ja se luja
ystävyys, joka vallitsee heidän välillään, on vahvistunut niinä aikoina,
jolloin elämän raskaat huolet liittivät heidän tavallista lujemmin
toisiinsa.

*****

Siirrymme tämän poikkeuksen jälkeen taas kertomukseemme.

Aamulla varhain Juhannuksen jälkeisenä päivänä, olivat miehet


jalkeilla; yksissä lähtivät he kartanoon työhön. Aurinko ei ollut vielä
noussut, kun he lykkäsivät veneen vesille; aikaisin piti uutis-
asukkaan olla liikkeellä, jos mieli ehtiä oikeaan aikaan kartanoon.
Auringon ensi säteet tervehtivät takamaan miehiä heidän järvellä
soutaissaan; he paljastivat päänsä ja pian kaikui vahvat aamuvirren
säveleet Ruuhkajärven tyyneellä pinnalla.

"Muistui taas mieleeni", sanoi sen jälkeen Pekka, "minne lienee


joutunut tuo kartanon nuori herra! Sepäs oli hauska poika, se!
Monesti hän minulle sanoi: älkääpäs nyt, Pekka, noin huoliko työtä
hosua; istutaan tähän ja jutellaan vähän, tehkööt isot miehet työtä!"
Niin se poika sanoi, ja sitten iltasella oli hänellä aina meille
antamista. "Pekka tarvitsee, hän puhui enemmän kuin muut."

"Ja Mikko tarvitsee, hän teki työtä enemmän kuin muut! Nyt on
hän ollut kaksi vuotta poissa; sanotaan hänen käyvän koulua, mutta
mitä varten? Olisipa hän jo herra muutenkin?"

"Ainahan niiden herrain pitää koulua käydä", sanoi Mikko, "multa


nytpä lieneekin Alpert herra kotona, nyt on kesälupa. Mennä vuonna
oleskeli hän kesän jossakin enonsa luona, mutta eilen puhui
Vuorelan Matti, että hän nyt on kotona."

"Souda sitten veikkonen", sanoi Pekka iloissaan, "minä niin


mielelläni tahtoisin nähdä sitä hauskaa poikaa, millaiseksi lie
muuttunut, mahtaneeko jo olla ylpeä niinkuin muutkin herrat?"

"Mielelläni minäkin häntä näkisin", sanoi Mikko; "viime suvena kun


hänen pikimmältään näin, antoi hän minulle tuon hauskan kirjan,
'Kultalan kylän', jonka Kalle nyt ulkoa osaa, ja kun hän näki, että
mieleni oli hyvä, kysyi hän: 'pidättekö kirjallisuudesta?' Kun minä
sanoin pitäväni kirjoista ja sanoin, että poikanikin on halukas
lukemaan, lupasi hän toisella kertaa tuoda enemmän."

"Ja varmaankin hän tuo", tokaisi Pekka, ja rupesi rallittamaan


jonkummoista tahtia, käyttäen airojaan sen mukaan. Tässä
tohussaan hän joskus ryöpäytti vettä Mikon silmille, ja kun tämä
häntä siitä muistutti, nauroi hän vaan. "Ei tee haittaa, vaikka hiukan
virutankin poskias. Tosin et enää ole nuori mies, mutta täytyyhän
kuitenkin näyttää vähän pulskilta, ettei luultaisi metsän poikain
nälkää näkevän!"

Samassa tölmäsi vene rantaan ja miehet läksivät astumaan.

Toisen päivän illalla istuivat Kerttu ja Maija Mikon torpalla, pihassa


koivun alla. He olivat toimittaneet päivän askareet ja istuivat nyt
vartoen miehiä kotia tulemaan.

Jopa kuuluikin Pekan iloinen vihellys peltotieltä ja kohta astuivat


miehet pihaan.
"Vielähän täälläkin eletään", sanoi Pekka, "ja vielä näin myöhään
valveella. Ja sinäkin, pikku Miinaseni", sanoi hän tytölle, joka kiipesi
hänen kaulaansa; "eikö sinun jo, lapseni, unikaan ole?"

"Tässä on sinulle, Kalle, jotakin, jota voitte yhdessä Miinan kanssa


käyttää", sanoi Mikko, vetäen povestaan vähäisen mytyn.

"Kirjoja, äiti, kirjoja", huudahti Kalle, hypäten kohoksi ilosta, "mistä


olet, isä, saanut kirjoja?"

"Kartanon nuori herra nämät antoi, toivoen, että sinusta tulisi


kunnon mies, ja lupasi itsekin tulla sinua katsomaan tänä kesänä",
sanoi Mikko.

Kalle tahtoi kohta ruveta lukemaan kirjojaan. Hän ei ymmärtänyt,


miksi hänen täytyisi maata, eipä hänen ollut unikaan! Mutta levolle
hänen täytyi kumminkin ruveta, vaan sittenkin näki hän unta uusista
kauniista kirjoista, hän puhui unissaan ja oli levoton.

Ennen auringon nousua oli Kalle valveilla lukemassa. Ei hän


muistanut suurusta eikä huomannut ajan kulua, yhäti hän vaan luki.
Nuoressa pojassa oli aikaisin herännyt opin halu, se oli hänen
luonteensa; paha vaan, että oli syntynyt asemaan, joka ei oikeastaan
hänelle sopinut.

Pekka ei voinut kylliksi ylistellä tuota kartanon nuorta herraa;


sehän nyt vasta oli ystävällinen mies! "Heti aamulla tuli hän pellolle",
kertoili Pekka, "ystävällisesti puristi hän työmiesten savisia käsiä;
huomasipa hän viimein minunkin vähä-arvoisen ja niin hän puristi
kättäni, että olin nurin kaatua. 'Mitenkäs nyt metsän pojat jaksavat?'
hän kysyi, ja minä vastasin: 'hyvin! siellä saadaan nyt jo viljaakin,
ettei tarvitse muuta kuin syödä vaan.' Mikon kanssa juttelivat he
kauan, ja kun Mikko ilmoitti ilonsa siitä, että herrasmieskin pitää
köyhää torpparia ihmisenä ja kansalaisena, erosi hän meistä
nähtävästi liikutettuna. Hän lupasi joskus tulla katsomaan meidän
asunnoltamme, saa nähdä tuleeko?"

Näin puhui Pekka myöhään yöhön, siksi kuin uni viimeinkin lopetti
keskustelun.

Eräänä kauniina Elokuun päivänä soutelee kolme miestä ja


vähäinen poika isonlaisella veneellä Ruuhkajärven pintaa. Veneessä
on raippoja, nuoria ja koukkuja, näyttävät olevan kalastamassa,
ongella. Tässä on vanhat tuttavamme Mikko ja Pekka, sekä Kalle
poika; yksi nähtävästi on herrasmies, nuoruuden kukoistuksessa.
Hän on kohtalaisen pitkä, vaaleanverevä, kaunis nuorukainen,
katsanto vilkas ja tulinen, mutta samalla iloinen ja lempeä. Hyvin hän
näyttää viihtyvän tässä seurassa; hän nauraa ja juttelee miesten
kanssa, ja opettaa värsyjä Kalle pojalle.

"Tuhat tulimmainen! eipä minun onkeeni tule mitään", sanoo herra


toisinaan, ja nykäisee maltittomasti onkeansa.

"Ei, ei sillä tavalla", sanoo Pekka, "onkija ei saa olla maltiton,


antakaas korjaan vähän syöttiä! no, eiköhän nyt tule?"

Tulipa jo herrankin onkeen kelpo kala, mutta tottumaton kun hän


oli, ja maltiton, lentikin kala yli veneen.

"Oh! ei niin rajusti," sanoi Pekka, "mutta näin", lisää hän ja


samassa lompsahti kala veneesen.

Pekka oli nyt oikein omassa elementissään; onkiminen oli hänen


oikiata mielityötään, vaikka hän harvoin joutui sitä tekemään. Nyt oli
kartanon nuori herra tullut veneitten kanssa kalastelemaan, käskenyt
hänen ja Mikon kanssaan ja sanonut sillä tulevan tämänviikkoiset
veropäivät tehdyksi. Kas, sepä vasta hauskaa, saada istua
päiväkauden ongella ja kuitenkin tuli päivätyö tehtyä!

"Jos vielä tässä tällä tavoin nostelemme kaloja jonkun aikaa, niin
pian rupee käymään kuin kaimamiehen Kristuksen aikaan; mutta
näkyyhän tuolla Suonpään Wilppukin ruuhinensa, kyllä se auttaa",
jutteli Pekka.

"Mikä Suonpään Wilppu", kysyi Alpert herra. "Olen ennenkin


kuullut kerrottavan jostakin Wilpusta."

"Se Suonpään vaari, meidän aikakautemme suurin profeetta, se,


joka ennen nuorempana, kun häntä lukemaan tahdottiin, tuumi:
'järjellisen ihmisen ei tarvitse tehdä tuommoisia herrojen temppuja,
paljon parempi on mennä järvelle ja vetää muutama ahven
syödäkseen!'"

"Eikö siis mies ole koskaan lukenut?" kysyi Alpert herra.

"Eipä sanottavasti. Nuoruutensa aikana ei hän millään ehdolla


ottanut kirjaa käteensä; 'ei vaikka joka perjantai aidanseipääsen
hirtettäisiin', sanoi hän. Mutta tutustuipa hän aikaa voittain erään
vanhan piian kanssa ja silloin rupesi hänen mielensä tekemään
naimiseen, mutta eipä se ollut mahdollista, piti ensin olla ripillä käypä
mies. Silloin tapahtui kummia: Wilppu rupesi käymään lukukoulua
morsiamensa luona ja niin pitkälle kävi, että pääsi ripille ja sai
vaimon. Mutta pian kuoli vaimo ja Wilppu heitti lukemiset,
lukukinkerit ja ripillä käymiset sikseen, ja sitten tuli hänestä
profeetta."
"Olisipa hauska nähdä tuota omituista miestä," sanoi Alpert.

"Kyllä kai," sanoi Pekka, "mutta ei se ole niin vallan helppoa, sillä
teidän laatuisia miehiä hän ei kärsi; kuitenkin jos teillä on tupakkaa,
niin taitaa tuo olla mahdollista!"

"Olisihan mulla sikaria, jos se auttaisi?"

Sillä välin oli synkkiä pilviä kokoontunut taivaalle, ilma kävi


tukahuttavan kuumaksi, hyönteiset surisivat ja salama leikitteli pilven
partaalla.

"Ukkosenilma lähenee", sanoi Mikko, "koettakaamme päästä


aikanaan suojaan!"

"Ja niinkö jää meidän tuttavuutemme Wilpun kanssa?" sanoi


Alpert.
"Koettakaamme saada ukkoa mukaan!"

"Sehän olisikin paras!" He käänsivät veneensä kotirantaan päin ja


soutivat kiirettä vauhtia; ilma kävi hämäräksi ja ukkonen jyrisi
pilvissä.

Alpertherra kertoili Kallelle maista, kansoista ja kaupungeista ja


Kalle kuulteli tuskin hengittäin; hän piti herraa jonakin korkeampana
olentona ja jokainen sana painui hänen muistiinsa niinkuin lukittu.

Ukko Wilppu istui ruuhessaan synkän näköisenä ja mutisi:


"tuhannen pirua! olis tässä ollut jommoinenkin kalan saalis, mutta
siihen hän nyt taas tuli kolistelemaan." Samassa kiiti vene lähelle ja
laineet häiläyttivät ukon ruuhta. "Riivatun mustatakit", ärjäsi hän,
"kaadattehan ruuhenikin tuolla mokomalla laivallanne, olisihan teillä
ollut vettä soutaa edempääkin!"
"Mutta asia onkin semmoinen", alkoi Pekka, "että aikomuksemme
oli teitä pyytää kanssamme juttelemaan, ja tupakoimaan, koska nyt
on tulossa raju ilmakin!"

"Raju-ilmako? tuskinpa", mumisi Wilppu, "no eihän tuo olisi


niinkään hullua, tunti sinne tai tänne!"

"Tulkaa mukaan kaikin mokomin," huusi Mikko veneen kulkiessa


rantaa kohden.

"Tulenko mukaan, kyllä kai, eihän tuon ole niin kiirettä", mumisi
Wilppu. "Tupakoimaan, sanoi Pekka; niin kyllä, eihän olisi
hullumpaa.
Mistä lienevät veneesensä saaneet tuommoisen herra rentun? Kyllä
miesparat on huonoilla teillä!"

Rantaan kun ehtivät, tuntui jo muutamia voimakkaita tuulen


puuskia, kuului kovia jyräyksiä, tipahteli yksinäisiä vesipisaroitakin.
Mikko katsoi järvelle: "totta tosiaan, Wilppu kääntää ruuhtaan tänne
käsin!"

"Mutta miten hänen käy?" sanoi Alpertti, "voihan myrsky viedä


miehen ruuhineen päivineen!"

"Ei hätää", sanoi Pekka, "kyllä Wilppu ruuhensa ohjaa, vaikka


koskesta alas."

Matkalla jutteli Alpertti Kallelle ukkosesta ja ukontulista, ja Kalle


kuulteli, niin ett'ei tällä kertaa muistanut ensinkään pelätä ukkosen
jyrinää. Kun ehdittiin Mikon asunnolle, puhkesi raju-ilma täyteen
vauhtiinsa: tuuli lennätteli kuivaa multaa ja lastuja ympäri peltoa,
ankarat jyräykset tärisyttivät maata ja sormenpään kokoisia
vesipisaroita alkoi tippua. Pian oli ilma yhtenä vesivirtana, hetkessä
syntyi pihalle isoja vesilammikoita ja pieniä puroja, jotka kuljettivat
myötäänsä kaikenlaisia rikkoja. Silloin näkyi pihassa läpi vesitulvan
mies vakavana käyskelevän huonetta kohden.

"Herran tähden", huudahti Kerttu, "kuka tuolla ulkona kävelee


tuollaisessa ilmassa?"

"Wilppuhan se on", sanoi Pekka, "mitähän nyt ukko sanonee


tuosta liotuksesta?"

Samassa astui ovesta sisälle kummallisen näköinen olento: Pitkät


vanuneet hiukset, jotka tuskin kymmeneen vuoteen olivat saksia tai
kampaa nähneet, riippuivat pitkinä suortuvina niskassa ja jokaisesta
suortuvasta juoksi vähäinen vesivirta. Pitkä, likainen mekko kahisi ja
rapisi kuin tuohi, ryppyiset kasvot olivat vääntyneet entistäkin
ankarampaan muotoon. Hän seisoi oven suussa, pitkä vartalo
köyristyneenä, puristellen sanaa sanomatta vettä pois ryysyistänsä.

"Mitäs Wilppu siellä niin oven suussa seisoo?", sanoi Mikko,


"tulkaa tänne peränpuoleen istumaan! Onhan siellä oikein ankara
Jumalan ilma!"

"Mitä! Jumalan ilmako?", sanoi ukko suuttuneena ylellisestä


kastumisesta. "Siellähän on oikein peijakkaan ilma, järvellä se jo
minun saavutti ja heitteli ruuhtani niinkuin lastua, en parhaallakaan
soutamisella tahtonut päästä rantaan! Suutuinpa tuosta viimein,
lakkasin soutamasta ja tuumasin: vieköön nyt koko purtilon järven
pohjaan! Kun sitten hiukan manasin, hellitti ilma siksi, että pääsin
maalle. Ilmassa on häijyt henget valloillaan, ne siellä jyskii, hakkaa ja
kolistelee, että huono ihminen henkeänsä pelkää!"
"Puhuttehan nyt vähän jumalattomasti, Wilppu", muistutti Kerttu.

"Minäkö jumalattomasti? Olenhan minä jo siksi mies, etten rupea


tässä ristissä käsin siunailemaan! Mutta uskottekos", jatkoi Wilppu ja
oikasi vartalonsa suoraksi, "uskottekos, että minä, vaikka vaan
tämmöinen äijä, voin lakkauttaa tuon riivatun jytinän ja jyskeen!"

"Kyllähän tuo on uskottavaa," sanoi Pekka, "mutta huolisimmeko


tuosta! Olemmehan täällä sateen suojassa, annetaan pitää peliänsä
niin kauan kuin tahtoo!"

Mikko sillä välin haki tupakat ja tarjosi Wilpulle. Nyt rupesi ukko
koperoimaan housunsa taskuja ja löysi siellä mustan, varrettoman
nysän; sitte haki hän tulukset ja monen vaikean kokeen perästä sai
hän viimein palavan taulapalan piippunsa päälle. Vähitellen rupesi
ankaruus katoamaan ukon kasvoista, hän istui tyytyväisenä,
poltellen nysäänsä, ja unhottain raju-ilmat ja muut vastukset.

Ukkosen vähän lakattua, laittoi Kerttu puolisen, pulskimman, mitä


tässä torpassa ennen oli nautittu, ja miehet istuivat syömään.
Kutsuttiinpa nyt Wilppuakin, mutta siinäpä oli työ, ennenkuin hän
saatiin tulemaan. "Hän ei muka ollut mikään nälkäinen, eikä hän
tarvinnut täällä syödä." Mutta Mikko selitti, että muuten vaan heidän
mieliksi, ja haki kaapista pullon, joka siellä oli monta vuotta seisonut,
mutta joka sentään sisälti niin kirkasta ainetta. Hän kehoitti Wilppua
siitä ensin ottamaan kaulan kasteeksi ja sitte haukkaamaan palaa
päälle. Ja nyt loppui ukon vastustusvoima; hän kulautti pullosta kelpo
lailla ja sitten näytti, ettei hän ruokapöydän ääressä ollut mikään
poika.

Pekka kiitteli Wilpun ennustustaitoa: "nythän oli jo rukiit leikattu ja


pian suvilaihotkin valmistuivat, eikä hallaa vielä ollut!" — Ja Wilppu
vakuutti tuhannen hiiden nimeen, ett'ei hallaa tule ennen Mikon
päivää!

Ukko oli hyvillään, näin ystävällisiä kohtelua oli hänelle tuskin


koskaan osoitettu. Hän oli köyhä, hänen leipänsä oli melkein pelkkää
vehkaa ja petäjäistä, mutta mitään pahempaa oi hänelle voinut
sanoa kuin köyhä; siitä hän suuttui silmittömästi, ja sanoja sai varoa,
ettei joutunut hänen karhunkäpälöihinsä.

Miesten aterioidessa astui sisälle Pekan vaimo, nähtävästi pahalla


tuulella. "Sitä miestä," sanoi hän, "ei tule kotia, olemme peljänneet
itsemme hulluksi, tuota ankaraa ilmaa!"

"Mitäs huolitte peljätä," sanoi Pekka.

"Mitäs huolitte!" tiuskaisi Maiju ja pyörähti ovelle; siinä hän kääntyi


ja kysyi nauraen, "tulikos paljonkin kaloja tänäpänä?"

"Ei kaloja paljon, mutta sen runsaammin krapuja!" ilvehti Pekka.

Maiju ei tuosta enää pahastunut. Käsi oven rivassa jutteli hän


vasta asiansa ja pyysi kalastajia kaiken mokomin heille illalliselle, ja
pian hän taas mennä hyppeli pitkin märkää polkua.

Päivällisen jälkeen paistoi päivä taas kirkkaasti ja kalastajat olivat


valmiit järvelle lähtemään. Kuiva maa ahmasi halukkaasti pienet
vesilätäköt, ilma tuntui raittiilta ja virkistävältä, syöpäläisetkin olivat
kadonneet. Wilppu seurasi kalastajia ja oli oikein hyvillään tuosta
ystävällisestä kohtelusta, jota täällä oli saanut nauttia.

Toisen päivän iltapuolella hankki Alpertti pois lähtöä Ruuhkajärven


takamailta. Hän sanoi, että nämät päivät oli olleet hauskimpia hänen
elämässään.
Torpparit palasivat taas raskaisin töihinsä, jatkamaan taisteluansa
kovaa luontoa vastaan. Nyt oli tämä taistelu kuitenkin jo voiton
taistelua ja palkinto saatavissa. — Alpertti palasi taas kartanoon,
elämään, seurustelemaan hienommissa piireissä; mutta yhäti
muistuivat hänelle mieleen köyhät torpparit Ruuhkajärven takana,
nuot lempeät, ystävälliset ihmiset, jotka taistellessaan nurjaa, kovaa
luontoa vastaan, kuitenkin olivat niin iloiset ja tyytyväiset, ja joissa
kaiken yksinkertaisuuden keskellä oli niin paljo rehellisyyttä ja hyviä
avuja. Mutta ennen kaikkia muisti hän nuorta Kallea, jolla oli niin
hyvä ymmärrys ja ääretön tiedonhalu, ja hän päätti hoitaa tuota
lahjakasta poikaa, lähettämällä hänelle kirjallisuutta minkä voi.

Suuremman vaikutuksen teki Alpertin kalastusretki Kalle poikaan,


se herätti hänessä tunteita, jotka sitten vaikuttivat koko hänen
tulevaiseen elämäänsä.

*****

Ummelleen kuusi vuotta on kulunut ajasta, jolloin kertomuksemme


alkaa. Nyt on juhannuksen päivä, niinkuin silloinkin; luonto on nytkin
viehättävän kaunis ja vene kiitää nytkin pitkin Ruuhkajärven pintaa.
Veneessä soutajat ovat muuttuneet: Kalle, joka silloin tuskin jaksoi
airoa häilyttää, soutaa nyt vankasti, voimakkaasti. Hän on oikein
jättiläinen ikäisekseen, pitkä, solakka, likimain kolme kyynärää. Koko
hänen olennossaan ja kaikissa liikkeissä näkyy vakavuus, jommoista
harvoin tavataan sillä ijällä; ja kuitenkin todistaa hänen katseensa ja
kasvonsa juonteet, että tulinen sydän asuu tuon vakavan ulkokuoren
alla. Joskus luo Kalle lempeän silmäyksen vastapäätä istuvaan
tyttöön, joka häntä muistuttelee kaikenmoisilla pilapuheilla. Tyttö on
suloinen hempukka, vaikka ei mikään erinomainen kaunotar;
lyhyenläntä, suora ja notkea kuin nuori vesa; kasvot täyteläiset,
terveyttä osoittavat; iloiset sinisilmät säihkyvät; vilkkaasti siirtyy katse
esineestä toiseen.

"Annappas, Kalle, minulle kirjasi, sinä sen kastelet pilalle,


soutaissasi tuolla tavoin", sanoo tyttö hymyssä huulin.

"Etpäs ottanut rannalla, kun olisin antanut!"

"Mitäs tuosta, olin silloin vähän suutuksissa, kun en saanutkaan


kirjaa; mutta kun nyt oikein ajattelun asiaa, niin huomaan, ett'en
minä sitä ansaitsekaan! Ihme kun pääsin yhdellä vuodella, minä kun
olen niin vähän lukenut; mutta ompa äiti minua niin paljon
lukemisesta torunut, että jo paljaastaan silläkin oppi jotain."

"Hulluja puhut, pääsithän kiitoksella ja olitkin parhaimpia lukijoita!"

"Kissa kiitoksella elää! mutta eipä sekään ansiosta tullut! Vaan


annathan kirjasi minulle, että taidat vapaammin soutaa. Niin ne nyt
taas loppui, nuot hauskat päivät, jolloin saimme olla pitäjällä ihmisten
seurassa ja nähdä vähän muutakin, kuin vaan kiviä ja kantoja,
metsätölliläisen ainaisia ja ainoita tuttavia!"

"Minä en välitä pitäjästä enkä näkemisistä", sanoi Kalle


innostuneena, "minulla ei ole mitään rakkaampaa kuin kotiseutuni
metsät ja sen armaat asukkaat; siellä tahtoisin ikäni elää ja
työskennellä vanhempaini ja naapurieni seurassa ja sitte iltasella
istua jonkun tuttavan kiven luona, lukien kirjaa ja kuunnella lintuin
laulun, lehdon huminaa ja puron lirinää. Siinä on minulle kylliksi!"

"Mikä hulluus! istua yökaudet metsässä kirjain kanssa, olisipa


sekin huvia! Minä tahtoisin olla kylissä ja kartanoissa, lauleskella
tyttöin kanssa ja tanssia iltasilla! Se olisi jotakin toista!"
Kallen posket hehkuivat, rinta aaltoili rajusti, hän puhui melkein
värähtelevällä äänellä: "Kylissä ja kartanoissa! minä en tuota tahdo!
Ja kuitenkin tunkeutuu joskus rinnastani ääni: pois avaraan
maailmaan! toimimaan, työskentelemään kansasi eduksi! En tiedä
mitä tekisin, mitä toimittaisin? mutta rakkauteni kotiseutuuni ja
vanhempiini sitoo minua. En voi täältä lähteä; enkä sitä tahdokkaan!"

Tänäpänä ovat ystävämme ensi kerran nauttineet Herran pyhää


ehtoollista. Kallis, muistorikas on heille tämä päivä. Tänäpänä ovat
he eronneet ystävistä, jotka suven kululla ovat tulleet heille rakkaiksi,
mutta joita tästälähin harvoin kohtaavat. Kirja, joka nyt on Miinan
polvella, on lahja Kallelle, hyvästä taidosta ja hiljaisesta käytöksestä.

Ja tuskinpa lieneekään kukaan ollut niin halukas kuuntelemaan


vanhan kirkkoherran neuvoja ja opetuksia kuin Kalle; sillä kaikki,
mikä oli opettavaista, miellytti häntä. Alpert herran toimesta oli
Kallella kirjoja jommoinenkin joukko; niitä hän luki yhä uudestaan,
siksi kuin osasi ne melkein ulkoa, ja tämä lukeminen kehitti hänen
hyviä luonnonlahjojaan ja herätti mietteitä hänen tunnokkaassa
mielessään.

Toisia luonnetta oli Miina, hänkin teräväpäinen, mutta vallaton


letukka; aina oli hänellä joku sukkeluus mielessä ja opetuksesta hän
piti vähän väliä. Rippikoulua piti hän huviretkenä; siellä kului häneltä
päivä hupaisesti nuorten kumppanien seurassa. Hyvä lukija hän oli,
mutta se oli melkein yksinomaan vanhempain ansio; hän luki
pakosta eikä omasta halusta. Hänen luonteessaan oli joku määrä
kevytmielisyyttä, jota ei kasvatuksellakaan osattu poistaa; hän oli
hyväsydämminen ja hellä, mutta samassa leikillinen ja vallaton.

Tällaisiksi olivat ystävämme varttuneet; nuorena olivat heidän


ruumiinsa ja henkensä voimat kehittyneet, että nyt olivat täydessä
nuoruuden kukoistuksessa.

Takamaan torpparit olivat tänäpänä päättäneet pitää pienet pidot


omassa piirissään, muistoksi lapsillensa tästä heille merkillisestä
päivästä. Edellisenä iltana oli Mikon asunnolle laitettu suuri, kukilla ja
tuoreilla ruohoilla koristettu lehtimaja, sinne oli tuotu pöytä ja
pöydälle laitettu herkkuja, jommoisia torpissa ei ollut ennen nähty.
Nyt oli uusi, kirkas kahvipannukin ensi kerran saanut kylkeänsä
lämmittää Ruuhkajärven takana.

Majan penkeillä istuivat molempain torppain asukkaat, vartoen


nuoria kirkkomatkalta tulevaksi. Varsin vähän ovat tuttavamme
muuttuneet kuuden vuoden kululla, ainoastaan Kerttu näyttää entistä
vaaleammalla.

"Iloistapa ja hauskaa on meillä!" sanoi Pekka, "täällähän elämme


kuin ruhtinaat hovissaan ja pidämme pitoja kuin parhaat pohatat! No,
ei moittia sovi, vasta nämät nyt ovat ensimmäiset pitomme, eikä
nytkään ole koossa suuri väen paljous! Mutta kukas olisi vuosia
kymmenen takaperin uskonut, että täällä joskus näinkään
elettäisiin?"

"Herra on siunannut työmme", vastasi Mikko.

"Niinpä niin, kyllä se niin on. Mutta totta se, vaikka minulle
tarjottaisiin talo töllipahastani, niin tuskinpa vaihtaisin!"

"Oma käsiala on rakasta", sanoi Mikko.

"Niinpä se on", jatkoi Pekka, "ja mikäs meidän eläissä? Ei mistään


puutetta, eikä kenenkään käskettävänä; kukas olisi tallirenki nahjun
luullut pääsevän tuommoiseen asemaan!"
"Vaan", lisäsi hän, "tuskin se olisikaan ollut mahdollista; mutta oli
minulla ystävä, joka neuvoi ja auttoi minua! Ilman ystävätäni ei olisi
minulla torppaa, eikä sen tuonusta, vaan kenties olisin aikaa
maannut maan mullassa!"

Pekan näin jutellessa astuivat Kalle ja Miina lehtimajaan, Kalle


edellä, kirja kainalossa, ja Miina perässä, iloisesti hyppien.
Nähtyään, miten täällä oli laitettu, jäivät nuoret sanattomina
seisomaan.

"Tulkaa tänne lapset", sanoi Mikko, "olemme tahtoneet teitä


ilahuttaa, laittamalla yhtä ja toista, tänä teille niin merkillisenä
päivänä. Pysykää rehellisinä kaikissa elämän kohdissa, turvatkaa
Jumalaan, kovimpanakin surun hetkenä, niin ette ikänä häpeään
joudu! Tämän olen oppinut elämiini koulussa!"

Kalle laski pöydälle lahjaksi saadun raamattunsa ja sitten


rupesivat he tyytyväisinä ja iloisina nauttimaan juhla-ateriaansa.
Päivällisen pääteltyä avasi Kalle uuden raamattunsa ja luki siitä
monioita lukuja. Sitten otti Mikko virsikirjan, ja nyt kaikui kuusi-
ääninen veisuu, raikkaassa kesä-ilmassa. Näin vietettiin
Ruuhkajärven takana Juhannuksen iltapuolta.

Ilta läheni, veisuu taukosi ja naapurit erosivat iltatoimituksillensa.


Varjot pitenivät, auringon valo oli kadottanut kuumuutensa, suloinen
lemu kukkivasta ruisvainiosta täytti ympäristön ilman.

Kalle otti kirjan käteensä ja meni lempipaikalleen järven rannalle;


siellä vietti hän monta hetkeä lukien ja mietiskellen. Ihastellen loi
nuorukainen katseensa yli järven peilikirkkaan pinnan, jossa kalat
hyppelivät ja mulauttelivat vettä pieniin laineisin.

Вам также может понравиться