How many ECRs do you need?

An AWS diagram showing an ECR service in a separate account, consumed by other accounts.

Depending on the size and complexity of your application you may use different strategies for grouping and securing your resources and environments.

Using multiple AWS accounts is a best practice for organizing your environments and defining clear security and billing boundaries.

Each environment requires ECR access for deployments, so the question is: do we create an ECR for each account or do we use one centralized ECR for all environments?

>>> Continue reading <<<

Deploy containerized ASP.NET apps to AWS ECS. Part I: A high-level overview

A diagram of AWS ECS deployment using Bitbucket Pipelines, ECR and CDK. The word in the middle says 'Overview'

In this series of posts, we explore everything needed to deploy and run a containerized ASP.NET application on AWS.

We’ll start by creating an AWS ECR (Elastic Container Registry) to store the docker images of our application. We’ll create a Bitbucket Pipeline to build a docker image each time we push our code and publish it to the ECR.

Next, we are going to utilize AWS CDK to define AWS resources and deploy our container to AWS ECS (Elastic Container Service).

At the end of the series, we are going to have a completely automated CI/CD pipeline to deploy our .NET web app to AWS, with the app’s infrastructure managed by CDK code.

Today, in the first part, we’ll try to understand what all these services are for and what other options for containerized web apps are there in AWS.

>>> Continue reading <<<

Bypass 2FA with Playwright .NET

playwright with 2fa

Playwright is a tool for end-to-end (e2e) browser testing. Most business logic usually requires a logged-in user, so we need to authenticate the test user from our code programmatically.

One of the challenges of automatic login in e2e testing is 2-factor authentication or 2FA. Even though it doesn’t make much sense to have 2FA enabled for test users, being able to log in with a 2FA user can be very handy sometimes.

In this article, we explore how we can utilize an authenticated browser state and manual login to bypass 2-factor authentication in our playwright tests.

>>> Continue reading <<<

My take on Moq and SponsorLink situation

moq library integration with SupportLink with 'I find it wrong' phrase

Moq is a popular .NET library primarily used for unit testing. Distributed as a NuGet package, its main purpose is to help with mocking dependencies, a technique heavily used to test small blocks of code in isolation.

To many developers’ surprise, there is a new proprietary dll included in the latest 4.20 package version. The dll contains the code of SponsorLink, a new tool developed by the Moq’s author that tries to facilitate Open Source Projects support. It does it by reading email addresses from local git configs, and although it is claimed users’ privacy is respected, many people still find this practice wrong, dubious or even borderline illegal.

>>> Continue reading <<<