AWS services or capabilities described in AWS Documentation may vary by region/location. Click Getting Started with Amazon AWS to see specific differences applicable to the China (Beijing) Region.
FromMemoryStream (Default)
Publish-LMFunction-FunctionName <String>-Code_ZipFile <Byte[]>-Handler <String>-Runtime <Runtime>-Role <String>-Publish <SwitchParameter>-Architecture <String[]>-CodeSigningConfigArn <String>-ImageConfig_Command <String[]>-Description <String>-ImageConfig_EntryPoint <String[]>-FileSystemConfig <FileSystemConfig[]>-ImageConfig_IsCommandSet <Boolean>-ImageConfig_IsEntryPointSet <Boolean>-VpcConfig_IsSecurityGroupIdsSet <Boolean>-VpcConfig_IsSubnetIdsSet <Boolean>-Environment_IsVariablesSet <Boolean>-KMSKeyArn <String>-Layer <String[]>-MemorySize <Int32>-TracingConfig_Mode <TracingMode>-PackageType <PackageType>-PublishVersion <Boolean>-VpcConfig_SecurityGroupId <String[]>-EphemeralStorage_Size <Int32>-VpcConfig_SubnetId <String[]>-Tag <Hashtable>-DeadLetterConfig_TargetArn <String>-Timeout <Int32>-Environment_Variable <Hashtable>-ImageConfig_WorkingDirectory <String>-Select <String>-PassThru <SwitchParameter>-Force <SwitchParameter>FromZipFile
Publish-LMFunction-FunctionName <String>-ZipFilename <String>-Handler <String>-Runtime <Runtime>-Role <String>-Publish <SwitchParameter>-Architecture <String[]>-CodeSigningConfigArn <String>-ImageConfig_Command <String[]>-Description <String>-ImageConfig_EntryPoint <String[]>-FileSystemConfig <FileSystemConfig[]>-ImageConfig_IsCommandSet <Boolean>-ImageConfig_IsEntryPointSet <Boolean>-VpcConfig_IsSecurityGroupIdsSet <Boolean>-VpcConfig_IsSubnetIdsSet <Boolean>-Environment_IsVariablesSet <Boolean>-KMSKeyArn <String>-Layer <String[]>-MemorySize <Int32>-TracingConfig_Mode <TracingMode>-PackageType <PackageType>-PublishVersion <Boolean>-VpcConfig_SecurityGroupId <String[]>-EphemeralStorage_Size <Int32>-VpcConfig_SubnetId <String[]>-Tag <Hashtable>-DeadLetterConfig_TargetArn <String>-Timeout <Int32>-Environment_Variable <Hashtable>-ImageConfig_WorkingDirectory <String>-Select <String>-PassThru <SwitchParameter>-Force <SwitchParameter>FromS3Object
Publish-LMFunction-FunctionName <String>-Handler <String>-Runtime <Runtime>-Role <String>-Publish <SwitchParameter>-Architecture <String[]>-CodeSigningConfigArn <String>-ImageConfig_Command <String[]>-Description <String>-ImageConfig_EntryPoint <String[]>-FileSystemConfig <FileSystemConfig[]>-ImageConfig_IsCommandSet <Boolean>-ImageConfig_IsEntryPointSet <Boolean>-VpcConfig_IsSecurityGroupIdsSet <Boolean>-VpcConfig_IsSubnetIdsSet <Boolean>-Environment_IsVariablesSet <Boolean>-KMSKeyArn <String>-Layer <String[]>-MemorySize <Int32>-TracingConfig_Mode <TracingMode>-PackageType <PackageType>-PublishVersion <Boolean>-Code_S3Bucket <String>-Code_S3Key <String>-Code_S3ObjectVersion <String>-VpcConfig_SecurityGroupId <String[]>-EphemeralStorage_Size <Int32>-VpcConfig_SubnetId <String[]>-Tag <Hashtable>-DeadLetterConfig_TargetArn <String>-Timeout <Int32>-Environment_Variable <Hashtable>-ImageConfig_WorkingDirectory <String>-Select <String>-PassThru <SwitchParameter>-Force <SwitchParameter>FromImage
Publish-LMFunction-FunctionName <String>-Runtime <Runtime>-Role <String>-Publish <SwitchParameter>-Architecture <String[]>-CodeSigningConfigArn <String>-ImageConfig_Command <String[]>-Description <String>-ImageConfig_EntryPoint <String[]>-FileSystemConfig <FileSystemConfig[]>-Code_ImageUri <String>-ImageConfig_IsCommandSet <Boolean>-ImageConfig_IsEntryPointSet <Boolean>-VpcConfig_IsSecurityGroupIdsSet <Boolean>-VpcConfig_IsSubnetIdsSet <Boolean>-Environment_IsVariablesSet <Boolean>-KMSKeyArn <String>-Layer <String[]>-MemorySize <Int32>-TracingConfig_Mode <TracingMode>-PackageType <PackageType>-PublishVersion <Boolean>-VpcConfig_SecurityGroupId <String[]>-EphemeralStorage_Size <Int32>-VpcConfig_SubnetId <String[]>-Tag <Hashtable>-DeadLetterConfig_TargetArn <String>-Timeout <Int32>-Environment_Variable <Hashtable>-ImageConfig_WorkingDirectory <String>-Select <String>-PassThru <SwitchParameter>-Force <SwitchParameter>
Image
if the deployment package is a container image. For a container image, the code property must include the URI of a container image in the Amazon ECR registry. You do not need to specify the handler and runtime properties.
You set the package type to Zip
if the deployment package is a .zip file archive. For a .zip file archive, the code property specifies the location of the .zip file. You must also specify the handler and runtime properties. The code in the deployment package must be compatible with the target instruction set architecture of the function (x86-64
or arm64
). If you do not specify the architecture, the default value is x86-64
.
When you create a function, Lambda provisions an instance of the function and its supporting resources. If your function connects to a VPC, this process can take a minute or so. During this time, you can't invoke or modify the function. The State
, StateReason
, and StateReasonCode
fields in the response from GetFunctionConfiguration indicate when the function is ready to invoke. For more information, see Function States.
A function has an unpublished version, and can have published versions and aliases. The unpublished version changes when you update your function's code and configuration. A published version is a snapshot of your function code and configuration that can't be changed. An alias is a named resource that maps to a version, and can be changed to map to a different version. Use the Publish
parameter to create version 1
of your function from its initial configuration.
The other parameters let you configure version-specific and function-level settings. You can modify version-specific settings later with UpdateFunctionConfiguration. Function-level settings apply to both the unpublished and published versions of the function, and include tags (TagResource) and per-function concurrency limits (PutFunctionConcurrency).
You can use code signing if your deployment package is a .zip file archive. To enable code signing for this function, specify the ARN of a code-signing configuration. When a user attempts to deploy a code package with UpdateFunctionCode, Lambda checks that the code package has a valid signature from a trusted publisher. The code-signing configuration includes set set of signing profiles, which define the trusted publishers for this function.
If another account or an Amazon Web Services service invokes your function, use AddPermission to grant permission by creating a resource-based IAM policy. You can grant permissions at the function level, on a version, or on an alias.
To invoke your function directly, use Invoke. To invoke your function in response to events in other Amazon Web Services services, create an event source mapping (CreateEventSourceMapping), or configure a function trigger in the other service. For more information, see Invoking Functions. x86_64
. Required? | False |
Position? | Named |
Accept pipeline input? | True (ByPropertyName) |
Aliases | Architectures |
Required? | False |
Position? | Named |
Accept pipeline input? | True (ByPropertyName) |
Required? | False |
Position? | Named |
Accept pipeline input? | True (ByPropertyName) |
Aliases | BucketName, FunctionCode_S3Bucket, S3Bucket |
Required? | False |
Position? | Named |
Accept pipeline input? | True (ByPropertyName) |
Aliases | FunctionCode_S3Key, Key, S3Key |
Required? | False |
Position? | Named |
Accept pipeline input? | True (ByPropertyName) |
Aliases | FunctionCode_S3ObjectVersion, S3ObjectVersion, VersionId |
Required? | False |
Position? | 2 |
Accept pipeline input? | True (ByPropertyName) |
Aliases | ZipContent, ZipFileContent |
Required? | False |
Position? | Named |
Accept pipeline input? | True (ByPropertyName) |
Required? | False |
Position? | Named |
Accept pipeline input? | True (ByPropertyName) |
Required? | False |
Position? | Named |
Accept pipeline input? | True (ByPropertyName) |
Required? | False |
Position? | Named |
Accept pipeline input? | True (ByPropertyName) |
Required? | False |
Position? | Named |
Accept pipeline input? | True (ByPropertyName) |
Aliases | Environment_Variables |
Required? | False |
Position? | Named |
Accept pipeline input? | True (ByPropertyName) |
Required? | False |
Position? | Named |
Accept pipeline input? | True (ByPropertyName) |
Aliases | FileSystemConfigs |
Required? | False |
Position? | Named |
Accept pipeline input? | True (ByPropertyName) |
Required? | False |
Position? | 1 |
Accept pipeline input? | True (ByValue, ByPropertyName) |
Required? | False |
Position? | 3 |
Accept pipeline input? | True (ByPropertyName) |
Required? | False |
Position? | Named |
Accept pipeline input? | True (ByPropertyName) |
Required? | False |
Position? | Named |
Accept pipeline input? | True (ByPropertyName) |
Required? | False |
Position? | Named |
Accept pipeline input? | True (ByPropertyName) |
Required? | False |
Position? | Named |
Accept pipeline input? | True (ByPropertyName) |
Required? | False |
Position? | Named |
Accept pipeline input? | True (ByPropertyName) |
Required? | False |
Position? | Named |
Accept pipeline input? | True (ByPropertyName) |
Required? | False |
Position? | Named |
Accept pipeline input? | True (ByPropertyName) |
Aliases | Layers |
Required? | False |
Position? | Named |
Accept pipeline input? | True (ByPropertyName) |
Image
for container image and set Zip
for ZIP archive. Required? | False |
Position? | Named |
Accept pipeline input? | True (ByPropertyName) |
Required? | False |
Position? | Named |
Accept pipeline input? | True (ByPropertyName) |
Required? | False |
Position? | Named |
Accept pipeline input? | False |
Required? | False |
Position? | Named |
Accept pipeline input? | True (ByPropertyName) |
Required? | False |
Position? | 5 |
Accept pipeline input? | True (ByPropertyName) |
Required? | False |
Position? | 4 |
Accept pipeline input? | True (ByPropertyName) |
Required? | False |
Position? | Named |
Accept pipeline input? | True (ByPropertyName) |
Required? | False |
Position? | Named |
Accept pipeline input? | True (ByPropertyName) |
Aliases | Tags |
Required? | False |
Position? | Named |
Accept pipeline input? | True (ByPropertyName) |
Required? | False |
Position? | Named |
Accept pipeline input? | True (ByPropertyName) |
Required? | False |
Position? | Named |
Accept pipeline input? | True (ByPropertyName) |
Required? | False |
Position? | Named |
Accept pipeline input? | True (ByPropertyName) |
Required? | False |
Position? | Named |
Accept pipeline input? | True (ByPropertyName) |
Aliases | VpcConfig_SecurityGroupIds |
Required? | False |
Position? | Named |
Accept pipeline input? | True (ByPropertyName) |
Aliases | VpcConfig_SubnetIds |
Required? | True |
Position? | 2 |
Accept pipeline input? | True (ByPropertyName) |
Aliases | FunctionZip, Filename |
Required? | False |
Position? | Named |
Accept pipeline input? | True (ByPropertyName) |
Aliases | AK |
Required? | False |
Position? | Named |
Accept pipeline input? | True (ByValue, ByPropertyName) |
Required? | False |
Position? | Named |
Accept pipeline input? | True (ByPropertyName) |
Required? | False |
Position? | Named |
Accept pipeline input? | True (ByValue, ByPropertyName) |
Required? | False |
Position? | Named |
Accept pipeline input? | True (ByPropertyName) |
Aliases | AWSProfilesLocation, ProfilesLocation |
Required? | False |
Position? | Named |
Accept pipeline input? | True (ByPropertyName) |
Aliases | StoredCredentials, AWSProfileName |
Required? | False |
Position? | Named |
Accept pipeline input? | True (ByPropertyName) |
Aliases | RegionToCall |
Required? | False |
Position? | Named |
Accept pipeline input? | True (ByPropertyName) |
Aliases | SK, SecretAccessKey |
Required? | False |
Position? | Named |
Accept pipeline input? | True (ByPropertyName) |
Aliases | ST |
Publish-LMFunction -Description "My C# Lambda Function" `
-FunctionName MyFunction `
-ZipFilename .\MyFunctionBinaries.zip `
-Handler "AssemblyName::Namespace.ClassName::MethodName" `
-Role "arn:aws:iam::123456789012:role/LambdaFullExecRole" `
-Runtime dotnetcore1.0 `
-Environment_Variable @{ "envvar1"="value";"envvar2"="value" }
CodeSha256 : /NgBMd...gq71I=
CodeSize : 214784
DeadLetterConfig :
Description : My C# Lambda Function
Environment : Amazon.Lambda.Model.EnvironmentResponse
FunctionArn : arn:aws:lambda:us-west-2:123456789012:function:ToUpper
FunctionName : MyFunction
Handler : AssemblyName::Namespace.ClassName::MethodName
KMSKeyArn :
LastModified : 2016-12-29T23:50:14.207+0000
MemorySize : 128
Role : arn:aws:iam::123456789012:role/LambdaFullExecRole
Runtime : dotnetcore1.0
Timeout : 3
Version : $LATEST
VpcConfig :
This example creates a new C# (dotnetcore1.0 runtime) function named MyFunction in AWS Lambda, providing the compiled binaries for the function from a zip file on the local file system (relative or absolute paths may be used). C# Lambda functions specify the handler for the function using the designation AssemblyName::Namespace.ClassName::MethodName. You should replace the assembly name (without .dll suffix), namespace, class name and method name parts of the handler spec appropriately. The new function will have environment variables 'envvar1' and 'envvar2' set up from the provided values.
Write-S3Object -BucketName mybucket -Key MyFunctionBinaries.zip -File .\MyFunctionBinaries.zip
Publish-LMFunction -Description "My C# Lambda Function" `
-FunctionName MyFunction `
-BucketName mybucket `
-Key MyFunctionBinaries.zip `
-Handler "AssemblyName::Namespace.ClassName::MethodName" `
-Role "arn:aws:iam::123456789012:role/LambdaFullExecRole" `
-Runtime dotnetcore1.0 `
-Environment_Variable @{ "envvar1"="value";"envvar2"="value" }
This example is similar to the previous one except the function binaries are first uploaded to an Amazon S3 bucket (which must be in the same region as the intended Lambda function) and the resulting S3 object is then referenced when creating the function.
AWS Tools for PowerShell: 2.x.y.z