How can I pull changes made on the AppSync web-console with the Amplify CLI "pull" command - aws-appsync

What I want to accomplish:
I have edited an amplify + AppSync project on the AppSync web console and I want to pull it onto my local machine.
What I did:
I have initialized an amplify project with the Amplify CLI by executing three commands:
amplify init
amplify add api
amplify push
(the added api is GraphQL)
Next I edited some of the auto generated GraphQL resolvers on the AppSync web console. (I have tested the edited resolvers with a client app -> they worked)
Afterwards however, when I execute a pull in the Amplify CLI:
amplify pull
it only pulls changes made to the local files before the last Amplify CLI push command,
so any changes made to the AppSync web console are not taken into account by the Amplify CLI pull command.
Questions:
Is this expected behavior?
Is there a way to include changes made to the Web Console in the Amplify CLI pull command? (especially changed resolvers)
Versions:
amplify cli: 4.13.3
Additional Things I Discovered That Could Be Helpful:
AWS-CloudFormation also only shows updates when changes are made using the Amplify CLI.
The AWS-S3 bucket that holds the amplify projects files, also only mirrors the changes pushed using the Amplify CLI.

You can do this manually by downloading the schema file from the console and replacing /amplify/backend/api/schema.graphql then running amplify push.
There is an issue open to automate this here: https://github.com/aws-amplify/amplify-cli/issues/1220

Related

Unable to update appClientId locally in Flutter using AWS Amplify

I am using AWS Amplify for Flutter. I generated many configurations using the CLI and pushed them to AWS using amplify push. For some reason, I had to delete the App client created using Amplify after which I manually created an app client in Cognito.
Created App client in Cognito User Pool
Now I changed the app client ID in Flutter project to the new one(blurred in the images) in amplifyconfiguration.dart and amplify-meta.json in backend/ directory. According to Amplify CLI docs, we are allowed to do manual edits to amplify/backend.
amplify-meta.json change
Finally I did an amplify push so that these changes are deployed to Cloud too. But when I checked the amplify-meta.json in the backend/ directory, I saw that the app client ID was reverted back to the old one which I had deleted initially.
I feel this is the reason why I am not able to get the correct access token for a session, can someone please help me to know how I can update the app client ID locally??

How to change Amplify backend in local Flutter project

I have an Flutter project which is using Amazon Amplify resources.
My problem is that I have two Amplify solutions ( seperate appId, not just dev/prod environments ) that I'm using with my Flutter application.
Whenever I try to switch the Amplify files in local with : amplify pull --appId --envName dev.
I receive the error:
Amplify appId mismatch.
You are currently working in the amplify project with Id
Is there a way to switch appId's without deleting the Amplify CLI and installing it again?
It is supposed that when you go to the Backend environment of the app in Amplify it shows you:
amplify pull --appId ######### --envName dev
With the #'s as the id of the app. After that, you use:
amplify init
And this should allow you to select the new environment of the app.

Programmatically Connecting a GitHub repo to a Google Cloud Project

I'm working on a Terraform project that will set up all the GCP resources needed for a large project spanning multiple GitHub repos. My goal is to be able to recreate the cloud infrastructure from scratch completely with Terraform.
The issue I'm running into is in order to setup build triggers with Terraform within GCP, the GitHub repo that is setting off the trigger first needs to be connected. Currently, I've only been able to do that manually via the Google Cloud Build dashboard. I'm not sure if this is possible via Terraform or with a script but I'm looking for any solution I can automate this with. Once the projects are connected updating everything with Terraform is working fine.
TLDR; How can I programmatically connect a GitHub project with a GCP project instead of using the dashboard?
Currently there is no way to programmatically connect a GitHub repo to a Google Cloud Project. This must be done manually via Google Cloud.
My workaround is to manually connect an "admin" project, build containers and save them to that project's artifact registry, and then deploy the containers from the registry in the programmatically generated project.

Generate Swift Code From Changed GraphQL File Without Pushing Changes To The Cloud

I use AWS Amplify & GraphQL inside my iOS project. I would like to update my API.swift file based on my changed GraphQL file. The following Amplify CLI command accomplishes this, but pushes changes to the cloud...
amplify push
How can I generate an updated GraphQL file without pushing changes to the cloud?
Are you making changes to your schema or your queries/mutations? If you're making changes to your queries and mutations inside your graphql folder with the queries.graphql, mutations.graphql, and subscriptions.graphql, you can run amplify codegen types

How to generate graphql statements from aws schema.graphql using amplify

So I created schema.graphql using amplify add api command, but I said No when it offered me to generate queries, mutations and subscriptions.
Now I am wondering, how can I generate them after the fact? Or do I have to go through whole amplify add api process again?
There is an additional command that you can use to initiate the code generation.
You can run amplify configure codegen to configure it (accepting the defaults is probably fine). Anytime after you have made schema changes, you can then run amplify codegen types to re-generate your types (make sure to run an amplify push before you do so).
More info here: https://aws-amplify.github.io/docs/cli/codegen