Skip to content

Conversation

@iankhou
Copy link

@iankhou iankhou commented Nov 12, 2025

Description of changes

Enables refactor of the analytics category (for Kinesis).

Requires a Gen1 application with analytics configured using Kinesis, and a Gen2 application that deploys an analytics CFn stack that matches the Gen1 structure.

Description of how you validated changes

Create a Gen1 app with analytics, deploy the backend.

Create a Gen2 app with analytics, deploy the backend. This is more difficult because we don't have codegen for it, so we need to align the CFn resource configuration with the Gen1 app, within the analytics stack we create though CDK.

Screenshot 2025-11-13 at 15 44 55

The Kinesis stream was successfully moved from a Gen1 stack to a Gen2 stack.

Checklist

  • PR description included
  • yarn test passes
  • Tests are changed or added
  • Relevant documentation is changed or added (and PR referenced)
  • New AWS SDK calls or CloudFormation actions have been added to relevant test and service IAM policies
  • Pull request labels are added

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

['auth', AUTH_RESOURCES_TO_REFACTOR],
['auth-user-pool-group', AUTH_USER_POOL_GROUP_RESOURCES_TO_REFACTOR],
['storage', [CFN_S3_TYPE.Bucket]],
['analytics', ANALYTICS_RESOURCES_TO_REFACTOR],
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Used for rollback, not used yet.

const GEN2_AMPLIFY_AUTH_LOGICAL_ID_PREFIX = 'amplifyAuth';

const CATEGORIES: CATEGORY[] = ['auth', 'storage'];
const CATEGORIES: CATEGORY[] = ['auth', 'storage', 'analytics'];
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Strings in this array are used to check against the prefix of category stacks in both Gen1 and Gen2. In Gen1, the analytics stack always starts with "analyticsamplify", but in Gen2, it can be any name. Codegen will need to handle the naming accordingly.

}

export enum CFN_ANALYTICS_TYPE {
Stream = 'AWS::Kinesis::Stream',
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the only stateful resource for Kinesis-based analytics. The rest are IAM roles and policies.

// output is already in ARN format
Arn: resourceIdentifier,
};
default:
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should probably default to resourceIdentifier instead of undefined... but we will take a deeper look at this later.

AUTH = 'auth',
STORAGE = 'storage',
AUTH_USER_POOL_GROUP = 'auth-user-pool-group',
ANALYTICS = 'analytics',
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Included this here so that the custom resource flow is not triggered.

@iankhou iankhou marked this pull request as ready for review November 13, 2025 20:49
@iankhou iankhou requested a review from a team as a code owner November 13, 2025 20:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant