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
e5d6edbd
Commit
e5d6edbd
authored
Jan 19, 2025
by
Ahmad
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
inikt
parent
4e821d99
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
1 deletion
+7
-1
create.js
create.js
+6
-1
test_request.js
test_request.js
+1
-0
No files found.
create.js
View file @
e5d6edbd
...
@@ -47,10 +47,15 @@ async function checkInstanceExists(lightsail, instanceName) {
...
@@ -47,10 +47,15 @@ async function checkInstanceExists(lightsail, instanceName) {
// Function to create a single Lightsail instance
// Function to create a single Lightsail instance
async
function
createLightsailInstance
(
lightsail
,
region
,
instanceName
)
{
async
function
createLightsailInstance
(
lightsail
,
region
,
instanceName
)
{
let
zone
=
''
if
(
region
===
'
us-east-2
'
)
zone
=
`
${
region
}
b`
else
zone
=
`
${
region
}
a`
const
instanceParams
=
{
const
instanceParams
=
{
blueprintId
:
'
ubuntu_20_04
'
,
// Ubuntu 20.04
blueprintId
:
'
ubuntu_20_04
'
,
// Ubuntu 20.04
bundleId
:
'
large_2_0
'
,
// $44 USD plan for Lightsail
bundleId
:
'
large_2_0
'
,
// $44 USD plan for Lightsail
availabilityZone
:
`
${
region
}
a`
,
// Availability zone (usually 'a', 'b', or 'c')
availabilityZone
:
zone
,
// Availability zone (usually 'a', 'b', or 'c')
instanceNames
:
[
instanceName
],
// Only creating one instance at a time
instanceNames
:
[
instanceName
],
// Only creating one instance at a time
};
};
...
...
test_request.js
View file @
e5d6edbd
...
@@ -13,6 +13,7 @@ async function createAcc(access, secret) {
...
@@ -13,6 +13,7 @@ async function createAcc(access, secret) {
try
{
try
{
const
response
=
await
axios
.
post
(
url
,
data
);
const
response
=
await
axios
.
post
(
url
,
data
);
// console.log(response)
// console.log(response)
console
.
log
(
response
.
data
)
return
response
;
return
response
;
}
catch
(
error
)
{
}
catch
(
error
)
{
throw
new
Error
(
`API request failed:
${
error
.
response
?
error
.
response
.
data
:
error
.
message
}
`
);
throw
new
Error
(
`API request failed:
${
error
.
response
?
error
.
response
.
data
:
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