AWS API from a Stencil app


#1

What is the correct way to access the AWS API from a stencil component in a stencil app, not using any framework except the stencil app starter kit?


#2

I don’t know if it’s ever been done. You might want to ask on Slack.


#3

Generally speaking, isn’t a best practice to use the AWS SDK only in the backend (because of information like accessKeyId/secretAccessKey which should remind secret)?

But otherwise yes, I would ask the Slack channel.

I think I remember having read a post about someone who was importing momentjs in a Stencil component, I guess it should work the same


#4

In a server-less architecture you authenticate the user against an auth service like Amazon Cognito. This lets you manage your own user list (CognitioIdentityServiceProvider), or let people sign in with a Google+ ID, Facebook, Twitter or Amazon ID as well as integrating with any SAML2 Auth service. Cognito returns a client token that lets you access Amazon services with the permissions of a generic application role you configure for your app. This might be access to any AWS service, for example reading and writing to an S3 bucket, writing to DynamoDB, spinning EC2 instances. Cognito lets you give these permissions to any client temporarily to act on your behalf. This is fine for simple apps, but for more complex stuff you can give the client permission to run Amazon lamba functions as micro-services, and these can access the rest of the services with more fine grained permissions. So for a server-less microservice architecture we need to at least access the CognitoIdentity, CognitoIdentityServiceProvider and Lambda APIs.


#5

Interesting, thx for the explanation :+1: