AwsCustomResourceProps¶
-
class
aws_cdk.custom_resources.
AwsCustomResourceProps
(*, policy, function_name=None, install_latest_aws_sdk=None, log_retention=None, on_create=None, on_delete=None, on_update=None, resource_type=None, role=None, timeout=None)¶ Bases:
object
Properties for AwsCustomResource.
Note that at least onCreate, onUpdate or onDelete must be specified.
- Parameters
policy (
AwsCustomResourcePolicy
) – The policy that will be added to the execution role of the Lambda function implementing this custom resource provider. The custom resource also implementsiam.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.function_name (
Optional
[str
]) – 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.install_latest_aws_sdk (
Optional
[bool
]) – Whether to install the latest AWS SDK v2. Allows to use the latest API calls documented at https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/index.html. The installation takes around 60 seconds. Default: truelog_retention (
Optional
[RetentionDays
]) – The number of days log events of the singleton Lambda function implementing this custom resource are kept in CloudWatch Logs. Default: logs.RetentionDays.INFINITEon_create (
Optional
[AwsSdkCall
]) – The AWS SDK call to make when the resource is created. Default: - the call when the resource is updatedon_delete (
Optional
[AwsSdkCall
]) – The AWS SDK call to make when the resource is deleted. Default: - no callon_update (
Optional
[AwsSdkCall
]) – The AWS SDK call to make when the resource is updated. Default: - no callresource_type (
Optional
[str
]) – Cloudformation Resource type. Default: - Custom::AWSrole (
Optional
[IRole
]) – The execution role for the singleton Lambda function implementing this custom resource provider. This role will apply to allAwsCustomResource
instances in the stack. The role must be assumable by thelambda.amazonaws.com
service principal. Default: - a new role is createdtimeout (
Optional
[Duration
]) – The timeout for the singleton Lambda function implementing this custom resource. Default: Duration.minutes(2)
- ExampleMetadata
infused
Example:
aws_custom = cr.AwsCustomResource(self, "aws-custom", on_create=cr.AwsSdkCall( service="...", action="...", parameters={ "text": "..." }, physical_resource_id=cr.PhysicalResourceId.of("...") ), on_update=cr.AwsSdkCall( service="...", action="...", parameters={ "text": "...", "resource_id": cr.PhysicalResourceIdReference() } ), policy=cr.AwsCustomResourcePolicy.from_sdk_calls( resources=cr.AwsCustomResourcePolicy.ANY_RESOURCE ) )
Attributes
-
function_name
¶ 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.
- Return type
Optional
[str
]
-
install_latest_aws_sdk
¶ //docs.aws.amazon.com/AWSJavaScriptSDK/latest/index.html.
The installation takes around 60 seconds.
- Default
true
- Type
Whether to install the latest AWS SDK v2. Allows to use the latest API calls documented at https
- Return type
Optional
[bool
]
-
log_retention
¶ The number of days log events of the singleton Lambda function implementing this custom resource are kept in CloudWatch Logs.
- Default
logs.RetentionDays.INFINITE
- Return type
Optional
[RetentionDays
]
-
on_create
¶ The AWS SDK call to make when the resource is created.
- Default
the call when the resource is updated
- Return type
Optional
[AwsSdkCall
]
-
on_delete
¶ The AWS SDK call to make when the resource is deleted.
- Default
no call
- Return type
Optional
[AwsSdkCall
]
-
on_update
¶ The AWS SDK call to make when the resource is updated.
- Default
no call
- Return type
Optional
[AwsSdkCall
]
-
policy
¶ 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.
- See
Policy.fromSdkCalls
- Return type
-
resource_type
¶ Cloudformation Resource type.
- Default
Custom::AWS
- Return type
Optional
[str
]
-
role
¶ The execution role for the singleton Lambda function implementing this custom resource provider.
This role will apply to all
AwsCustomResource
instances in the stack. The role must be assumable by thelambda.amazonaws.com
service principal.- Default
a new role is created
- Return type
Optional
[IRole
]