
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
@aws-cdk/aws-cloudformation
Advanced tools
This module is part of the AWS Cloud Development Kit project.
Custom Resources are CloudFormation resources that are implemented by arbitrary user code. They can do arbitrary lookups or modifications during a CloudFormation synthesis run.
You will typically use Lambda to implement a Construct implemented as a
Custom Resource (though SNS topics can be used as well). Your Lambda function
will be sent a CREATE
, UPDATE
or DELETE
message, depending on the
CloudFormation life cycle, and can return any number of output values which
will be available as attributes of your Construct. In turn, those can
be used as input to other Constructs in your model.
In general, consumers of your Construct will not need to care whether it is implemented in term of other CloudFormation resources or as a custom resource.
Note: when implementing your Custom Resource using a Lambda, use
a SingletonLambda
so that even if your custom resource is instantiated
multiple times, the Lambda will only get uploaded once.
Sample of a Custom Resource that copies files into an S3 bucket during deployment
(implementation of actual copy.py
operation elided).
interface CopyOperationProps {
sourceBucket: IBucket;
targetBucket: IBucket;
}
class CopyOperation extends Construct {
constructor(parent: Construct, name: string, props: DemoResourceProps) {
super(parent, name);
const lambdaProvider = new SingletonLambda(this, 'Provider', {
uuid: 'f7d4f730-4ee1-11e8-9c2d-fa7ae01bbebc',
code: new LambdaInlineCode(resources['copy.py']),
handler: 'index.handler',
timeout: 60,
runtime: LambdaRuntime.Python3,
});
new CustomResource(this, 'Resource', {
lambdaProvider,
properties: {
sourceBucketArn: props.sourceBucket.bucketArn,
targetBucketArn: props.targetBucket.bucketArn,
}
});
}
}
More examples are in the example
directory, including an example of how to use
the cfnresponse
module that is provided for you by CloudFormation.
See the following section of the docs on details to write Custom Resources:
0.28.0 (2019-04-04)
aws-ecs: use executionRole for event rule target (#2165) (aa6f7bc), closes #2015
feat(aws-iam): refactor grants, add OrganizationPrincipal (#1623) (1bb8ca9), closes #1623 #236
bind
method to take a Role separately from the Pipeline. (#2085) (ffe0046)newVersion
method. (#2099) (6fc179a)secretsmanager.SecretString
class has been removed in favor of cdk.SecretValue.secretsManager(id[, options])
string
to cdk.SecretValue
: codepipeline-actions.AlexaSkillDeployAction.clientSecret
, codepipeline-actions.AlexaSkillDeployAction.refreshToken
, codepipeline-actions.GitHubSourceAction.oauthToken
, iam.User.password
secretsmanager.Secret.stringValue
and jsonFieldValue
have been removed. Use secretsmanage.Secret.secretValue
and secretJsonValue
instead.secretsmanager.Secret.secretString
have been removed. Use cdk.SecretValue.secretsManager()
or secretsmanager.Secret.import(..).secretValue
.cdk.Secret
has been removed. Use cdk.SecretValue
instead.cdk.DynamicReference
is no longer a construct, and it's constructor signature was changed and was renamed cdk.CfnDynamicReference
.grant(function.role)
and grant(project.role)
are now grant(function)
and grant(role)
.cdk.Secret
with secretsmanager.SecretString
(preferred) or ssm.ParameterStoreSecureString
.FAQs
The CDK Construct Library for AWS::CloudFormation
The npm package @aws-cdk/aws-cloudformation receives a total of 69,773 weekly downloads. As such, @aws-cdk/aws-cloudformation popularity was classified as popular.
We found that @aws-cdk/aws-cloudformation demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.