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

fix(aws-apigateway): CloudWatch logging should be disabled by default (under feature flag) #21546

Merged
merged 7 commits into from
Aug 12, 2022
Merged

fix(aws-apigateway): CloudWatch logging should be disabled by default (under feature flag) #21546

merged 7 commits into from
Aug 12, 2022

Commits on Aug 10, 2022

  1. fix(aws-apigateway): CloudWatch logging should be disabled by default…

    … (under feature flag)
    
    Currently when you create a RestApi cloudwatch logging is enabled by
    default. This will create an IAM role and a `AWS::ApiGateway::Account`
    resource, which is what is used to allow API Gateway to write API logs
    to CloudWatch logs. There can only be a single API Gateway account per
    AWS environment (account/region), but CloudFormation will not throw an
    error if you try to create additional accounts. Instead it will update
    the existing account with the new configuration.
    
    This can cause issues if customers create more than 1 RestApi.
    The following scenario is an example.
    
    1. Create a single `RestApi`
    A new `AWS::ApiGateway::Account` and IAM role is created.
    2. Create a second `RestApi`
    Another `AWS::ApiGateway::Account`/IAM role is created which
    _overwrites_ the first one. The first RestApi now uses the account/role
    created by this `RestApi`.
    3. Delete the second `RestApi`
    The `AWS::ApiGateway::Account`/IAM role is deleted along with the second
    `RestApi`. The first `RestApi` no longer has access to write to
    CloudWatch logs.
    
    Because of this behavior, the correct thing to do is to disable
    CloudWatch logs by default so that the user has to create the global
    resource separately. This new behavior is behind a feature flag
    `@aws-cdk/aws-apigateway:disableCloudWatchLogs`.
    
    In addition, the default retention policy for both the API Gateway
    account and IAM role has been set to `RETAIN` so that existing
    implementations that do not use the feature flag can avoid the above
    scenario. The resources will be unmanaged, but existing RestApis will
    not break.
    
    closes #10878
    corymhall committed Aug 10, 2022
    Configuration menu
    Copy the full SHA
    4bca66f View commit details
    Browse the repository at this point in the history

Commits on Aug 11, 2022

  1. Configuration menu
    Copy the full SHA
    75a6b6a View commit details
    Browse the repository at this point in the history
  2. updating readme

    corymhall committed Aug 11, 2022
    Configuration menu
    Copy the full SHA
    9254740 View commit details
    Browse the repository at this point in the history

Commits on Aug 12, 2022

  1. Configuration menu
    Copy the full SHA
    d62c2ec View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    48c3962 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    e6aa347 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    746b9e6 View commit details
    Browse the repository at this point in the history