How to use where clause in Knex
Create refunds with Stripe
Load HTML with Cheerio
How to send POST request with Axios
Find intersection of array in Lodash
Powered by Official white Bloop logo with a period

Terms / Privacy / Search / Support

  • const serviceToken = CustomResourceProvider.getOrCreate(this, 'Custom::MyCustomResourceType', {
      codeDirectory: `${__dirname}/my-handler`,
      runtime: CustomResourceProviderRuntime.NODEJS_12_X,
      description: "Lambda function created by the custom resource provider",
    });
    
    new CustomResource(this, 'MyResource', {
      resourceType: 'Custom::MyCustomResourceType',
      serviceToken: serviceToken
    });
    
    Docs
    0
  • import {
      Construct,
      CustomResource,
      CustomResourceProvider,
      CustomResourceProviderRuntime,
      Token,
    } from '@aws-cdk/core';
    
    export interface SumProps {
      readonly lhs: number;
      readonly rhs: number;
    }
    
    export class Sum extends Construct {
      public readonly result: number;
    
      constructor(scope: Construct, id: string, props: SumProps) {
        super(scope, id);
    
        const resourceType = 'Custom::Sum';
        const serviceToken = CustomResourceProvider.getOrCreate(this, resourceType, {
          codeDirectory: `${__dirname}/sum-handler`,
          runtime: CustomResourceProviderRuntime.NODEJS_12_X,
        });
    
        const resource = new CustomResource(this, 'Resource', {
          resourceType: resourceType,
          serviceToken: serviceToken,
          properties: {
            lhs: props.lhs,
            rhs: props.rhs
          }
        });
    
        this.result = Token.asNumber(resource.getAtt('Result'));
      }
    }
    
    Docs
    0
  • const provider = CustomResourceProvider.getOrCreateProvider(this, 'Custom::MyCustomResourceType', {
      codeDirectory: `${__dirname}/my-handler`,
      runtime: CustomResourceProviderRuntime.NODEJS_12_X,
      policyStatements: [
        {
          Effect: 'Allow',
          Action: 's3:PutObject*',
          Resource: '*',
        }
      ],
    });
    
    Docs
    0
  • const provider = CustomResourceProvider.getOrCreateProvider(this, 'Custom::MyCustomResourceType', {
      codeDirectory: `${__dirname}/my-handler`,
      runtime: CustomResourceProviderRuntime.NODEJS_12_X,
    });
    
    const roleArn = provider.roleArn;
    
    Docs
    0
  • // invoke an AWS Lambda function when a lifecycle event occurs:
    new CustomResource(this, 'MyResource', {
       serviceToken: myFunction.functionArn,
    });
    
    Docs
    0
  • // use the provider framework from aws-cdk/custom-resources:
    const provider = new customresources.Provider(this, 'ResourceProvider', {
       onEventHandler,
       isCompleteHandler, // optional
    });
    
    new CustomResource(this, 'MyResource', {
       serviceToken: provider.serviceToken,
    });
    
    Docs
    0
  • declare const myProvider: CustomResourceProvider;
    
    new CustomResource(this, 'MyCustomResource', {
      serviceToken: myProvider.serviceToken,
      properties: {
        myPropertyOne: 'one',
        myPropertyTwo: 'two',
      },
    });
    
    Docs
    0
  • const provider = new customresources.Provider(this, 'MyProvider', {
      onEventHandler,
      isCompleteHandler, // optional async waiter
    });
    
    new CustomResource(this, 'MyResource', {
      serviceToken: provider.serviceToken
    });
    
    Docs
    0
  • // publish lifecycle events to an SNS topic:
    new CustomResource(this, 'MyResource', {
       serviceToken: myTopic.topicArn,
    });
    
    Docs
    0
  • import * as cdk from '@aws-cdk/core';
    
    class MyConstruct extends cdk.Resource implements cdk.ITaggable {
    public readonly tags = new cdk.TagManager(cdk.TagType.KEY_VALUE, 'Whatever::The::Type');
    
    constructor(scope: cdk.Construct, id: string) {
    super(scope, id);
    
    new cdk.CfnResource(this, 'Resource', {
    type: 'Whatever::The::Type',
    properties: {
    // ...
    Tags: this.tags.renderedTags,
    },
    });
    }
    }
    
    Docs
    0
  • import { CustomResource } from '@aws-cdk/core';
    import * as logs from '@aws-cdk/aws-logs';
    import * as iam from '@aws-cdk/aws-iam';
    import * as cr from '@aws-cdk/custom-resources';
    
    const onEvent = new lambda.Function(this, 'MyHandler', { /* ... */ });
    
    const myRole = new iam.Role(this, 'MyRole', { /* ... */ });
    
    const myProvider = new cr.Provider(this, 'MyProvider', {
      onEventHandler: onEvent,
      isCompleteHandler: isComplete,        // optional async "waiter"
      logRetention: logs.RetentionDays.ONE_DAY,   // default is INFINITE
      role: myRole, // must be assumable by the `lambda.amazonaws.com` service principal
    });
    
    new CustomResource(this, 'Resource1', { serviceToken: myProvider.serviceToken });
    new CustomResource(this, 'Resource2', { serviceToken: myProvider.serviceToken });
    
    Docs
    0
  • Powered by Official black Bloop logo with a period
    download the IDE extension

    View other examples