Recently I maintained Go code that handles various DynamoDB operations. The code was full of manually defined ExpressionAttributeValues and ExpressionAttributeNames maps. It looked cumbersome. After a quick research, I found out that AWS SDK for Go provides features that enable writing cleaner code.

In this article, I would like to share how I work with DynamoDB using AWS SDK for Go. The code snippets provided below are parts of a sample project I created to complement the article.

DynamoDB — a shift from the relational data model to a single table design concept

Before jumping to Go code, I would like to talk about DynamoDB tables design. As an experienced developer in designing relational databases…


Introduction

In October 2018 GitHub announced the launch of GitHub Actions and a year later it became generally available. GitHub Actions allows users to automate software workflows. It is a CI/CD that supports popular languages and platforms, including Node.js, Python, Java, PHP, Ruby, C/C++, .NET, Android, and iOS.

Since GitHub Actions launched, a significant amount of community-powered workflow templates and actions were created. Thus configuring a build pipeline for most of the projects can be done in a few clicks.

It is not rare when CI/CD service accesses AWS resources. For example, upload build assets to S3, invoke lambda, send notifications…


Recently I tried to invoke AWS Lambda from CLI with the event payload. It worked the day before, but it broke now. I took an example from the official documentation and invoked my function:

aws lambda invoke \
--function-name my-function \
--invocation-type DryRun \
--payload '{ "name": "Bob" }' \
response.json

The response was different from what you can find in documentation:

Invalid base64: "{ "name": "Bob" }"

Moreover, when I changed the name value to “Fred” I received a different error message:

An error occurred (InvalidRequestContentException) when calling the Invoke operation: Could not parse request body into json: Could…

AWS Lambda is a serverless compute service. It can be automatically triggered by various AWS services such as Kinesis, SQS, S3, EventBridge. Also, it can be invoked manually via CLI or HTTP API.

When called manually, the lambda handler receives input in a format defined by the developer. Thus, it’s easy to create sample payload for testing (since the developer familiar with the data structure).

When lambda invoked in response to AWS service event, then the handler receives input according to the caller service. In this case, user-defined data embedded in the event structure.

User data embed to SQS event…

Photo by Markus Spiske on Unsplash

In this article, I would like to share the techniques and tools I use to test services. I will not surprise you if I say that most of the tests I write are unit tests. Second and biggest (by volume) group of my tests - integration tests. Nothing new here, just classical Test Pyramid.

Speaking about tests it is impossible not to mention stubbing or mocking. Therefore in this article, I would like to highlight some of the test doubles generation tools available in the golang ecosystem.

I’ve created a basic service go-calc in Go, including different types of tests…


Photo by Kelly Sikkema on Unsplash

Introduction

Recently I worked on a Flutter project. I started from the UI definition. Then I extended the application with user interaction handlers and business logic rules. In no time the widget classes became polluted. Readability and reusability of the code were low. But the major problem was testing. I could not validate business rules without launching the whole application or without initialising the widgets.

After a while, I decoupled UI from the application logic. I refactored codebase to a set of widget classes, application state class, and the business rules class.


Wilsons Promontory Lightstation

Wilsons Promontory South East Circuit is approximately 58kms. This is a story of my first solo hike. It took me three days to walk the circuit. But I would advise you to add at least a day and enjoy the beauty of the local flora and fauna without rush.

About Wilsons Promontory

Wilsons Promontory is one of the most beautiful places not only in Victoria but also in Australia. The variety of hikes will suit adventurers of any type. You can set the camp in one spot and do one-day hikes from there. …


Photo by Denny Müller on Unsplash

AWS

  1. Regions news
  • AWS Directory Service for Microsoft Active Directory and AD Connector are now available in the AWS GovCloud (US) region [1].

2. Amazon EC2 now offers On-Demand capacity reservations [2]

3. Bring Your Own IP for Amazon Virtual Private Cloud is now generally available [3]

4. Amazon EKS now supports additional VPC CIDR blocks [4]

5. Amazon EFS now supports AWS VPN and inter-region VPC peering [5]

6. Amazon RDS news

  • PostgreSQL 11 is now available in Amazon RDS database preview environment [6].
  • Amazon RDS now supports MariaDB 10.3 and MySQL 8.0 [7, 8].

7. Amazon ElastiCache now supports…


Photo by Denny Müller on Unsplash

AWS

  1. Regions news
  • Amazon EC2 R5 instances are available in the Asia Pacific (Singapore) and Europe (Paris) AWS regions [1].
  • Amazon EC2 R5d instances are now available in the Asia Pacific (Singapore, Tokyo) AWS regions [1].

2. Amazon ECS-optimized Amazon Linux 2 AMI now available [2]

3. Amazon ECS CLI now supports service discovery [3]

4. Amazon Connect now supports service-linked roles [4]

A service-linked role is a new type of IAM role that allows to easily delegate permissions to AWS services. …


Photo by Denny Müller on Unsplash

AWS

  1. Regions news
  • Amazon S3 Select is now available in the AWS GovCloud (US) region [1].
  • AD Connector, part of AWS Directory Service, is now available in the US East (Ohio), US West (N. California), Asia Pacific (Mumbai), Asia Pacific (Seoul), and Canada (Central) regions [2].

2. AWS Lambda news

  • AWS Lambda enables functions that can run up to 15 minutes [3]. ⏰
  • AWS Lambda console now enables to manage and monitor serverless applications [4].

3. Amazon Databases news

  • Amazon RDS for Oracle now supports database storage size up to 32TiB [5].
  • Amazon RDS for MySQL now supports global transaction identifiers…

Anton Klimenko

Software Engineer and chef @CloudRecipesIO

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store