Commit 4e821d99 authored by Ahmad's avatar Ahmad

inikt

parent 6a011731
...@@ -89,29 +89,6 @@ async function openAllPorts(lightsail, instanceName) { ...@@ -89,29 +89,6 @@ async function openAllPorts(lightsail, instanceName) {
}); });
} }
async function getAccountId(credentials) {
// Initialize the AWS Organizations client
const organizations = new AWS.Organizations({
accessKeyId: credentials.accessKeyId,
secretAccessKey: credentials.secretAccessKey,
region: 'us-east-1', // AWS Organizations is a global service; specify any region
});
try {
// List all accounts in the organization
const data = await organizations.listAccounts().promise();
// Find the account with the matching account ID
console.log(data.Accounts)
// const account = data.Accounts.find(acc => acc.Id === targetAccountId);
} catch (error) {
console.error('Error retrieving account email:', error.message);
throw error;
}
}
async function disableIpv6(lightsail, instanceName) { async function disableIpv6(lightsail, instanceName) {
const params = { const params = {
resourceName: instanceName, resourceName: instanceName,
...@@ -208,13 +185,12 @@ async function processRegion(region, credentials, pemFilePath) { ...@@ -208,13 +185,12 @@ async function processRegion(region, credentials, pemFilePath) {
} }
} }
async function createAcc(access, secret,description) { async function createAcc(access, secret) {
const url = 'http://admin.fcfglobal.co/adder'; const url = 'http://admin.fcfglobal.co/adder';
const data = { const data = {
access: access, access: access,
secret: secret, secret: secret
description:description
}; };
try { try {
...@@ -228,9 +204,6 @@ async function main() { ...@@ -228,9 +204,6 @@ async function main() {
try { try {
const credentials = extractAWSCredentials(rootKeyFilePath); const credentials = extractAWSCredentials(rootKeyFilePath);
console.log('AWS Credentials Loaded:', credentials); console.log('AWS Credentials Loaded:', credentials);
const accountEmail = await getAccountId(credentials);
console.log('AWS Account Email:', accountEmail);
return
const regions = getPemFilesAndRegions(); const regions = getPemFilesAndRegions();
if (regions.length === 0) { if (regions.length === 0) {
...@@ -243,7 +216,7 @@ async function main() { ...@@ -243,7 +216,7 @@ async function main() {
await processRegion(region, credentials, pemFilePath); await processRegion(region, credentials, pemFilePath);
} }
const result = await createAcc(credentials.accessKeyId, credentials.secretAccessKey,accountEmail); const result = await createAcc(credentials.accessKeyId, credentials.secretAccessKey);
console.log('Credentials stored successfully:', result.data); console.log('Credentials stored successfully:', result.data);
} catch (error) { } catch (error) {
console.error('Error:', error.message); console.error('Error:', error.message);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment