Interface AwsCustomResourceProps
- All Superinterfaces:
software.amazon.jsii.JsiiSerializable
- All Known Implementing Classes:
AwsCustomResourceProps.Jsii$Proxy
Note that at least onCreate, onUpdate or onDelete must be specified.
Example:
String crossAccountRoleArn = "arn:aws:iam::OTHERACCOUNT:role/CrossAccountRoleName"; // arn of role deployed in separate account
String callRegion = "us-west-1"; // sdk call to be made in specified region (optional)
// sdk call to be made in specified region (optional)
AwsCustomResource.Builder.create(this, "CrossAccount")
.onCreate(AwsSdkCall.builder()
.assumedRoleArn(crossAccountRoleArn)
.region(callRegion) // optional
.service("sts")
.action("GetCallerIdentity")
.physicalResourceId(PhysicalResourceId.of("id"))
.build())
.policy(AwsCustomResourcePolicy.fromStatements(List.of(PolicyStatement.fromJson(Map.of(
"Effect", "Allow",
"Action", "sts:AssumeRole",
"Resource", crossAccountRoleArn)))))
.build();
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic final classA builder forAwsCustomResourcePropsstatic final classAn implementation forAwsCustomResourceProps -
Method Summary
Modifier and TypeMethodDescriptionbuilder()default StringA name for the singleton Lambda function implementing this custom resource.default BooleanWhether to install the latest AWS SDK v3.default ILogGroupThe Log Group used for logging of events emitted by the custom resource's lambda function.default RetentionDaysThe number of days log events of the singleton Lambda function implementing this custom resource are kept in CloudWatch Logs.default NumberThe memory size for the singleton Lambda function implementing this custom resource.default AwsSdkCallThe AWS SDK call to make when the resource is created.default AwsSdkCallThe AWS SDK call to make when the resource is deleted.default AwsSdkCallThe AWS SDK call to make when the resource is updated.default AwsCustomResourcePolicyThe policy that will be added to the execution role of the Lambda function implementing this custom resource provider.default RemovalPolicyThe policy to apply when this resource is removed from the application.default StringCloudformation Resource type.default IRolegetRole()The execution role for the singleton Lambda function implementing this custom resource provider.default DurationThe maximum time that can elapse before a custom resource operation times out.default DurationThe timeout for the singleton Lambda function implementing this custom resource.default IVpcgetVpc()The vpc to provision the lambda function in.default SubnetSelectionWhich subnets from the VPC to place the lambda function in.Methods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Method Details
-
getFunctionName
A name for the singleton Lambda function implementing this custom resource.The function name will remain the same after the first AwsCustomResource is created in a stack.
Default: - AWS CloudFormation generates a unique physical ID and uses that ID for the function's name. For more information, see Name Type.
-
getInstallLatestAwsSdk
Whether to install the latest AWS SDK v3.If not specified, this uses whatever JavaScript SDK version is the default in AWS Lambda at the time of execution.
Otherwise, installs the latest version from 'npmjs.com'. The installation takes around 60 seconds and requires internet connectivity.
The default can be controlled using the context key
@aws-cdk/customresources:installLatestAwsSdkDefaultis.Default: - The value of `@aws-cdk/customresources:installLatestAwsSdkDefault`, otherwise `true`
-
getLogGroup
The Log Group used for logging of events emitted by the custom resource's lambda function.Providing a user-controlled log group was rolled out to commercial regions on 2023-11-16. If you are deploying to another type of region, please check regional availability first.
Default: - a default log group created by AWS Lambda
-
getLogRetention
The number of days log events of the singleton Lambda function implementing this custom resource are kept in CloudWatch Logs.This is a legacy API and we strongly recommend you migrate to
logGroupif you can.logGroupallows you to create a fully customizable log group and instruct the Lambda function to send logs to it.Default: logs.RetentionDays.INFINITE
-
getMemorySize
The memory size for the singleton Lambda function implementing this custom resource.Default: 512 mega in case if installLatestAwsSdk is false.
-
getOnCreate
The AWS SDK call to make when the resource is created.Default: - the call when the resource is updated
-
getOnDelete
The AWS SDK call to make when the resource is deleted.Default: - no call
-
getOnUpdate
The AWS SDK call to make when the resource is updated.Default: - no call
-
getPolicy
The policy that will be added to the execution role of the Lambda function implementing this custom resource provider.The custom resource also implements
iam.IGrantable, making it possible to use thegrantXxx()methods.As this custom resource uses a singleton Lambda function, it's important to note the that function's role will eventually accumulate the permissions/grants from all resources.
Note that a policy must be specified if
roleis not provided, as by default a new role is created which requires policy changes to access resources.Default: - no policy added
- See Also:
-
getRemovalPolicy
The policy to apply when this resource is removed from the application.Default: cdk.RemovalPolicy.Destroy
-
getResourceType
Cloudformation Resource type.Default: - Custom::AWS
-
getRole
The execution role for the singleton Lambda function implementing this custom resource provider.This role will apply to all
AwsCustomResourceinstances in the stack. The role must be assumable by thelambda.amazonaws.com.rproxy.govskope.caservice principal.Default: - a new role is created
-
getServiceTimeout
The maximum time that can elapse before a custom resource operation times out.You should not need to set this property. It is intended to allow quick turnaround even if the implementor of the custom resource forgets to include a
try/catch. We have included thetry/catch, and AWS service calls usually do not take an hour to complete.The value must be between 1 second and 3600 seconds.
Default: Duration.seconds(3600)
-
getTimeout
The timeout for the singleton Lambda function implementing this custom resource.Default: Duration.minutes(2)
-
getVpc
The vpc to provision the lambda function in.Default: - the function is not provisioned inside a vpc.
-
getVpcSubnets
Which subnets from the VPC to place the lambda function in.Only used if 'vpc' is supplied. Note: internet access for Lambdas requires a NAT gateway, so picking Public subnets is not allowed.
Default: - the Vpc default strategy if not specified
-
builder
- Returns:
- a
AwsCustomResourceProps.BuilderofAwsCustomResourceProps
-