Skip to content

Create backend and frontend code locally to do amplify manual CI/CD with GHES repoΒ #919

@sesa575445

Description

@sesa575445

Describe the feature you'd like to request

Hi Team,
Hope this message finds you well.
In our office project, we are trying to migrate our amplify codebase from github.com to ghes (our internal GHES instance). In the process, I have gone through the process attached in the given text file to:

  1. Build Frontend build.zip file and upload to S3 to run (with aws amplify create-deployment and aws amplify start-deployment)
  2. Build Backend artifact (Current cloud backend with cloud formation template json) and upload amplify-builds/ to our custom S3 deployment bucket.
    Frontend build.zip was successful.
    But the 2nd point, I have tried the following:
    I am not using github for amplify to build itself. I want to compile backend locally of my local amplify/backend/ and produce new amplify-builds/ and upload to s3 with aws amplify create-backend commmand line.

Error:
#####################################################################################################
I have run below command to build backend api,functions code under amplify/backend/awscloudformation/build.
#####################################################################################################
1.amplify push --codegen
Error: Not able to find backend environment.

2.Try, amplify pull --appId d173tjf92bxxxx --envName testmig
Error: Γ— There was an error initializing your environment.
πŸ›‘ Could not find a deployment bucket for the specified backend environment. This environment may have been deleted.
Resolution: Make sure the environment has been initialized with "amplify init" or "amplify env add".

3.amplify add env testmig
Note: It is recommended to run this command from the root of your app directory
Using default provider awscloudformation

  • Initializing your environment: testmig
    Γ— Initializing your environment: testmig
    Γ— There was an error initializing your environment.
    πŸ›‘ Could not initialize platform for 'testmig': The specified key does not exist.

It seems like the error "The specified s3 key does not exist" is still persisting. I have all the meta data properly written in team-provider-info.json to determine where to push the build artifacts and how to configure the backend environment.
Updating team-provider-info.json:

Please advise as it is critical for us to move our amplify code from github.com to internal GHES.
Thanks,
Sriram
amplify_push_codegen_keydoesn't_exit.txt

Describe the solution you'd like

I want the following to be done gracefully without errors.

  1. Compile Backend Locally:

    • Run amplify push --codegen to compile the backend and generate the necessary build artifacts.
  2. Prepare Deployment Artifacts:

    • Copy the contents of amplify/#current-cloud-backend/ to a new directory:
      cp -r amplify/#current-cloud-backend/ amplify-builds/
  3. Upload Artifacts to S3:

    • Create an S3 bucket if needed:
      aws s3 mb s3://your-deployment-bucket-name
    • Sync the amplify-builds/ directory with your S3 bucket:
      aws s3 sync amplify-builds/ s3://your-deployment-bucket-name/amplify-builds/
  4. Create Backend Environment Using AWS CLI:

    • Use the aws amplify create-backend-environment command to create the backend environment:
      aws amplify create-backend-environment \
          --app-id <your-app-id> \
          --environment-name testmig \
          --stack-name <your-stack-name> \
          --deployment-artifacts s3://your-deployment-bucket-name/amplify-builds/

Describe alternatives you've considered

I haven't received not much inputs from amplify issues in github.com

Additional context

No response

Is this something that you'd be interested in working on?

  • πŸ‘‹ I may be able to implement this feature request

Would this feature include a breaking change?

  • ⚠️ This feature might incur a breaking change

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions