Más contenido relacionado La actualidad más candente (20) Similar a Containerizing Legacy .NET Workloads (CON348-R1) - AWS re:Invent 2018 (20) Más de Amazon Web Services (20) Containerizing Legacy .NET Workloads (CON348-R1) - AWS re:Invent 20182. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Containerizing Legacy .NET
Workloads
Nicki Klein
Sr. Technical Evangelist
Amazon Web Services
Brian Lewis
Sr. Solutions Architect
Amazon Web Services
C O N 3 4 8
3. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Containerize a Legacy ASP.NET app
Deploying a .NET app
container to Amazon
Elastic Container
Service (Amazon ECS)
Hypervisor
Status:on
Connections Connections Connections
Network Up/NetworkDown
Amazon
ECS
AZ1 AZ2
Private Subnet
Public Subnet
Internet
Gateway
Private Subnet
Public Subnet
NAT
GATEWAY
NAT
GATEWAY
ALB
Amazon ECS Cluster
What we will cover
4. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Recent AWS .NET related announcements
• .NET Developer Center (aws.amazon.com/net)—7/2
• .NET Core 2.1 on Amazon Linux and Ubuntu—7/13
• .NET Core 2.1 on AWS Lambda—7/19
• .NET Global Tools—9/10
• PowerShell for Lambda—9/11
• .NET CDK – 9/13
5. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Windows deployment modes
6. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
.Net 4.x requires server core
Server 2016 version 1803—server core:
•1.58GB, download size, 30% reduction from Windows Server, version 1709
•3.61GB, on disk size, 20% reduction from Windows Server, version 1709
Server version Size on disk
Server 2016 – Server Core ~ 8 Gig
Serve 2016 version 1709 – Server Core ~4.5 Gig
Server 2016 version 1803 - Server Core: ~ 3.6 Gig
7. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Benefits of Windows containers
• Ease of movement (on-prem or in public cloud)
• Improve operating system utilization/density
• Development/Deployment runtime consistency
• Deployment size and speed/use of base images
• Server boot times under 1 second
8. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
What’s our sample .NET app?
• Sample app circa 2010
• ASP.NET MVC 1.0
• SQL Server Express LocalDB
https://github.com/kneekey23/NerdDinner
NerdDinner
9. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
WinNat network mode
• Similar to bridge mode on Linux
• Container have private IP address only accessible from the host
• Cannot access exposed ports via localhost
10. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Demo:
Containerize a legacy
ASP.NET appHypervisor
Status:on
Connections Connections Connections
Network Up/NetworkDown
Amazon
ECS
11. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Microsoft SQL server in a container
Production SQL server container images must be pulled from the Docker
store
• docker pull microsoft/mssql-server-windows
• docker pull microsoft/mssql-server-linux:2017-latest
For persistent SQL data:
• Use data volume containers
• Store the database on a file share (SMB 3.2 suggested)
• Mount a host directory as data volume (Linux)
12. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Volumes for Windows containers
• Basic volumes work
• Mounting folders—only for folders on the same drive where containers layers are stored
• Plugins for volume not yet supported
13. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Demo:
Containerizing
Microsoft SQL serverHypervisor
Status:on
Connections Connections Connections
Network Up/NetworkDown
Amazon
ECS
14. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Storing images in Amazon Elastic Container Registry
(Amazon ECR)
• Amazon ECR Credential Helper for Docker to simplify authentication
• Microsoft base layers are not pushed to Amazon ECR by default
• Compresses image size by 85-90% before storing in Amazon ECR
15. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Steps to containerize the legacy .NET app
16. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Best practice:
When building your application, build it in a disposable container and
publish in new containers. This will keep the size of your production
containers down and reduce the attack surface of the containers.
17. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Amazon ECS for Windows Server 2016
• Dec 5, 2017—Windows Server containers for
production workloads!
• ECS-optimized Windows Server 2016 AMI
• Includes Docker 17.06 Enterprise Edition
• Amazon ECS agent now runs as a native Windows
service
• Windows containers memory and CPU limit(s)
enforcement
• PowerShell module can be use to configure
Amazon ECS agent
• By default, logs are stored in the Windows Event
Viewer
Windows Server on Amazon ECS:
18. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Amazon ECS for Windows Server 2016
• Reference architecture on GitHub
Step 1. Build ECS cluster
https://github.com/aws-samples/ecs-
refarch-cloudformation-windows
19. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Amazon ECS for Windows Server 2016
Step 2. Create task definition
20. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Task definitions for Windows containers
• Most task definition fields of Linux containers work on Windows containers as well
• Some task definition fields need changes to Windows specifics such as volume path
• Network mode—only WinNAT mode is supported
• Container links are not supported
• Ulimits field is not supported
21. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Amazon ECS for Windows Server 2016
• Service name
• Number of tasks
• Elastic Load Balancing
AWS Identity and
Access Management
(IAM) role
Step 3.
Create service & launch
22. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Amazon ECS
AZ1 AZ2
Private Subnet
Public Subnet
Internet
Gateway
Private Subnet
Public Subnet
NAT
GATEWAY
NAT
GATEWAY
ALB
Amazon ECS Cluster
Demo:
23. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Amazon ECS
24. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Next steps: After you migrate your app
Modernizing your .NET apps
• Rewriting the application is always the cleanest path
• Windows containers offer another option
Use Docker to take a feature-driven approach to breaking up the monolithic
application, splitting the functionality across multiple containers and using Docker
for the plumbing. Use .NET core to extend the application.
25. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
AWS Container Competency—Just announced
• APN partners with this designation have a
validated product or solution on AWS that
supports workloads on containers
• These solutions improve customer's ability to
leverage containers on AWS
• Focus areas include:
• Foundation, orchestration, & scheduling
• Monitoring & logging
• Security
• 17 launch partners
26. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
AWS Container Competency launch partners
27. Thank you!
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Code from Demos:
https://github.com/kneekey23/NerdDinner
Nicki Klein—Technical Evangelist @nicki_23
Brian Lewis—Solutions Architect
Want to learn more on .NET and windows containers:
Break out session - WIN305 - Containerize Legacy .NET Framework Web Apps for Cloud Migration –
Tuesday 27, Nov 2018 4:00 PM – 5:00 PM – Bellagio, Level1, Grand Ballroom2
28. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.