In Part 3 of our serverless AWS lambda series, I’ll explain how to operationalize a solution in AWS. If you need to, you can go back to part 2 or start from the beginning.
Publishing to AWS
Deploying this code is a straightforward task: from the solution explorer in Visual Studio, right-click the solution name and select “Publish to Lambda AWS” from the menu. You’ll see the window below:
The account profile is the same profile created using the user access and secret keys. Supply a Stack Name, use “HelloWorldLambdaAPI” and finally a storage as S3 Bucket. If you’ve already created a bucket, it should be listed in the dropdown list. Otherwise, click new to create one on the fly. Name the S3 Bucket “temp-webapi-helloworld-lambda”.
It’s good to mention here that the bucket name should be unique across AWS S3 buckets. Plus, you should have all the DNS naming requirement listed below:
- Should not contain uppercase characters
- Should not contain underscores (_)
- Should be between 3 and 63 characters long
- Should not end with a dash
- Cannot contain two, adjacent periods
- Cannot contain dashes next to periods (e.g., “my-.bucket.com” and “my.-bucket” are invalid)
Click “Publish” to start the deployment. Once you see the below window, you can see the endpoint. In this case it’s https://bjg8vk47f5.execute-api.us-west-2.amazonaws.com/Prod
Also, you can easily test it in the browser, as below:
If you navigate to AWS console, you will see the deployed webapi in the S3 bucket in zip format: