2

I work on a .Net Core solution in which we just added .Net Core lambdas. The newly created lambdas are all set, including the aws-lambda-tools.json.

All I have left to do is to automatically publish those lambdas using TeamCity. (Continuous deployment is already set on TC for the rest of the solution)
Also I'd rather not update a TC build step every time we add a new Lambda.

How can I setup TC to automatically publish all lambdas?
Shall I use the .Net CLI or are there any plugin to help me configure this step?

1 Answer 1

7

Finally, I opted for a very simple powershell script at the root of the solution, that deploys all the projects whose aws-lambda-tools-defaults are set:

$lambdaProfile = "aws-lambda-tools-defaults.json"

$solutionFolder = (Get-Item -Path ".\" -Verbose).FullName;
$lambdaFolders = Get-ChildItem -Path $solutionFolder -File -Recurse aws-lambda-tools-defaults*.json | ForEach-Object {$_.DirectoryName } | Select-Object  -uniq

forEach ($lambdaFolder in $lambdaFolders)
{
    Write-Output "Deploying following lambda: $lambdaFolder"
    Write-Output "with profile: $lambdaProfile"
    Set-Location $lambdaFolder
    dotnet lambda deploy-function -cfg $lambdaProfile
    Set-Location $solutionFolder
}

Then just execute this script in a specific build step on TeamCity,

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks it saved my time, but this code working locally but through teamcity its not working below is the error assumed-role/<teamcity role name> is not authorized to perform: lambda.... but can't give access to this role. Is there any way to change role while creating build?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.