A Guide to Clean Architecture and MVVM in Swift for iOS Development
Top 9 Flutter App Development Companies of 2024 – A Detailed Guide
Just a couple of weeks ago the AWS Amplify team declared its new support for backend functions. Apart from the existing support for Node.js., this new feature will help the AWS customers to write backend functions more easily by using an array of technologies such as .Net Core, Python, Go and Java. This will help them in dealing with triggers from Amazon DynamoDB and Amazon Kinesis Data Streams and requests from their REST or GraphQL APIs.
While this new support extends across a number of technologies, here we are going to explain the support for .NET Core. For Microsoft development services, this new support mechanism can bring ease of using AWS cloud platform.
In the beginning, make sure you have installed all the required tools. Let’s explain this with the below instructions.
Begin by creating an Angular application and as soon as the CLI is installed, you can build the app by using the ng command. After this run the app locally to make sure it is working fine. The CLI of the Angular framework will put all the app components within a new sub-folder called “AmplifyDotnet,”. We need to run all the command prompts from this location.
As we now have a functional front-end, it is time to add Amplify support to the project. At this time, we actually allow the previous command to run and his why for avoiding this we need a new command window and navigate this to the folder of the project. Now, we can easily initialize Amplify.
We need to run the amplify init command from the command-line prompt within the Angular project. Here you can get extensive guidance from the Amplify Documentation on the init process. When answering all the rest prompts are finished, Amplify will create an environment hosted in AWS. Now here we can easily add other backend components.
AWS Amplify offers extensive support for a number of cloud-hosted backend resources like Amazon S3 buckets, endpoints of Amazon API Gateway, AWS Lambda functions, Amazon DynamoDB tables, and several others. On the Amplify CLI all the resource types such as these are considered as categories. Each of these categories within the CLI comes with its own set of particular commands. Only for Lambda, Amplify incorporates a function category. We can use the add command for building a new function.
Read More: Is Asp.Net Core Behind The Success Of Enterprise Applications Development?
Now we will get prompts to provide information about the new function. We have to provide the name for the created resource. The name should be an easier one for human understanding so that it can allow the unique identification of the resource for the Amplify project in hand. You also need to create a name for the AWS CloudFormation stack which is used to deploy the resources.
Now you also need to create a name for the function that directly refers to the name of the deployed Lambda resource. Though you can always change it, the CLI will use the name of the resource. Oh also have to mention the runtime for your function. As this remains set to NodeJS by default, for your current project you have to change it to .NET Core 3.1.
When you are working on a practical application for real world uses, you are likely to need other AWS resources and calling other REST APIs. Only to avoid complexities in understanding, here for our example we will let the code remain just as it is.
Now, it is time to deploy the function. By just returning to the command prompt, we can easily use the amplify push command for the sake of deploying the resources of the project to the AWS environment. When the execution of the command is finished, one can easily see the full list of resources. When the change occurs you can see a prompt asking you whether you want to continue with the changes.
When the process of deployment takes place it will compile and put the .NET code into a package ready for deployment. After this within just a few minutes, the newly created Lambda function will start running the code. Just by entering the AWS console and going to the Lambda dashboard, one can easily see the newly created function. The suffix attached to the function name represents the environment the function belongs to. This convention will prevent other developers from working with Amplify environments to overwrite functions accidentally.
Now that your code is ready for deployment and the function is created properly you need to test the function execution. The testing can be carried out from within the AWS Lambda console. The only downside of this is that it may be a little time-consuming as you have to wait for the completion of each deployment before further tests can be carried out. For faster and convenient testing, you have a better Amplify mechanism. This mechanism is all about simulating the Lambda execution environment on the computer you are working on. This can be easily done if you use the mock category of AWS Amplify. Now, everything said and done, it’s time to test the function.
In this respect it is important to remember that with Amplify apart from Lambda functions, you can enjoy support for other API gateways as well. AWS Amplify also comes with extensive support to help you define API Gateway resources that are required for hosting HTTPS interfaces. Since HTTPS interfaces play an important role to allow interactions with the functions by using API categories, this Amplify support is important. These categories will help developers to determine paths of resources, invoke functions as and when such paths are used, and will allow setting configuration for the user authorization.
Here we just tried to explain the basics of AWS Amplify’s new support for creating backend functions in .NET Core 3.1. Thanks to this new runtime support, AWS Amplify customers can enjoy the ability to leverage the existing C# and .NET Core coding skills for building AWS Lambda functions. This will allow more versatility while the developers with .Net Core background can use their own coding fundamentals.
Written by Parth Patel
Parth Patel is a Microsoft Certified Solution Associate (MCSA) and DotNet Team Lead at CMARIX, a leading ASP.NET MVC Development Company. With 10+ years of extensive experience in developing enterprise grade custom softwares. Parth has been actively working on different business domains like Banking, Insurance, Fintech, Security, Healthcare etc to provide technology services.
Ready to take your business to new heights? Our team of dedicated developers is here to make your dreams a reality!
Just a couple of weeks ago the AWS Amplify team declared its […]