giuseppe-trisciuoglio/developer-kit / plugins/developer-kit-java/skills/aws-sdk-java-v2-lambda
aws-sdk-java-v2-lambda
UnverifiedProvides AWS Lambda patterns using AWS SDK for Java 2.x. Use when invoking Lambda functions, creating/updating functions, managing function configurations, working with Lambda layers, or integrating Lambda with Spring Boot applications.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 9.0 KB |
| references/client-setup.md | markdown | 2.4 KB |
| references/examples.md | markdown | 16.7 KB |
| references/function-management.md | markdown | 7.3 KB |
| references/invocation-patterns.md | markdown | 7.3 KB |
| references/official-documentation.md | markdown | 4.4 KB |
| references/spring-boot-integration.md | markdown | 8.2 KB |
| references/testing.md | markdown | 8.3 KB |
references/function-management.md
View on GitHub# Lambda Function Management
## List Functions
```java
import software.amazon.awssdk.services.lambda.model.ListFunctionsResponse;
import software.amazon.awssdk.services.lambda.model.FunctionConfiguration;
public List<FunctionConfiguration> listFunctions(LambdaClient lambdaClient) {
ListFunctionsResponse response = lambdaClient.listFunctions();
return response.functions();
}
```
## Get Function Configuration
```java
public FunctionConfiguration getFunctionConfig(LambdaClient lambdaClient,
String functionName) {
GetFunctionRequest request = GetFunctionRequest.builder()
.functionName(functionName)
.build();
GetFunctionResponse response = lambdaClient.getFunction(request);
return response.configuration();
}
```
## Update Function Code
```java
import java.nio.file.Files;
import java.nio.file.Paths;
public void updateFunctionCode(LambdaClient lambdaClient,
String functionName,
String zipFilePath) throws IOException {
byte[] zipBytes = Files.readAllBytes(Paths.get(zipFilePath));
UpdateFunctionCodeRequest request = UpdateFunctionCodeRequest.builder()
.functionName(functionName)
.zipFile(SdkBytes.fromByteArray(zipBytes))
.publish(true)
.build();
UpdateFunctionCodeResponse response = lambdaClient.updateFunctionCode(request);
System.out.println("Updated function version: " + response.version());
}
```
## Update Function Configuration
```java
public void updateFunctionConfiguration(LambdaClient lambdaClient,
String functionName,
Map<String, String> environment) {
Environment env = Environment.builder()
.variables(environment)
.build();
UpdateFunctionConfigurationRequest request = UpdateFunctionConfigurationRequest.builder()
.functionName(functionName)
.environment(env)
.timeout(60)
.memorySize(512)
.build();
lambdaClient.updateFunctionConfiguration(request);
}
```
## Create Function
```java
public void createFunction(LambdaClient lambdaClient,
String functionName,
String roleArn,
String handler,
String zipFilePath) throws IOException {
byte[] zipBytes = Files.readAllBytes(Paths.get(zipFilePath));
FunctionCode code = FunctionCode.builder()
.zipFile(SdkBytes.fromByteArray(zipBytes))
.build();
CreateFunctionRequest request = CreateFunctionRequest.builder()
.functionName(functionName)
.runtime(Runtime.JAVA17)
.role(roleArn)
.handler(handler)
.code(code)
.timeout(60)
.memorySize(512)
.build();
CreateFunctionResponse response = lambdaClient.createFunction(request);
System.out.println("Function ARN: " + response.functionArn());
}
```
## Delete Function
```java
public void deleteFunction(LambdaClient lambdaClient, String functionName) {
DeleteFunctionRequest request = DeleteFunctionRequest.builder()
.functionName(functionName)
.build();
lambdaClient.deleteFunction(request);
}
```
## Environment Variables
### Set Environment Variables
```java
public void setEnvironmentVariables(LambdaClient lambdaClient,
String functionName,
Map<String, String> variables) {
Environment environment = Environment.builder()
.variables(variables)
.build();
UpdateFunctionConfigurationRequest request = UpdateFunctionConfigurationRequest.builder()
.functionName(functionName)
.environment(environment)
.build();
lambdaClient.updateFunctionConfiguration(request);
}
```
### Get Environment Variables
```java
public Map<String, String> getEnvironmentVariables(LambdaClient lambdaClient,
String functionName) {
GetFunctionConfigurationRequest request = GetFunctionConfigurationRequest.builder()
.functionName(functionName)
.build();
GetFunctionConfigurationResponse response = lambdaClient.getFunctionConfiguration(request);
return response.environment().variables();
}
```
## Concurrency Configuration
### Set Reserved Concurrency
```java
public void setReservedConcurrency(LambdaClient lambdaClient,
String functionName,
Integer concurrentExecutions) {
PutFunctionConcurrencyRequest request = PutFunctionConcurrencyRequest.builder()
.functionName(functionName)
.reservedConcurrentExecutions(concurrentExecutions)
.build();
lambdaClient.putFunctionConcurrency(request);
}
```
### Set Provisioned Concurrency
```java
public void setProvisionedConcurrency(LambdaClient lambdaClient,
String functionName,
String aliasName,
Integer provisionedConcurrentExecutions) {
PutProvisionedConcurrencyConfigRequest request = PutProvisionedConcurrencyConfigRequest.builder()
.functionName(functionName)
.qualifier(aliasName)
.provisionedConcurrentExecutions(provisionedConcurrentExecutions)
.build();
lambdaClient.putProvisionedConcurrencyConfig(request);
}
```
## Layers Management
### List Layers
```java
public List<LayerConfiguration> listLayers(LambdaClient lambdaClient) {
ListLayersResponse response = lambdaClient.listLayers();
return response.layers();
}
```
### Add Layer to Function
```java
public void addLayerToFunction(LambdaClient lambdaClient,
String functionName,
String layerArn) {
UpdateFunctionConfigurationRequest request = UpdateFunctionConfigurationRequest.builder()
.functionName(functionName)
.layers(layerArn)
.build();
lambdaClient.updateFunctionConfiguration(request);
}
```
## Aliases and Versions
### Create Alias
```java
public void createAlias(LambdaClient lambdaClient,
String functionName,
String aliasName,
String version) {
CreateAliasRequest request = CreateAliasRequest.builder()
.functionName(functionName)
.name(aliasName)
.functionVersion(version)
.build();
lambdaClient.createAlias(request);
}
```
### Update Alias
```java
public void updateAlias(LambdaClient lambdaClient,
String functionName,
String aliasName,
String newVersion) {
UpdateAliasRequest request = UpdateAliasRequest.builder()
.functionName(functionName)
.name(aliasName)
.functionVersion(newVersion)
.build();
lambdaClient.updateAlias(request);
}
```
### Publish Version
```java
public String publishVersion(LambdaClient lambdaClient,
String functionName) {
PublishVersionRequest request = PublishVersionRequest.builder()
.functionName(functionName)
.build();
PublishVersionResponse response = lambdaClient.publishVersion(request);
return response.version();
}
```
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| writing-skillsobra/superpowersUse when creating new skills, editing existing skills, or verifying skills work before deployment | Stars: 318k | Updated | Claude CodeCodex | Unverified | Install |
| xlsxanthropics/skillsUse this skill any time a spreadsheet file is the primary input or output. This means any task where the user wants to: open, read, edit, or fix an existing .xlsx, .xlsm, .xltx, .csv, or .tsv file (e.g., adding columns, computing formulas, formatting, charting, cleaning messy data); create a new spreadsheet from scratch or from other data sources; or convert between tabular file formats. Trigger especially when the user references a spreadsheet file by name or path — even casually (like "the xlsx in my downloads") — and wants something done to it or produced from it. Also trigger for cleaning or restructuring messy tabular data files (malformed rows, misplaced headers, junk data) into proper spreadsheets. The deliverable must be a spreadsheet file. Do NOT trigger when the primary deliverable is a Word document, HTML report, standalone Python script, database pipeline, or Google Sheets API integration, even if tabular data is involved. | Stars: 195k | Updated | Claude CodeCodex | Verified | Install |
| shipping-and-launchaddyosmani/agent-skillsPrepares production launches. Use when preparing to deploy to production, or when asking what needs to be in place before shipping. Use when you need a pre-launch checklist, when setting up monitoring, when planning a staged rollout, or when you need a rollback strategy. | Stars: 118k | Updated | Claude CodeCodex | Verified | Install |
| childhoodthedotmack/claude-memBabysit a shipped release after merge, publication, or deployment. Verify published packages, production behavior, installed plugins, and late CI or user reports until the observation window is clean; use babysit for PR readiness before release. | Stars: 117k | Updated | Claude CodeCodex | Unverified | Install |