GraphQL Managed Service
GraphQL Managed Service
Idea Initiator
Status IN REVIEW
Governance
Design Authority
Endorsed ( | )
Who Role Date Endorsement Evidence
Endorsed
Design Approval
Approved( | )
Who Date Approval Evidence
Approved
@Srikanth Yelakaturu
Idea Initiator
Consulted
Who Comments
Product/Business Owner
Data Governance
Legal
Privacy
Dependent/Impacted
System Owner(s)
Vendor
Other Stakeholders
Related Artefacts
Solution Design
Proof of Concept
Business Context
Technical Design(s)
Governance
Design Authority
Design Approval
Consulted
Related Artefacts
Design Request
Idea
GraphQL is particularly advantageous when:
When REST Might Be Better
Timing
Size and Complexity
Priority
Design Direction
Solution
Options Analysis
Guardrails/Governance for AppSync
Authentication and Authorization:
Data Encryption:
Resolver Optimization:
Query Complexity Limits:
Cost Monitoring:
API Rate Limits:
Resolver Optimization:
High Availability:
Monitor and Auto-Scale:
Versioning and Deployment:
Logging and Monitoring:
Schema Design:
Testing and Debugging:
Documentation and Developer Access:
GraphQL Query Templates
Structure of Query Templates
Uses Cases:
Templates storage and Management
Potential Security Risks
Security Features Provided by AppSync
Governance for Secure Query Templates
Governance for aggregation of data across tables, views, datastores to ensure that joins are done consistently
Potential Scenarios
Consistency of responses across channels
Dependencies and Impacts
Design Decisions
AppSync Proof of Concept
Risks and Opportunities
Solution Design Estimate
Security Impact Assessment
Third-Party Risk Assessment
Conceptual Model
Data Classification
Data Impact Assessment
Business Continuity Management
Delivery Estimate
Architecture Principles Alignment
Design Request
Idea
What is the business problem or opportunity a design has been requested to resolve?
Technology standards considered for BFF API Implementation. Idea is to explore implementing BFF as GraphQL APIs with AWS AppSync.
Important Business Problems that can be addressed using AWS AppSync - GraphQL APIs
Real-Time Collaboration Applications: To build a real-time collaboration platform (e.g., shared document editing, task management, or a
live whiteboard) where updates from one user are instantly reflected for all other users.
Multi-Platform Data Access: An organization has multiple front-end clients (web, mobile, IoT devices) that require access to a unified
backend data model sourced from diverse systems like databases, third-party APIs, and microservices.
Search and Recommendation Engines: A platform wants to provide personalized product recommendations and robust search
capabilities for their users. Integrates with Amazon OpenSearch to handle search and ranking.
Data Aggregation for Microservices: An enterprise with a microservices architecture needs to aggregate data from multiple microservices
into a single interface for front-end applications.
Content Management Systems (CMS): Want to deliver dynamic, personalized content (e.g., news articles, videos) to users across
platforms while minimizing latency.
Event-Driven Applications: A scalable system to handle high traffic during search, ensure data consistency, and provide updates in real
time.
Development teams are increasingly choosing to build their APIs with GraphQL over the traditional REST API approach due to following
reasons as well
Single Endpoint Uses a single endpoint (e.g., /graphql ) Requires multiple endpoints (e.g., /users ,
for all operations (queries, mutations, and /posts , /comments ), which can lead to
subscriptions). This simplifies API complex endpoint management as the API
management and integration. evolves.
Strongly-Typed Schema Enforces a strongly-typed schema that Does not enforce strict typing, leading to
defines the structure of the API, the data potential inconsistencies in returned data
types, and the relationships between formats.
entities. This ensures consistency and
provides a clear contract between clients
and servers.
Real-Time Capabilities Supports real-time data updates using Requires additional mechanisms like
subscriptions, enabling clients to receive WebSockets or polling to achieve real-time
updates as soon as the data changes. updates, which adds complexity.
Efficient Data Handling Batch data retrieval is built-in. Clients can Often requires multiple round-trips to the
fetch data from multiple sources in one server to retrieve related data, leading to
request using resolvers. higher latency and more bandwidth usage.
Versionless API Evolving the API doesn't require creating API versioning (e.g., /v1/users ,
new versions. New fields can be added to /v2/users ) is common, which can create
the schema without affecting existing maintenance overhead and compatibility
clients, as clients only query what they challenges.
need.
Built-In Documentation Introspective queries allow clients to query Requires external tools (e.g., Swagger,
the schema itself for documentation. Tools Postman) to document the API manually.
like GraphiQL or Apollo Studio
automatically generate interactive
documentation.
Client-Driven Development Shifts control to the client by letting it define Server-driven responses limit flexibility,
the shape of the response. This is often requiring frontend changes if API
particularly useful for frontend teams responses need adjustments.
working on dynamic or diverse client
needs.
This Design Direction recommends a POC using AWS AppSync which should satisfy criteria mentioned in the AppSync PoC section
which will help in taking a decision if AWS AppSync, a fully managed Service providing Serverless GraphQL API solutions can be
used as a BFF Layer as part of IDP Target state Architecture.
Timing
When is it required to be ready for Engineering? Which PI or Sprint or date?
Priority
What is the business priority?
Design Direction
Solution
What is the proposed solution architecture / technical solution?
Proposed solution is to decide if AWS AppSync, a fully managed Service providing Serverless GraphQL API solutions can be used as a BFF
Layer as part of IDP Target state Architecture due to the reasons mentioned in the Idea section.
Options Analysis
What options have been investigated and what rationale/evidence do you have to show that the full set has been investigated?
Direct support of Yes (to be defined in JSON Yes (GraphQL schema definitions inherently
Response Validation Schema) enforce validation on data returned by
resolvers)
Caching options Yes (provides built-in caching at the Yes (resolver-level caching with Amazon
stage level using Amazon API DynamoDB Accelerator (DAX) or its built-in
Gateway Cache, backed by a fully AppSync Data Caching feature.)
managed Amazon CloudFront
Cache Scope - query/mutation granularity
distribution)
Scalability Yes, but requires configuration like More scalable for extremely high traffic
throttling and need global APIs applications
optimized for edge delivery
Integration with other Possible Not possible with all, just with some AWS
services services
Direct Integration with With Most Services With most AWS Services
AWS Services
Limited support for some non-AWS services
compared to API Gateway, which can
connect to virtually any HTTP-based service.
Risks (Delivered) Already in use New Tech stack - Learning curve involved
Risks (Project) Already in use New Tech Stack needs learning curve which Engineering team
increases delivery timelines. confirms they have
enabled resources
with
AppSync/GraphQL
skills
Skills No additional skills required. GraphQL and AWS AppSync skills required
Current Tech stack.
Status
Recommended
Data Encryption:
High Availability:
Data Privacy:
Request Mapping Templates: A request mapping template transforms the GraphQL query into a format that the data source
understands.
Response Mapping Templates: A response mapping template formats the data returned by the data source into the structure expected
by the GraphQL schema.
Uses Cases:
In the AppSync Management Manage and edit query templates directly in the AWS Management Console for AppSync:
Console
Resolvers Section: Each field in GraphQL schema that needs a resolver has its associated
request and response mapping templates. To find:
Navigate to the Resolvers tab in the AppSync console.
Select the field or operation (e.g., Query.getItem , Mutation.createItem ).
Both the request and response mapping templates can be edited here.
In Infrastructure as Code If managing AppSync API using tools like AWS CloudFormation, AWS CDK, or Terraform, the query
(IaC) templates are stored as part of IaC configurations:
Stored Externally for Reuse For larger projects or to promote reusability and maintainability, mapping templates are often stored
in external files (e.g., .vtl files) and referenced in IaC or deployment scripts.
For example:
Overexposure of Data Improperly designed templates can expose 1. Use fine-grained access control by
sensitive data if: filtering or transforming data in the
response mapping templates.
They don't enforce access control.
2. Return only the data needed by the
They include too much information in
client.
the response ( $context.result ).
Leaking Secrets in Error Messages If errors are not handled properly in the Always sanitize error messages with
templates, sensitive data (e.g., database $util.error() and avoid returning
keys or internal logic) might be exposed in internal details.
error responses.
AWS AppSync ensures security for query templates through the following mechanisms:
Encryption at Rest Mapping templates stored in AppSync are encrypted at rest using
AWS-managed encryption keys. This ensures that the templates
themselves are protected from unauthorized access on AWS's
backend.
Role-Based Access Control (RBAC) Access to manage mapping templates is governed by AWS
Identity and Access Management (IAM). Team can control who
has permissions to:
Fine-Grained Access Control via Resolvers Mapping templates can include logic to enforce security
measures, such as:
Governance Implementation
Use IAM for Access Management 1. Limit access to the AppSync API and its resolvers to only
authorized users or roles.
2. Define least-privilege IAM policies to control who can view,
edit, or deploy templates.
Test for Security Vulnerabilities Use the AppSync Mapping Template Simulator to test queries
and mutations to identify unintended behaviors or data leaks.
Restrict Direct User Input in Queries 1. Avoid directly embedding unvalidated user inputs in query
expressions or headers.
2. Use predefined constants or validated inputs wherever
possible.
Use Logs for Monitoring Enable AWS CloudWatch logs for AppSync API to monitor:
Governance for aggregation of data across tables, views, datastores to ensure that joins are done consistently
In AWS AppSync, aggregating data across multiple tables, views, or data sources can be achieved through GraphQL resolvers. However,
ensuring that these "joins" are done consistently requires careful designing of schema, resolvers, and data sources. Here’s how this can be
governed and implemented effectively:
1 Use GraphQL Schema to Define The GraphQL schema acts as the contract between API and the clients,
Relationships defining the relationships between types. Relationships in the schema guide
how resolvers perform joins across data sources.
2 Use Pipeline Resolvers for Aggregation AppSync supports pipeline resolvers, which allow to chain multiple resolver
operations within a single GraphQL query. This is useful for performing
consistent joins across multiple data sources.
3 Leverage AWS Lambda for Complex Joins For complex joins or aggregations that require substantial computation or
integration with multiple data stores, AWS Lambda can serve as a resolver.
4 Enforce Consistency with Resolvers and To ensure joins are consistently governed:
Identity Context
Use $context.identity to enforce user-level access control in all
resolver stages.
Ensure resolvers share a consistent format for input and output data.
5 Optimize with Caching Data Source Level Caching: Use DynamoDB Accelerator (DAX) or RDS
query caching to minimize repeated joins.
AppSync API Caching: Enable caching in AppSync to store frequently
requested aggregated data.
6 Test and Validate with Stubs Use the AppSync Mapping Template Simulator to validate each stage of
data aggregation. Ensure that:
7 Monitor and Govern with Logging and 1. Enable AWS CloudWatch logs for AppSync to track resolver execution
Metrics and identify inconsistencies.
2. Use AppSync metrics to monitor latency for joins and adjust as needed.
Potential Scenarios
Scenario: To guarantee consistency when there are multiple consumers that need the same response from the databases, APIs or
Lambdas that GraphQL can consume
When multiple consumers need the same response from databases, APIs, or AWS Lambda functions that AppSync can query, we can
optimize the architecture by implementing strategies like caching, shared subscriptions, or using persistent queries. Here's how it can be
handled it effectively:
Persistent Queries 1. If clients are frequently requesting the same GraphQL query,
use persistent queries.
2. Persistent queries are pre-defined and stored on the server,
avoiding the need to send query definitions repeatedly.
3. This improves performance and reduces bandwidth usage.
Data Source Optimization 1. DynamoDB: Use indexes (GSI/LSI) for quick query responses.
2. RDS: Optimize SQL queries or consider materialized views for
pre-aggregated data.
3. API Gateway or REST APIs: Implement server-side caching
at API Gateway for frequently requested data.
Rate Limiting and Throttling To prevent excessive load on backend systems, implement rate
limiting or throttling mechanisms at the AppSync level or the
backend.
AWS Services
Design Decisions
What design decisions may be required?
D01 Decision is required 1. AppSync(Grap Please refer the Pros mentioned in Options
if AWS AppSync, a hQL) Table
fully managed 2. REST API
Service providing
Serverless GraphQL
API solutions can be
used as a BFF Layer
1 GraphQL API Setup: 1. Design and deploy a GraphQL schema with queries, mutations, and subscriptions.
2. Highlight the ease of defining relationships between data entities (e.g., one-to-many, many-to-
many).
4 Pipeline Resolvers: 1. Use pipeline resolvers to chain multiple operations (e.g., combining data from multiple
sources).
2. Example: Fetching additional data after a mutation.
5 Caching: 1. Enable AppSync caching to demonstrate performance improvements for repeated queries.
2. Configure TTL for query caching.
7 Field-Level Security: Use resolver-level permissions to restrict access to specific fields or data.
8 Scalable Demonstrate how AppSync integrates with scalable backend services (e.g., DynamoDB with on-
Architecture: demand capacity).
9 Offline Sync: 1. Implement offline capabilities for mobile/web apps using the AWS Amplify SDK with AppSync.
2. Example: Add and update data offline, and sync changes when reconnected.
10 Monitoring and 1. Enable AppSync logs in CloudWatch for tracking queries and resolving issues.
Logging: 2. Use X-Ray for tracing backend performance and latency.
Advanced Integrations
11 Custom Data 1. Create a custom data source to fetch data from a third-party API or another non-AWS service.
Sources: 2. Example: Fetching external weather or stock data.
Security Impact ( PURPLE = Extreme | RED = High | AMBER = Medium | GREEN = Low)
Conceptual Model
Provide a conceptual model that covers the data elements that will be impacted by this solution. A conceptual model serves as a high-level
representation of the organisation's data structures and relationships. This will help in the understanding of the data domain of change. The
conceptual model is described here. The designers of the Design Direction will need to consult with the Data Design Authority or Authorities
for the domains of change. The DDAs are listed here.
Not Applicable
Data Classification
What is the classification of the data the solution manages?
CONFIDENTIAL
AWS AppSync GraphQL APIs will handle Confidential PII data only as a Data Carrier. It does not manage or store any data.
Data Impact Assessment
If the solution process/ingest/publish highly confidential or confidential data:
How is RTBF going to be managed?
AWS AppSync is a data carrier service which handles Confidential data as well but its is encrypted as per IDP guidelines.
RTBF is managed by respective line of business as there is no data retention involved
What data retention period does the data have? Use IDP Standards | Enterprise Data Archiving and Retention policies
Not Applicable - No Data Retention
Delivery Estimate
What are the time or effort estimates to deliver the solution?
Note: Principles are the guardrails for building solutions that are consistent and standardised - where feasible, practical and appropriate. It
must be stressed that they are also not policy so if there is good reason (business and/or technical) for deviation then this can be discussed
through the governance process and an informed decision made on whether to grant an exemption.
:check_mark:
Fully Aligned Briefly explain how the solution is fully aligned.
:cross_mark:
Not Aligned Provide justification as to why the solution is not aligned.
:yellow_circle:
Partially Aligned Briefly explain how the solution is partially aligned, with justification.
:question_mark:
More information needed Explain what further clarification is required.
:info:
Not Applicable Briefly explain why this principle is not applicable.
Principles Alignment
Security & Privacy Principle 403: Designs meet the Security Control
Requirements
Security & Privacy Principle 404: Authorisation uses Role and Attribu
te Based Access Control