Skip to content

Commit

Permalink
fix(ec2): naming collisions when using ec2.InitFile.fromAsset() on …
Browse files Browse the repository at this point in the history
…multiple instances in the same stack (#27468)

Closes #16891 

If a user creates more than one EC2 instance in the same stack and defines an InitConfig for each instance using `ec2.InitFile.fromAsset()`, the user will get an error if they pass in the same `targetFilePath` or `targetDirectory`. This bug is due to [how the asset is uploaded to S3](https://github.com/aws/aws-cdk/blob/main/packages/aws-cdk-lib/aws-ec2/lib/cfn-init-elements.ts#L427).

This PR fixes this issue by adding a hash to the `targetFileName` before being uploaded as an s3 asset.

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
  • Loading branch information
sumupitchayan committed Oct 23, 2023
1 parent 10b3221 commit fc3be31
Show file tree
Hide file tree
Showing 17 changed files with 3,255 additions and 2 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit fc3be31

Please sign in to comment.