Created
September 6, 2024 19:05
-
-
Save JoKenPo/a3d60fd1b464acb68977d2ba3f66a743 to your computer and use it in GitHub Desktop.
Revisions
-
JoKenPo created this gist
Sep 6, 2024 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,42 @@ const AWS = require('aws-sdk'); // Configurando o SSM para usar o LocalStack const ssm = new AWS.SSM({ endpoint: 'http://localhost:4566', // Endpoint do LocalStack region: 'us-east-1', // Região que você definiu accessKeyId: 'test', // Credenciais fictícias para usar localmente secretAccessKey: 'test', }); // Exemplo de uso: criar um parâmetro no SSM const putParameter = async () => { const params = { Name: '/my/parameter', Value: 'test-value', Type: 'String', }; try { const result = await ssm.putParameter(params).promise(); console.log('Parâmetro criado:', result); } catch (err) { console.error('Erro ao criar parâmetro:', err); } }; // Exemplo de uso: buscar um parâmetro no SSM const getParameter = async () => { const params = { Name: '/my/parameter', }; try { const result = await ssm.getParameter(params).promise(); console.log('Parâmetro recuperado:', result.Parameter); } catch (err) { console.error('Erro ao recuperar parâmetro:', err); } }; putParameter(); getParameter();