Skip to content
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

[synthetics] Support setting environment variables during canary creation #10515

Closed
2 tasks
dlee-cpu opened this issue Sep 24, 2020 · 6 comments · Fixed by #15082
Closed
2 tasks

[synthetics] Support setting environment variables during canary creation #10515

dlee-cpu opened this issue Sep 24, 2020 · 6 comments · Fixed by #15082
Assignees
Labels
@aws-cdk/aws-synthetics Related to Amazon CloudWatch Synthetics

Comments

@dlee-cpu
Copy link

Support setting environment variables during canary creation

Use Case

Since the canary is wrapped by a lambda, we should be able to create env variables that are available during the lambda execution so we can pass additional runtime information during test runs.

Proposed Solution

Other

  • 👋 I may be able to implement this feature request
  • ⚠️ This feature might incur a breaking change

This is a 🚀 Feature Request

@dlee-cpu dlee-cpu added feature-request A feature should be added or improved. needs-triage This issue or PR still needs to be triaged. labels Sep 24, 2020
@github-actions github-actions bot added the @aws-cdk/aws-synthetics Related to Amazon CloudWatch Synthetics label Sep 24, 2020
@NetaNir
Copy link
Contributor

NetaNir commented Sep 24, 2020

It does not seem like it is possible to configure the environment variable using Canary CloudFormation resource. When creating a Canary the synthetics service creates a lambda function on your behalf, the lambda resource itself is not created via CloudFormation, so if the Canary resource does not expose these properties on its API there is no (easy) way to change them using the resource.

@NetaNir NetaNir added response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. and removed feature-request A feature should be added or improved. needs-triage This issue or PR still needs to be triaged. labels Sep 24, 2020
@dlee-cpu
Copy link
Author

thanks for the reply. I should have opened this as a feature request to the cloudformation canary resource rather than the cdk.

@flochaz
Copy link
Contributor

flochaz commented Dec 3, 2020

It's now possible ( https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-synthetics-canary-runconfig.html#cfn-synthetics-canary-runconfig-environmentvariables )

@dlee-cpu
Copy link
Author

dlee-cpu commented Dec 3, 2020

It's now possible ( https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-synthetics-canary-runconfig.html#cfn-synthetics-canary-runconfig-environmentvariables )

thanks for keeping me in the loop and constantly improving the developer experience.

@jonny-rimek
Copy link

adding an env var looks like this:

        const cfnCanary = canary.node.defaultChild as synthetics.CfnCanary
        cfnCanary.addPropertyOverride('RunConfig.EnvironmentVariables', {
            API_URL: "someurl"
        })

@BenChaimberg BenChaimberg reopened this Jun 11, 2021
@peterwoodworth peterwoodworth removed the response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. label Jun 11, 2021
@mergify mergify bot closed this as completed in #15082 Jun 16, 2021
mergify bot pushed a commit that referenced this issue Jun 16, 2021
Add support for canary environment variables that will be threaded to the underlying Lambda function. This allows multiple canaries to use the same source code by extracting configuration to the resource specification.

Also makes the README snippets compile since it was hard to tell whether my changes were correct.

closes #10515
refer #9300

Co-authored-by: Florian Chazal <florianchazal@gmail.com>

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
@github-actions
Copy link

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

matthewsvu pushed a commit to matthewsvu/aws-cdk that referenced this issue Jun 22, 2021
Add support for canary environment variables that will be threaded to the underlying Lambda function. This allows multiple canaries to use the same source code by extracting configuration to the resource specification.

Also makes the README snippets compile since it was hard to tell whether my changes were correct.

closes aws#10515
refer aws#9300

Co-authored-by: Florian Chazal <florianchazal@gmail.com>

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
hollanddd pushed a commit to hollanddd/aws-cdk that referenced this issue Aug 26, 2021
Add support for canary environment variables that will be threaded to the underlying Lambda function. This allows multiple canaries to use the same source code by extracting configuration to the resource specification.

Also makes the README snippets compile since it was hard to tell whether my changes were correct.

closes aws#10515
refer aws#9300

Co-authored-by: Florian Chazal <florianchazal@gmail.com>

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-synthetics Related to Amazon CloudWatch Synthetics
Projects
None yet
6 participants