![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
@swarmion/serverless-cdk-plugin
Advanced tools
Serverless plugin to use CDK constructs in serverless framework applications
Provision resources using the AWS CDK (SQS, Dynamodb, etc.) and reference them in the Serverless framework (lambdas and configuration's
serverless.ts
).
When using Serverless framework along with AWS, one often runs into needing to provision resources that aren't covered by the framework (e.g. SQS, DynamoDB). This problem can be solved using AWS Cloudformation, or AWS CDK, among many other options.
The main resulting issue is the following: How can one reference the resources created outside of Serverless framework?
Moreover, how does one reference lambdas provisioned in the Serverless framework lifecycle inside their custom resources?
These two challenges motivated the development of the Serverless-CDK Bridge.
Developers that were using Cloudformation to provision resources that Serverless Framework does not manage can now use the AWS CDK. It is a more efficient and DX-friendly option.
Developers that were using the AWS CDK won't need to "transpile" their CDK constructs' code into Cloudformation before the Serverless Framework deploy step. This saves them a lot of boilerplate fatigue.
serverless.ts
file at the root of any service to function.Here's a short code snippet to demonstrate how to use the plugin.
backend orchestrator > resources > dynamodb.ts
import type { ServerlessProps } from '@swarmion/serverless-cdk-plugin';
import ServerlessCdkPlugin from '@swarmion/serverless-cdk-plugin';
import { PARTITION_KEY, SORT_KEY } from 'libs/dynamodb/primaryKeys';
export class OrchestratorDynamodb extends ServerlessCdkPlugin.ServerlessConstruct {
public dynamodbArn: string;
public dynamodbName: string;
constructor(scope: Construct, id: string, serverlessProps: ServerlessProps) {
super(scope, id, serverlessProps);
const table = new Table(this, 'OrchestratorTable', {
partitionKey: { name: PARTITION_KEY, type: AttributeType.STRING },
sortKey: { name: SORT_KEY, type: AttributeType.STRING },
billingMode: BillingMode.PAY_PER_REQUEST,
});
this.dynamodbArn = table.tableArn;
this.dynamodbName = table.tableName;
}
}
export const getCdkProperty =
ServerlessCdkPlugin.getCdkPropertyHelper<OrchestratorDynamodb>;
Then, pass the construct to the serverless.ts
file at the serverlessConstruct key:
backend orchestrator > serverless.ts
const serverlessConfiguration: AWS &
ServerlessContracts &
ServerlessCdkPluginConfig = {
// Other properties ...
construct: OrchestratorDynamodb,
params: sharedParams,
provider: {
...sharedProviderConfig,
},
};
And that's it! Constructs (e.g. dynamodb table) can now be referenced in the Serverless framework code seamlessly (e.g. within lambdas configuration files).
backend orchestrator > functions > requestSyncDeployment > config.ts
import { requestSyncDeployment } from '@swarmion/orchestrator-contracts';
import { getTrigger } from '@swarmion/serverless-contracts';
import { getHandlerPath, LambdaFunction } from '@swarmion/serverless-helpers';
import { getCdkProperty } from 'resources/dynamodb';
const config: LambdaFunction = {
environment: {
ORCHESTRATOR_TABLE_NAME: getCdkProperty('dynamodbName'),
},
handler: getHandlerPath(__dirname),
iamRoleStatements: [
{
Effect: 'Allow',
Resource: getCdkProperty('dynamodbArn'),
Action: ['dynamodb:PutItem'],
},
],
iamRoleStatementsInherit: true,
events: [getTrigger(requestSyncDeployment)],
};
export default config;
FAQs
Serverless plugin to use CDK constructs in serverless framework applications
The npm package @swarmion/serverless-cdk-plugin receives a total of 179 weekly downloads. As such, @swarmion/serverless-cdk-plugin popularity was classified as not popular.
We found that @swarmion/serverless-cdk-plugin demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.