You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/pages/[platform]/start/migrate-to-gen2/migrate-existing-app/index.mdx
+123-8Lines changed: 123 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -188,6 +188,13 @@ The migration tool requires the following API actions in addition to the standar
188
188
"s3:GetEncryptionConfiguration"
189
189
],
190
190
"Resource": "*"
191
+
},
192
+
{
193
+
"Effect": "Allow",
194
+
"Action": [
195
+
"cloudformation:GetResource"
196
+
],
197
+
"Resource": "*"
191
198
}
192
199
]
193
200
}
@@ -347,6 +354,37 @@ During the migration period your Gen 1 environment should not undergo any change
347
354
amplify gen2-migration lock
348
355
```
349
356
357
+
The lock step also sets a `Retain` deletion policy on all stateful resources in your Gen 1 stacks to protect them during migration.
358
+
359
+
<Accordiontitle="Custom stateful resource types">
360
+
361
+
The migration tool maintains a default list of CloudFormation resource types it considers stateful (e.g. `AWS::Cognito::UserPool`, `AWS::S3::Bucket`, `AWS::DynamoDB::Table`). During the lock step, only resources matching these types receive the `Retain` deletion policy.
362
+
363
+
If your application includes custom resources that contain stateful CloudFormation types not in the default list, you can provide them using the `--additional-stateful-resource-types` option. Create a JSON file with an array of CloudFormation resource type strings:
This command introspects your deployed Gen 1 CloudFormation stacks and generates the equivalent Gen 2 TypeScript backend definition files, overriding your local `./amplify` directory. The generated code is a starting point — some features require manual edits before deploying (see below).
389
427
428
+
<Accordiontitle="Custom stateful resource types">
429
+
430
+
The migration tool maintains a default list of CloudFormation resource types it considers stateful (e.g. `AWS::Cognito::UserPool`, `AWS::S3::Bucket`, `AWS::DynamoDB::Table`). During code generation, the tool uses this list to produce a `Retain` deletion policy in the Gen 2 CDK code for these resources, ensuring they don't override the deletion policy of the Gen 1 resources after refactoring.
431
+
432
+
If your application includes custom resources that contain stateful CloudFormation types not in the default list, you can provide them using the `--additional-stateful-resource-types` option. Create a JSON file with an array of CloudFormation resource type strings:
The types you provide are merged with the built-in defaults. This ensures the generated Gen 2 code includes retention policies for your custom stateful resources.
448
+
449
+
</Accordion>
450
+
390
451
Once successful, clean up and reinstall dependencies to avoid stale resolution artifacts from the Gen 1 dependency tree:
391
452
392
453
```bash
@@ -437,6 +498,8 @@ If you use the standard `Amplify.configure(...)` call and access resources throu
437
498
+ apiName: '<gen2-rest-api-name>',
438
499
```
439
500
501
+
In addition, follow these [instructions](https://docs.amplify.aws/react/build-a-backend/add-aws-services/rest-api/set-up-rest-api/#initialize-amplify-api) to reconfigure your `Amplify` instance based on the outputs structure of Gen2.
502
+
440
503
**Kinesis** — If your frontend sends analytics events to a Kinesis stream, update the stream name to point to the new Gen 2 stream:
441
504
442
505
```diff
@@ -500,6 +563,25 @@ See [Secrets](https://docs.amplify.aws/react/build-a-backend/functions/environme
500
563
501
564
</Callout>
502
565
566
+
#### Auth
567
+
568
+
##### External Identity Providers
569
+
570
+
If your Gen1 app uses social sign-in (Facebook, Google), thegenerated `callbackUrls` and `logoutUrls` in `./amplify/auth/resource.ts` areinheritedfromGen 1 andreferencetheGen 1 AmplifyHostingURLsonly. TheGen 2 hostingURLmustbeaddedbeforetheHostedUIwillacceptsign-insfromtheGen 2 frontend.
IfyourapplicationincludescustomresourcesthatcontainstatefulCloudFormationtypesnotinthedefaultlist, youcanprovidethemusingthe `--additional-stateful-resource-types` option — thesamefileyouusedinthe [lockstep](#step-2-lock). Create a JSON file with an array of CloudFormation resource type strings:
The types you provide are merged with the built-in defaults. This ensures the tool correctly identifies and transfers your custom stateful resources during the refactoring step.
722
+
723
+
</Accordion>
724
+
612
725
<Callout info>
613
726
614
727
After the refactor step, a `.amplify/gen2-migration/refactor.operations/` directory is created containing snapshots of every CloudFormation operation performed — templates, parameters, and resource mappings. These files can help with auditing or troubleshooting and are safe to delete once migration is confirmed successful.
@@ -621,11 +734,13 @@ If the refactor fails or produces undesired results, roll it back:
If you had already completed [Step8: Post-Refactor](#step-8-post-refactor-critical) before rolling back, re-comment `postRefactor();` in `./amplify/backend.ts` on the `gen2-main` branch and push. The function targets resources that the Gen 2 stack no longer owns after rollback and will fail at synth otherwise.
738
+
624
739
After rolling back, you will need to unlock the Gen 1 environment and redeploy it to restore normal operation:
0 commit comments