aws-cdk-lib.custom_resources.AwsSdkCall

interface AwsSdkCall

LanguageType name
.NETAmazon.CDK.CustomResources.AwsSdkCall
Gogithub.com/aws/aws-cdk-go/awscdk/v2/customresources#AwsSdkCall
Javasoftware.amazon.awscdk.customresources.AwsSdkCall
Pythonaws_cdk.custom_resources.AwsSdkCall
TypeScript (source)aws-cdk-lib » custom_resources » AwsSdkCall

An AWS SDK call.

Example

const awsCustom = new cr.AwsCustomResource(this, 'aws-custom', {
  onCreate: {
    service: '...',
    action: '...',
    parameters: {
      text: '...',
    },
    physicalResourceId: cr.PhysicalResourceId.of('...'),
  },
  onUpdate: {
    service: '...',
    action: '...',
    parameters: {
      text: '...',
      resourceId: new cr.PhysicalResourceIdReference(),
    },
  },
  policy: cr.AwsCustomResourcePolicy.fromSdkCalls({
    resources: cr.AwsCustomResourcePolicy.ANY_RESOURCE,
  }),
})

Properties

NameTypeDescription
actionstringThe service action to call.
servicestringThe service to call.
apiVersion?stringAPI version to use for the service.
assumedRoleArn?stringUsed for running the SDK calls in underlying lambda with a different role Can be used primarily for cross-account requests to for example connect hostedzone with a shared vpc.
ignoreErrorCodesMatching?stringThe regex pattern to use to catch API errors.
outputPaths?string[]Restrict the data returned by the custom resource to specific paths in the API response.
parameters?anyThe parameters for the service action.
physicalResourceId?PhysicalResourceIdThe physical resource id of the custom resource for this call.
region?stringThe region to send service requests to.

action

Type: string

The service action to call.

See also: https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/index.html


service

Type: string

The service to call.

See also: https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/index.html


apiVersion?

Type: string (optional, default: use latest available API version)

API version to use for the service.

See also: https://docs.aws.amazon.com/sdk-for-javascript/v2/developer-guide/locking-api-versions.html


assumedRoleArn?

Type: string (optional, default: run without assuming role)

Used for running the SDK calls in underlying lambda with a different role Can be used primarily for cross-account requests to for example connect hostedzone with a shared vpc.

Example for Route53 / associateVPCWithHostedZone


ignoreErrorCodesMatching?

Type: string (optional, default: do not catch errors)

The regex pattern to use to catch API errors.

The code property of the Error object will be tested against this pattern. If there is a match an error will not be thrown.


outputPaths?

Type: string[] (optional, default: return all data)

Restrict the data returned by the custom resource to specific paths in the API response.

Use this to limit the data returned by the custom resource if working with API calls that could potentially result in custom response objects exceeding the hard limit of 4096 bytes.

Example for ECS / updateService: ['service.deploymentConfiguration.maximumPercent']


parameters?

Type: any (optional, default: no parameters)

The parameters for the service action.

See also: https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/index.html


physicalResourceId?

Type: PhysicalResourceId (optional, default: no physical resource id)

The physical resource id of the custom resource for this call.

Mandatory for onCreate call. In onUpdate, you can omit this to passthrough it from request.


region?

Type: string (optional, default: the region where this custom resource is deployed)

The region to send service requests to.

Note: Cross-region operations are generally considered an anti-pattern. Consider first deploying a stack in that region.