Add a way to write properties from resources to a file in S3
See original GitHub issue🚀 feature request
Some way of writing some of the values from resources to a file in S3.
Eg, something like:
const myBucket = new s3.Bucket(this, 'MyBucket');
new s3deploy.BucketDeployment(this, 'MyConfigFile', {
source: s3deploy.Source.fromString(`{"thisBucketArn": "${myBucket.bucketArn}"}`),
destinationBucket: myBucket,
destinationKeyPrefix: 'config.json',
});
should deploy the bucket, then write the ARN of the bucket to the json file in the bucket at config.json
.
I suspect there’s a way to do this already by abusing assets sufficiently, but I haven’t been able to make it work. The closest I can get is to write the variables into the source for a lambda and access them using API gateway, but that seems silly.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:8
- Comments:14 (9 by maintainers)
Top Results From Across the Web
Use custom resources with Amazon S3 buckets in ...
1. Open the CloudFormation console. · 2. Choose Create stack, and then choose With new resources (standard). · 3. In the Specify template...
Read more >How to load property file from classpath in AWS lambda java
As you want to load a properties file you can use the ResourceBundle to load the properties. ... project/src/main/resources/lambda.properties.
Read more >Add an Amazon S3 Bucket to the Stack
4.1 Edit the CloudFormation template file · Under the Resources section add the snippet you copied · You do not require any Properties...
Read more >Setting Up S3 for File Storage - Platform Automation Toolkit
Navigate to the S3 console · Click the "Create bucket" button · Enter a DNS-compliant name for your new bucket. This name must...
Read more >aws_s3_bucket_object | Resources | hashicorp/aws
bucket - (Required) Name of the bucket to put the file in. Alternatively, an S3 access point ARN can be specified. · key...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I did manage to handle this using the rather marvellous
AwsCustomResource
in@aws-cdk/custom-resources
:Whether the right thing to do is: a) bundling this up a reusable construct b) writing something bespoke (I don’t know enough about the internal to know what that would be) c) documenting this a workaround d) not bothering with either
I’m not sure. I suppose if this is functionality that lots of people might require, then a or b. If only a few, then c. If very very few (or just me), then d.
+1 I think the s3 deployment would be a good place for this too. I’m uploading a bunch of files with a deployment, but I’d like one of them to be templated with information from the deployment (think environment name, S3 bucket URL etc).