aws-amplify / aws-amplify/amplify-cli

Gen1 to Gen2 migration fails with MethodNotAllowed error for S3 Transfer Acceleration in unsupported regions (eu-north-1)

Open
#14,876 1 comment 0 reactions 1 assignee Claimed by @sharonyajain View on GitHub
gen2-migration p1
Dominant language
TypeScript
Stars
2.9k
Forks
825
Avg merge
11d 23h
Merged PRs (30d)
2

Description

### How did you install the Amplify CLI?

npm

### If applicable, what version of Node.js are you using?

v20.10.0

### Amplify CLI Version

14.4.0

### What operating system are you using?

Windows 11

### Did you make any manual changes to the cloud resources managed by Amplify? Please describe the changes made.

Some Lambda resources had previously been modified manually in AWS Console:
- Lambda runtimes were updated to nodejs22.x
- Lambda execution roles had inline permissions added for Secrets Manager
- WebsocketMessageForwarder also had execute-api:ManageConnections permission

Before retrying migration, I updated the local Amplify Gen 1 function CloudFormation templates/custom-policies.json files and ran amplify push so the runtime/policy drift was mostly reconciled.

The current generate failure appears unrelated to those changes and occurs during S3 storage planning.

### Describe the bug

I am migrating an Amplify Gen 1 app to Amplify Gen 2 using the official gen2-migration commands.

`amplify gen2-migration lock --skip-validations` succeeds, but `amplify gen2-migration generate` fails during the planning phase with:

"The specified method is not allowed against this resource."

Running with `--debug` shows the error comes from the S3 storage generator:

- AwsFetcher.fetchBucketAccelerate
- S3Generator.plan
- gen2-migration/generate/amplify/storage/s3.generator.js

The generator appears to call `GetBucketAccelerateConfiguration` on an S3 bucket in eu-north-1. That API returns `MethodNotAllowed` for this bucket/region.

The same error can be reproduced directly with AWS CLI:

`aws s3api get-bucket-accelerate-configuration --bucket tiemerkintalaite-storage-for-vehicle111901-dev --region eu-north-1`

This returns:

`An error occurred (MethodNotAllowed) when calling the GetBucketAccelerateConfiguration operation: The specified method is not allowed against this resource.`

Trying to set acceleration to suspended also fails:

`aws s3api put-bucket-accelerate-configuration --bucket tiemerkintalaite-storage-for-vehicle111901-dev --accelerate-configuration Status=Suspended --region eu-north-1`

This also returns `MethodNotAllowed`.

Expected behavior: the migration generator should handle this S3 API error gracefully, assume acceleration is unavailable/disabled, and continue generating the Gen 2 backend.

### Expected behavior

`amplify gen2-migration generate` should complete successfully.

If `GetBucketAccelerateConfiguration` is not supported for a bucket/region, the migration tool should treat Transfer Acceleration as unavailable/disabled and continue generating the Gen 2 storage resource.

### Reproduction steps

1. Have an Amplify Gen 1 app in eu-north-1 with an Amplify-managed S3 storage resource.
2. Run `amplify gen2-migration assess`.
3. Run `amplify gen2-migration lock --skip-validations`.
4. Run `amplify gen2-migration generate`.
5. The command fails during planning with:
`The specified method is not allowed against this resource.`
6. Run `amplify gen2-migration generate --debug`.
7. Debug output shows failure in:
- AwsFetcher.fetchBucketAccelerate
- S3Generator.plan

### Project Identifier

Region: eu-north-1
Amplify Gen 1 environment: dev
Storage resource name: tiemerkintastorageforvehicle
Physical S3 bucket: tiemerkintalaite-storage-for-vehicle111901-dev
Migration command: amplify gen2-migration generate
Session Identifier: 5a0e67be-d621-4c5c-91c7-5925e581b348

### Log output

```
# Put your logs below this line
UnknownFault: The specified method is not allowed against this resource.
MethodNotAllowed: The specified method is not allowed against this resource.
at throwDefaultError (...@smithy\smithy-client...)
at de_CommandError (...@aws-sdk\client-s3...)
at AwsFetcher.fetchBucketAccelerate (...@aws-amplify\cli-internal\lib\commands\gen2-migration\_common\aws-fetcher.js...)
at S3Generator.plan (...@aws-amplify\cli-internal\lib\commands\gen2-migration\generate\amplify\storage\s3.generator.js...)
at AmplifyMigrationGenerateStep.forward (...gen2-migration\generate.js...)

```

### Additional information

_No response_

### Before submitting, please confirm:

- [x] I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.
- [x] I have removed any sensitive information from my code snippets and submission.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.