Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ All of the AWS Lambda configuration parameters may be set within the lambda plug
* `lambdaFunctionsJSON` JSON configuration for Lambda Functions. This is preferable configuration.
* `timeout` Defaults to 30 seconds. The amount of time in which the function is allowed to run.
* `memorySize` Defaults to 1024MB NOTE: Please review the AWS Lambda documentation on this setting as it could have an impact on your billing.
* `memorySize` Defaults to 512MB NOTE: Please review the AWS Lambda documentation on this setting as it could have an impact on your billing.
* `vpcSubnetIds` The VPC Subnets that Lambda should use to set up your VPC configuration. Format: "subnet-id (cidr-block) | az name-tag".
* `vpcSecurityGroupIds` The VPC Security Groups that Lambda should use to set up your VPC configuration. Format: "sg-id (sg-name) | name-tag". Should be configured.
* `publish` This boolean parameter can be used to request AWS Lambda to update the Lambda function and publish a version as an atomic operation. This is global for all functions and won't overwrite publish paramter in provided Lambda configuration. Setting to false will only update $LATEST.
Expand Down Expand Up @@ -115,6 +116,7 @@ Current configuration of LambdaFunction can be found in LambdaFunction.java.
"handler": "no.flowlab.lambda0::test",
"timeout": 30,
"memorySize": 512,
"ephemeralStorageSize": 512,
"keepAlive": 15,
"triggers": [
{
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
</contributors>

<properties>
<aws.version>1.12.68</aws.version>
<aws.version>1.12.698</aws.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

Expand Down
10 changes: 10 additions & 0 deletions src/main/java/com/github/seanroy/plugins/AbstractLambdaMojo.java
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,15 @@ public abstract class AbstractLambdaMojo extends AbstractMojo {
*/
@Parameter(property = "memorySize", defaultValue = "1024")
public int memorySize;
/**
* <p>
* The amount of ephemeral storage, in MB, your Lambda function is given.
* The /tmp temporary filesystem is located in this area.
* The default value is 512 MB.
* </p>
*/
@Parameter(property = "ephemeralStorageSize", defaultValue = "512")
public int ephemeralStorageSize;
/**
* <p>A list of one or more security groups IDs in your VPC.</p>
*/
Expand Down Expand Up @@ -425,6 +434,7 @@ private void initLambdaFunctionsConfiguration() throws MojoExecutionException, I
.withDescription(ofNullable(lambdaFunction.getDescription()).orElse(""))
.withTimeout(ofNullable(lambdaFunction.getTimeout()).orElse(timeout))
.withMemorySize(ofNullable(lambdaFunction.getMemorySize()).orElse(memorySize))
.withEphemeralStorageSize(ofNullable(lambdaFunction.getEphemeralStorageSize()).orElse(ephemeralStorageSize))
.withSubnetIds(ofNullable(vpcSubnetIds).orElse(new ArrayList<>()))
.withSecurityGroupsIds(ofNullable(vpcSecurityGroupIds).orElse(new ArrayList<>()))
.withVersion(version)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
import com.amazonaws.services.lambda.model.CreateFunctionResult;
import com.amazonaws.services.lambda.model.DeleteEventSourceMappingRequest;
import com.amazonaws.services.lambda.model.Environment;
import com.amazonaws.services.lambda.model.EphemeralStorage;
import com.amazonaws.services.lambda.model.EventSourceMappingConfiguration;
import com.amazonaws.services.lambda.model.EventSourcePosition;
import com.amazonaws.services.lambda.model.FunctionCode;
Expand Down Expand Up @@ -144,6 +145,7 @@ private boolean shouldUpdate(LambdaFunction lambdaFunction, GetFunctionResult ge
.withRole(lambdaFunction.getLambdaRoleArn())
.withTimeout(lambdaFunction.getTimeout())
.withMemorySize(lambdaFunction.getMemorySize())
.withEphemeralStorage(new EphemeralStorage().withSize(lambdaFunction.getEphemeralStorageSize()))
.withRuntime(runtime)
.withVpcConfig(getVpcConfig(lambdaFunction))
.withEnvironment(new Environment().withVariables(lambdaFunction.getEnvironmentVariables()));
Expand Down Expand Up @@ -448,9 +450,10 @@ private boolean isConfigurationChanged(LambdaFunction lambdaFunction, GetFunctio
boolean isRoleChanged = isChangeStr.test(config.getRole(), lambdaFunction.getLambdaRoleArn());
boolean isTimeoutChanged = isChangeInt.test(config.getTimeout(), lambdaFunction.getTimeout());
boolean isMemoryChanged = isChangeInt.test(config.getMemorySize(), lambdaFunction.getMemorySize());
boolean isEphemeralStorageChanged = isChangeInt.test(config.getEphemeralStorage().getSize(), lambdaFunction.getEphemeralStorageSize());
boolean isSecurityGroupIdsChanged = isChangeList.test(vpcConfig.getSecurityGroupIds(), lambdaFunction.getSecurityGroupIds());
boolean isVpcSubnetIdsChanged = isChangeList.test(vpcConfig.getSubnetIds(), lambdaFunction.getSubnetIds());
return isDescriptionChanged || isHandlerChanged || isRoleChanged || isTimeoutChanged || isMemoryChanged ||
return isDescriptionChanged || isHandlerChanged || isRoleChanged || isTimeoutChanged || isMemoryChanged || isEphemeralStorageChanged ||
isSecurityGroupIdsChanged || isVpcSubnetIdsChanged || isAliasesChanged(lambdaFunction) || isKeepAliveChanged(lambdaFunction) ||
isScheduleRuleChanged(lambdaFunction);
})
Expand Down Expand Up @@ -505,6 +508,7 @@ private boolean isAliasesChanged(LambdaFunction lambdaFunction) {
.withRuntime(runtime)
.withTimeout(ofNullable(lambdaFunction.getTimeout()).orElse(timeout))
.withMemorySize(ofNullable(lambdaFunction.getMemorySize()).orElse(memorySize))
.withEphemeralStorage(new EphemeralStorage().withSize(ephemeralStorageSize))
.withVpcConfig(getVpcConfig(lambdaFunction))
.withCode(new FunctionCode()
.withS3Bucket(s3Bucket)
Expand Down
18 changes: 18 additions & 0 deletions src/main/java/com/github/seanroy/plugins/LambdaFunction.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ public class LambdaFunction {
* <p>@see {@link AbstractLambdaMojo}</p>
*/
private Integer memorySize;
/**
* <p>@see {@link AbstractLambdaMojo}</p>
*/
private Integer ephemeralStorageSize;
/**
* <p>@see {@link AbstractLambdaMojo}</p>
*/
Expand Down Expand Up @@ -138,6 +142,14 @@ public void setMemorySize(Integer memorySize) {
this.memorySize = memorySize;
}

public Integer getEphemeralStorageSize() {
return ephemeralStorageSize;
}

public void setEphemeralStorageSize(Integer ephemeralStorageSize) {
this.ephemeralStorageSize = ephemeralStorageSize;
}

public Integer getTimeout() {
return timeout;
}
Expand Down Expand Up @@ -257,6 +269,11 @@ public LambdaFunction withMemorySize(Integer memorySize) {
this.memorySize = memorySize;
return this;
}

public LambdaFunction withEphemeralStorageSize(Integer ephemeralStorageSize) {
this.ephemeralStorageSize = ephemeralStorageSize;
return this;
}

public LambdaFunction withSecurityGroupsIds(List<String> securityGroupsIds) {
this.securityGroupIds = securityGroupsIds;
Expand Down Expand Up @@ -339,6 +356,7 @@ public String toString() {
.append(", description='").append(description).append('\'')
.append(", handler='").append(handler).append('\'')
.append(", memorySize=").append(memorySize)
.append(", ephemeralStorageSize=").append(ephemeralStorageSize)
.append(", timeout=").append(timeout)
.append(", version='").append(version).append('\'')
.append(", securityGroupIds=").append(securityGroupIds)
Expand Down
3 changes: 3 additions & 0 deletions src/test/resources/test-projects/basic-test/basic-pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
<functionCode>src/test/resources/test-projects/basic-test/lambda-test-0.0.1-SNAPSHOT.jar</functionCode>
<version>0.1.1-Test</version>
<memorySize>512</memorySize>
<ephemeralStorageSize>1024</ephemeralStorageSize>
<regionName>us-east-1</regionName>
<runtime>java8</runtime>
<s3Bucket>lambda-function-code</s3Bucket>
Expand All @@ -45,6 +46,7 @@
"handler": "com.github.seanroy.lambduh_test::hello_world",
"timeout": 30,
"memorySize": 512,
"ephemeralStorageSize": 1024,
"keepAlive": 2,
"triggers": [
{
Expand All @@ -67,6 +69,7 @@
"handler": "com.github.seanroy.lambduh_test::goodbye_world",
"timeout": 45,
"memorySize": 256,
"ephemeralStorageSize": 512,
"topics": [],
"triggers": []
}
Expand Down