public void LambdaCreateFunction() { #region create-function-1474653449931 var response = client.CreateFunction(new CreateFunctionRequest { Code = new FunctionCode { }, Description = "", FunctionName = "MyFunction", Handler = "souce_file.handler_name", // is of the form of the name of your source file and then name of your function handler MemorySize = 128, Publish = true, Role = "arn:aws:iam::123456789012:role/service-role/role-name", // replace with the actual arn of the execution role you created Runtime = "nodejs8.10", Timeout = 15, VpcConfig = new VpcConfig { } }); string codeSha256 = response.CodeSha256; long codeSize = response.CodeSize; string description = response.Description; string functionArn = response.FunctionArn; string functionName = response.FunctionName; string handler = response.Handler; string lastModified = response.LastModified; int memorySize = response.MemorySize; string role = response.Role; string runtime = response.Runtime; int timeout = response.Timeout; string version = response.Version; VpcConfigDetail vpcConfig = response.VpcConfig; #endregion }
public void LambdaCreateFunction() { #region to-create-a-function-1586492061186 var response = client.CreateFunction(new CreateFunctionRequest { Code = new FunctionCode { S3Bucket = "my-bucket-1xpuxmplzrlbh", S3Key = "function.zip" }, Description = "Process image objects from Amazon S3.", Environment = new Environment { Variables = new Dictionary <string, string> { { "BUCKET", "my-bucket-1xpuxmplzrlbh" }, { "PREFIX", "inbound" } } }, FunctionName = "my-function", Handler = "index.handler", KMSKeyArn = "arn:aws:kms:us-west-2:123456789012:key/b0844d6c-xmpl-4463-97a4-d49f50839966", MemorySize = 256, Publish = true, Role = "arn:aws:iam::123456789012:role/lambda-role", Runtime = "nodejs12.x", Tags = new Dictionary <string, string> { { "DEPARTMENT", "Assets" } }, Timeout = 15, TracingConfig = new TracingConfig { Mode = "Active" } }); string codeSha256 = response.CodeSha256; long codeSize = response.CodeSize; string description = response.Description; EnvironmentResponse environment = response.Environment; string functionArn = response.FunctionArn; string functionName = response.FunctionName; string handler = response.Handler; string kmsKeyArn = response.KMSKeyArn; string lastModified = response.LastModified; string lastUpdateStatus = response.LastUpdateStatus; int memorySize = response.MemorySize; string revisionId = response.RevisionId; string role = response.Role; string runtime = response.Runtime; string state = response.State; int timeout = response.Timeout; TracingConfigResponse tracingConfig = response.TracingConfig; string version = response.Version; #endregion }
private Amazon.Lambda.Model.CreateFunctionResponse CallAWSServiceOperation(IAmazonLambda client, Amazon.Lambda.Model.CreateFunctionRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "AWS Lambda", "CreateFunction"); try { #if DESKTOP return(client.CreateFunction(request)); #elif CORECLR return(client.CreateFunctionAsync(request).GetAwaiter().GetResult()); #else #error "Unknown build edition" #endif } catch (AmazonServiceException exc) { var webException = exc.InnerException as System.Net.WebException; if (webException != null) { throw new Exception(Utils.Common.FormatNameResolutionFailureMessage(client.Config, webException.Message), webException); } throw; } }