-
Notifications
You must be signed in to change notification settings - Fork 0
Create a Lambda function, a HTTP API and deploy the Identity API
Before creating the Lambda function, create a IAM (Identity and Access Management) role to enable the function to execute in the VPC that was created.
Create a new role in IAM with the following settings:
- Search IAM and select Roles in the left menu
- Click Create Role and enter the following details:
- Type of trusted entity - AWS service
- Service or use case - Lambda and click Next
- Permissions policies - Select AWSLambdaVPCAccessExecutionRole and click Next
- Role name - (Enter a role name)
- Click Create role
After the role has been added, a Lambda function should be created.
Create a Lambda function with the following settings:
- Search Lambda
- Click Create function and enter the following details:
- Select the option Author from scratch
- Function name - identity
- Runtime - Select .NET 6 (C#/PowerShell).
- Click Change default execution role then Use an existing role and select the IAM role created.
- Click Advanced settings and select Enable VPC. Then enter the following details:
- VPC - Select the VPC created
- Subnets - Select the private subnet
- Security groups - Select the default VPC security group
- Click Create function
- In runtime settings, change the handler to IdentityWebAPI
Then create a Http API in API Gateway with following:
- Search API Gateway
- Click Build under HTTP API
- Click the Add integration button and enter the following details:
- Select Lambda
- AWS Region - (default).
- Lambda function - Select the lambda function created
- Version - Select 2.0
- API name - identity and click Next
- Configure routes:
- Method - ANY
- Resource path - /{proxy+}
- Integration target - Select the lambda created and click Next.
- Configure stages - Development and click Next.
- Click Create
Finally, deploy the API cloned from the IdentityWebApi Repository in the Lambda function.
-
Add the RDS connection string of the instance of Installation of DB with the server instance, database name, user id, and password to
appsettings.json
andeformsettings.json
files-
ConnectionDB key in
IdentityWebApi/IdentityWebApi/appsettings.json
-
ConnectionDB key in
IdentityWebApi/EntityORM/eformsettings.json
E.g.: Data Source = [Server name]; Initial Catalog = IdentityPM; User ID = [userid]; Password = [Password]
-
-
In a command prompt go to the project root in the local system and navigate to
IdentityWebApi\IdentityWebApi
and run the following command to publish the APIdotnet publish -c Release --self-contained false -r linux-x64 -o publish
-
In the file explorer, go to the project's root and navigate to
IdentityWebApi\IdentityWebApi\publish
folder -
Select all the items and zip the items
-
Go to the lambda function and in Upload from combo box choose .zip file and choose the zip file that was created