Write cognito pool and client id's to local file on creation


we are using serverless, to create an cognito pool, for an app which is deployed in different AWS accounts.

During the pool generation we, receive a pool and client id. Which we automatically would like to be save in a local file, to be reused by other components, like an angular frontend, utilzing this api. To not have to manually intervene.


we have these 2 defined variables:

{ Ref: UserPool }
{ Ref: UserClient }

which are correctly exported to the lambda functions, etc.

user_pool_id: { Ref: UserPool }
client_id: { Ref: UserClient }

and we would also like to write them to an external yml,ts,json file like this

export const environment = {
production: true,

cognito: {
userPoolId: ‘POOL_ID’,
userPoolWebClientId: ‘CLIENT_ID’,

to utilize it.

any suggestions or best practices how to accomplish this, without having to write a plugin?