cfn-response | micro package which exposes some helpers to talk | REST library
kandi X-RAY | cfn-response Summary
kandi X-RAY | cfn-response Summary
cfn-response is a micro package which exposes some helpers to talk with CloudFormation from within python Lambda functions. This package is intentionally small in order to be embedded inside lambda functions.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Sends a CloudWatch event .
cfn-response Key Features
cfn-response Examples and Code Snippets
Community Discussions
Trending Discussions on cfn-response
QUESTION
I have two Cloudformation templates
- one which creates a VPC, ALB and any other shared resources etc.
- one which creates an elastic beanstalk environment and relevant listener rules to direct traffic to this environment using the imported shared load balancer (call this template
Environment
)
The problem I'm facing is the Environment
template creates a AWS::ElasticBeanstalk::Environment
which subsequently creates a new CFN stack which contains things such as the ASG, and Target Group (or process as it is known to elastic beanstalk). These resources are not outputs of the AWS owned CFN template used to create the environment.
When setting
...ANSWER
Answered 2021-Apr-30 at 01:10I don't have access as far as I can tell to the ARN of the target group created by the elastic beanstalk environment resource
That's true. The way to overcome this is through custom resource. In fact I developed fully working, very similar resource for one of my previous answers, thus you can have a look at it and adopt to your templates. The resource returns ARN of the EB load balancer, but you could modify it to get the ARN of EB's target group instead.
QUESTION
I have a CF template that uses a Serverless function in Javascript to instantiate an AWS Connect instance as there is no actual CF resource for Connect. I use environment variables to pass in values from CF into the inline Javascript. Now I need the reverse: to extract some of those values back out of JS and pass them back to other parts of the CF template. So, the question is, how do I pass a variable from Javascript to CloudFormation? I suspect I'll need to use something like the Systems Manager Parameter store but perhaps there's an easier way? Specifically I need the value "serviceRole" in the below snippet available to pass to other CF resources:
...ANSWER
Answered 2020-Dec-21 at 08:56When sending the "SUCCESS" response to CloudFormation, you can use the Data field of the response object to pass the Service Role as a key-value pair. This way, all resources that are created after the Custom Resource can access this information using Fn::GetAtt. From the docs:
After getting a SUCCESS response, AWS CloudFormation proceeds with the stack operation. If a FAILED response or no response is returned, the operation fails. Any output data from the custom resource is stored in the pre-signed URL location. The template developer can retrieve that data by using the Fn::GetAtt function.
QUESTION
I am having a hard time to write code for my lambda function. This function has to download files into /tmp directory but instead of doing that it creates files with 0 size. The output looks like that:
2020-07-13T21:28:09.694-05:00 2020-07-14T02:28:09.681Z a914d6fa-0b29-4c66-8cc5-95095575be7b INFO /tmp/7za123.zip
2020-07-13T21:28:09.994-05:00 2020-07-14T02:28:09.975Z a914d6fa-0b29-4c66-8cc5-95095575be7b INFO /tmp/7za321.zip
2020-07-13T21:28:10.014-05:00 2020-07-14T02:28:09.995Z a914d6fa-0b29-4c66-8cc5-95095575be7b INFO /tmp/7za920.zip
2020-07-13T21:28:10.016-05:00 2020-07-14T02:28:10.016Z a914d6fa-0b29-4c66-8cc5-95095575be7b INFO 0
2020-07-13T21:28:10.017-05:00 2020-07-14T02:28:10.017Z a914d6fa-0b29-4c66-8cc5-95095575be7b INFO 0
2020-07-13T21:28:10.017-05:00 2020-07-14T02:28:10.017Z a914d6fa-0b29-4c66-8cc5-95095575be7b INFO 0
Could you help me to fix it?
...ANSWER
Answered 2020-Jul-18 at 10:20You have to wait for the Writable Stream to fire the 'finish' event.
What is happening there is that the process terminates almost immediately because it never waits for the request.pipe(file) to be actually executed.
One strategy to do that involves 2 extra steps:
- use async/awaits in loops (aka ECMAScript 2018 Asynchronous Iteration), something like:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install cfn-response
You can use cfn-response like any standard Python library. You will need to make sure that you have a development environment consisting of a Python distribution including header files, a compiler, pip, and git installed. Make sure that your pip, setuptools, and wheel are up to date. When using pip it is generally recommended to install packages in a virtual environment to avoid changes to the system.
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page