I am trying to add some integration into github actions with AWS Api Gateway and Postman. Is it possible to obtain the OpenAPI3 json definition for a given API through AWS CLI or other tools and import it into postman using Postman CLI?
Related
I am trying to create a new API using
AWS API Gateway (backed by an AWS Lambda)
Swagger UI
Authentication (OAUTH2 with Okta)
I can create a new service with Pythong + Flask + Swagger and host a docker container, which I can develop, but I'm trying to keep it serverless and use the combination of technologies in my list above.
Any help would be greatly appreciated!
I'm assuming you want to know more about the OAuth part using Okta. You'll have to create a Lambda authorizer that will perform the introspection of the token from Okta.
For the serverless API, you'll have to break your service into functions. An approach is to have one function for each RESTful resource+method:
GET /books/{id} -> getBookFunction
PUT /books/{id} -> updateBookFunction
DELETE /books/{id} -> deleteBookFunction
Lastly, if you have a well-defined Swagger file. You can use it to create your API in API Gateway. You may also use x-amazon-apigateway-* in your Swagger file and define your resource backend to refer to a Lambda function's ARN. Documentation can be found here
Yes, you're right, the question is more around how to integrate Oauth2 (Okta) with a swagger UI using AWS API Gateway.
API Gateway 2.0 already provide the ability to inspect the JWT token from Okta, so no need to create a custom Lambda there.
I'm not sure how to get this ability with redirects configured in a Swagger UI, and have the user login using the implicit/authorization-code Grant-Type and let the user interact with the swagger page.
I'd like to use apollo graphql in a lambda and I found AppSync is for graphql and API Gateway is for REST. Do I have to use AppSync for that?
I also find out a library apollo-server-lambda which can be used with serverless but I don't want to use serverless because all my infrastructure code is written in Terraform. I don't want to bring another IaC library in my application.
So is there a way to use API Gateway with apollo graphql in lambda? If yes, how should I declare API Gateway route for that?
Not really. You can just use the API gateway, Lambda, and Apollo Server. Install the npm library apollo-server-lambda and Import the required modules.
The current version of Apollo Server Lambda: 2.17.0
You can create a GraphQL handler using the function createHandler provided by Apollo server Lambda.
I am not sure about how it is done using Terraform but you can just declare a route to your handler function via the API gateway.
Make sure your GET and POST requests route to the same handler.
Refer to this documentation for more details: https://www.apollographql.com/docs/apollo-server/deployment/lambda/
Here is the official documentation for AWS Amplify GraphQL Client: https://aws-amplify.github.io/amplify-js/media/api_guide.html. The section supplies an example for basic String inputs though.
For AWS Mobile Appsync SDK for Javascript, there is a detailed doc here: https://docs.aws.amazon.com/appsync/latest/devguide/building-a-client-app-react.html. However, I do not want to add another configuration for it -I already have one for Amplify.
So, how to upload files to S3 storage by using AWS Amplify and AWS AppSync as the backend, what extra configuration is needed for Amplify -if there is?
Http Endpoints are added as an option to be used as datasources to AppSync schemata, but as of time, there is no S3 bucket as an option. There are solutions like [this](
https://stackoverflow.com/a/50218870/4636715), but they require AWSAppSyncClient at Javascript side which would add complexity to the client code as Amplify is set up there already imho.
So, I ended up with using Storage
of AWS Amplify -independent of AppSync. Then, I wait for the upload to be successful and call an AppSync mutation to store the key for the uploaded file in DynamoDB using regular datasource resolvers.
I'm using swagger 2.0 and it works fine with my server but I'm unable to import the same YAML/JSON file into AWS API GATEWAY. I get a number of errors when I upload the file . How should I use the Swagger with AWS API GATEWAY?
I get the same errors when I try to integrate from swaggerhub integration with AWS.
I tried deploying API on Amazon API Gateway, but there it is asking Swagger file. Where we get this Swagger file and how to modify my existing API. Can I deploy my existing API on Amazon web service without using swagger.