Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@aws-cdk/core

Package Overview
Dependencies
Maintainers
4
Versions
248
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@aws-cdk/core

AWS Cloud Development Kit Core Library

  • 1.171.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
208K
increased by11.56%
Maintainers
4
Weekly downloads
 
Created

What is @aws-cdk/core?

@aws-cdk/core is a foundational package for the AWS Cloud Development Kit (CDK), which allows developers to define cloud infrastructure using familiar programming languages. It provides a high-level object-oriented abstraction to define AWS resources imperatively.

What are @aws-cdk/core's main functionalities?

Defining a Stack

A stack is a collection of AWS resources that you can manage as a single unit. In this example, we define a new stack called 'MyStack' and add it to the CDK application.

const cdk = require('@aws-cdk/core');

class MyStack extends cdk.Stack {
  constructor(scope, id, props) {
    super(scope, id, props);
    // Define resources here
  }
}

const app = new cdk.App();
new MyStack(app, 'MyStack');
app.synth();

Adding an S3 Bucket

This example demonstrates how to add an S3 bucket to a stack. The bucket is versioned, meaning it keeps multiple versions of an object.

const cdk = require('@aws-cdk/core');
const s3 = require('@aws-cdk/aws-s3');

class MyStack extends cdk.Stack {
  constructor(scope, id, props) {
    super(scope, id, props);
    new s3.Bucket(this, 'MyBucket', {
      versioned: true
    });
  }
}

const app = new cdk.App();
new MyStack(app, 'MyStack');
app.synth();

Defining IAM Roles

This example shows how to define an IAM role within a stack. The role is assumed by AWS Lambda and has the AWSLambdaBasicExecutionRole managed policy attached.

const cdk = require('@aws-cdk/core');
const iam = require('@aws-cdk/aws-iam');

class MyStack extends cdk.Stack {
  constructor(scope, id, props) {
    super(scope, id, props);
    new iam.Role(this, 'MyRole', {
      assumedBy: new iam.ServicePrincipal('lambda.amazonaws.com'),
      managedPolicies: [iam.ManagedPolicy.fromAwsManagedPolicyName('service-role/AWSLambdaBasicExecutionRole')]
    });
  }
}

const app = new cdk.App();
new MyStack(app, 'MyStack');
app.synth();

Other packages similar to @aws-cdk/core

Keywords

FAQs

Package last updated on 31 Aug 2022

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc