-
Notifications
You must be signed in to change notification settings - Fork 4k
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
BREAKING: remove '@aws-cdk/aws-custom-resources' #513
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
489052c
BREAKING: rename '@aws-cdk/aws-custom-resources'
008b14e
Update Java package name to match 'cdk-' convention
ba343e0
Move CustomResource into aws-cloudformation and SingletonLambda into …
c018aae
Merge branch 'master' into hijbers/rename-custom-resources
68b29a3
Fix broken merge of package.json
aff2bc1
Un-necro aws-custom-resources
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,68 @@ | ||
## CDK Constructs for AWS CloudFormation | ||
This module is part of the [AWS Cloud Development Kit](https://github.com/awslabs/aws-cdk) project. | ||
This module is part of the [AWS Cloud Development Kit](https://github.com/awslabs/aws-cdk) project. | ||
|
||
### Custom Resources | ||
|
||
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. | ||
|
||
#### Example | ||
|
||
Sample of a Custom Resource that copies files into an S3 bucket during deployment | ||
(implementation of actual `copy.py` operation elided). | ||
|
||
```ts | ||
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. | ||
|
||
#### References | ||
|
||
See the following section of the docs on details to write Custom Resources: | ||
|
||
* [Introduction](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/template-custom-resources.html) | ||
* [Reference](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/crpg-ref.html) | ||
* [Code Reference](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lambda-function-code.html) |
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...-cdk/aws-custom-resources/lib/resource.ts → ...aws-cloudformation/lib/custom-resource.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
// AWS::CloudFormation CloudFormation Resources: | ||
export * from './cloudformation.generated'; | ||
export * from './custom-resource'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if we should provide an example that uses assets here?