|
AppSync doesn’t allow unauthenticated API calls. To allow users to call your API without first authenticating themselves, you must mimic the behaviour using one of the available authorization methods [1]. In this post, let’s look at three ways to implement unauthenticated GraphQL operations with AppSync and their pros & cons. API KeysTo use API keys, you need to:
That’s it! It’s the easiest and most common way to implement unauthenticated GraphQL operations in AppSync. However, AppSync API keys has a max expiry of 365 days. You can extend this by a further 365 days with the UpdateApiKey API [2]. There is no limit to how many times you can extend an API key’s expiry date. In practice, it means you need a cron job to keep extending your API key’s expiry. It’s a manageable nuisance. Finally, there’s no extra charge for using API keys. Lambda authorizerWith a Lambda authorizer, the caller must provide a non-empty string in the This gives you more control over the lifecycle of the shared secret (compared to using API keys). You can also support multiple shared secrets with different levels of access. For example, different shared secrets for different clients, like this: This is easy to implement, and you can cache authorization results for up to an hour. Furthermore, you can eliminate invalid authorization headers using the It’s a regex that allows AppSync to reject invalid However, even with caching, there will still be additional charges involved for the Lambda authorizer. There is also a performance hit because of Lambda cold starts, especially if caching means the function will not be invoked frequently. AWS IAMLastly, you can use Cognito Identity Pool to issue temporary IAM credentials for unauthenticated clients. The client can then use these temporary IAM credentials to call AppSync. Cognito Identity Pool is free to use, but the GetCredentialsForIdentity API call has a default throughput limit of 200 reqs/s. Luckily, this is a soft limit and can be raised through the Service Quotas console or a support ticket. ConclusionsYou can enable unauthenticated GraphQL operations in AppSync through three main approaches.
Here is a side-by-side comparison of their pros and cons: Links[1] Configuring authorization and authentication to secure your GraphQL APIs [2] UpdateApiKey API |
Join 17K readers and level up you AWS game with just 5 mins a week.
Modern applications rarely do just one thing at a time. An API request creates an order, and then another service needs to reserve stock, another to charge the customer, another to send an email, and so on. In a serverless or event-driven architecture, follow-up actions are usually triggered by messages (either events or commands). That gives us loose coupling, better scalability, and independent services. But it also introduces a reliability problem. “What happens when the database update...
If you use Claude Code a lot, you’ve probably run into usage limits, sometimes even in short coding sessions. But cost isn’t the only problem. In long-running sessions, the context window eventually fills up, and that can cause the agent to forget earlier decisions, lose important details, or come back from compaction with gaps in its working memory. Here are three tools worth checking out if you want to reduce token usage and make longer coding sessions possible. 1. CavemanThis is a Claude...
AI agents can now scan an entire open-source codebase for exploitable vulnerabilities in hours. Frontier models carry the complete library of known bug classes in their weights. So you can simply point an AI agent at a codebase and tell it to find zero-days. This isn't theoretical. Willy Tarreau, the HAProxy lead developer, reports that security bug reports have jumped from 2–3 per week to 5–10 per day. Greg Kroah-Hartman, the Linux kernel maintainer, described what happened: "Months ago, we...