Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs(custom-resources): remove section about experimental SDKv3 support #26631

Merged
merged 2 commits into from
Aug 4, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 1 addition & 33 deletions packages/aws-cdk-lib/custom-resources/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,7 @@ Path to data must be specified using a dot notation, e.g. to get the string valu
of the `Title` attribute for the first item returned by `dynamodb.query` it should
be `Items.0.Title.S`.

To make sure that the newest API calls are available the latest AWS SDK v2 is installed
To make sure that the newest API calls are available the latest AWS SDK v3 is installed
in the Lambda function implementing the custom resource. The installation takes around 60
seconds. If you prefer to optimize for speed, you can disable the installation by setting
the `installLatestAwsSdk` prop to `false`.
Expand Down Expand Up @@ -648,35 +648,3 @@ const getParameter = new cr.AwsCustomResource(this, 'AssociateVPCWithHostedZone'
}),
});
```

#### Using AWS SDK for JavaScript v3

`AwsCustomResource` experimentally supports AWS SDK for JavaScript v3 (NODEJS_18_X or higher). In AWS SDK for JavaScript v3, packages are installed for each service. Therefore, specify the package name for `service`. Also, `action` specifies the XxxClient operations provided in the package. This example is the same as `SSM.getParameter` in v2.

```ts
import * as regionInfo from 'aws-cdk-lib/region-info';

class MyFact implements regionInfo.IFact {
public readonly region = 'us-east-1';
public readonly name = regionInfo.FactName.DEFAULT_CR_NODE_VERSION;
public readonly value = lambda.Runtime.NODEJS_18_X.name;
}

// change custom resource default runtime
regionInfo.Fact.register(new MyFact(), true);

new cr.AwsCustomResource(this, 'GetParameter', {
resourceType: 'Custom::SSMParameter',
onUpdate: {
service: '@aws-sdk/client-ssm', // 'SSM' in v2
action: 'GetParameterCommand', // 'getParameter' in v2
parameters: {
Name: 'foo',
WithDecryption: true,
},
physicalResourceId: cr.PhysicalResourceId.fromResponse('Parameter.ARN'),
},
});
```

If you are using `NODEJS_18_X` or higher, you can also use the existing AWS SDK for JavaScript v2 style.