aws-amplify / aws-amplify/amplify-cli

Exported Amplify backend is not fully building in Cdk deployment

Open
#12,350 11 comments 1 reaction 0 assignees View on GitHub
export feature-request p3
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?

v16.19.1

### Amplify CLI Version

11.0.3

### What operating system are you using?

Amazon Linux 2 (running in docker on Ubuntu WSL2)

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

No

### Describe the bug

In /app03/amp, using `amplify init`, I generated a new amplify backend for dev env. I generated the backend for flutter, so the amplifyconfiguration.dart file etc was generated. I see 2 IAM roles, 1 S3 bucket, with 3 files (1 zip, 3 json files), 1 cloudformation stack, and the generated backend project in amplify console.

In /app03/cdkapp, I generated a new cdk project with `cdk init app --language=typescript --generate-only`.

I export the backend using `amplify export --out ../cdkapp/lib`.

I delete the existing backend using `amplify delete`.

I update the cdk project to generate the exported amplify backend. I run `cdk deploy`.

I see 2 IAM roles, 1 S3 bucket (empty), 1 cloudformation stack. I see no project in the amplify console.

### Expected behavior

To have the same number of files in the associated S3 bucket which is generated, and to see the project generated in the amplify console.

### Reproduction steps

1. `cd /app03`
2. `mkdir amp`
3. `mkdir cdkapp`
4. `cd amp`
5. `amplify init`
* Choose access token access
* Input token values
* Choose app type "flutter"
6. `cd ../cdkapp`
7. `cdk init app --language=typescript --generate-only`
8. `npm i`
9. `cdk bootstrap`
10. `cd ..\amp`
11. `amplify export --out ../cdkapp/lib`
12. `amplify delete`
13. `cd ..\cdkapp`
14. `npm i @aws-amplify/cdk-exported-backend`
15. `npm i lodash`
16. Update bin/cdkapp.ts to have content
```
#!/usr/bin/env node
import 'source-map-support/register';
import * as cdk from 'aws-cdk-lib';
import { AmplifyExportedBackend } from '@aws-amplify/cdk-exported-backend'
import * as path from 'path' // To resolve the path to your exported Amplify backend assets

const app = new cdk.App();

const amplifyBackend = new AmplifyExportedBackend(app, "amplifyExportedBackend", {
amplifyEnvironment: "dev", // Specify your Amplify environment
path: path.resolve(__dirname, '../lib/amplify-export-app04')
})
```
18. `cdk deploy`

### Project Identifier

_No response_

### Log output

```
# Put your logs below this line

```

### 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.