Skip to content

Commit

Permalink
populate more data in region from config file
Browse files Browse the repository at this point in the history
  • Loading branch information
chinmaysomani07 committed Feb 20, 2023
1 parent a51b81f commit b698a13
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
3 changes: 3 additions & 0 deletions cmd/localstackpopulator.go
Expand Up @@ -24,6 +24,9 @@ var lspop = &cobra.Command{
if !config.LookupForValue(profiles, profile) {
profile = profiles[0]
}
if len(region) == 0 {
region = "ap-south-1"
}
sess, err := getSession(profile, region)
if err != nil {
log.Fatal("err: ", err)
Expand Down
13 changes: 8 additions & 5 deletions populator/populator.go
Expand Up @@ -93,7 +93,6 @@ func CreateBuckets(sess *session.Session) error {
}

func CreateEC2Instances(sess []*session.Session) error {

insType := []string{"t2.micro", "t2.nano", "t2.small", "t2.medium", "t2.large",
"t3a.nano", "t3a.micro", "t3a.small", "t3a.medium", "t3a.large",
"t3.nano", "t3.micro", "t3.small", "t3.medium", "t3.large"}
Expand All @@ -102,8 +101,13 @@ func CreateEC2Instances(sess []*session.Session) error {
// Create VPC, Subnets, SG, Volumes
// Create 5-10 EC Instances for each Sessions.

for _, s := range sess {

for i, s := range sess {
n := 0
if i == 0 {
n = 50
} else {
n = 10
}
ec2Service := ec2.New(s)
iamService := iam.New(s)
gofakeit.Seed(0)
Expand Down Expand Up @@ -133,8 +137,7 @@ func CreateEC2Instances(sess []*session.Session) error {

blockDeviceMapping := createEbsMapping()
// var lastEc2Policy *iam.Policy
for i := 0; i < 10; i++ {

for i := 0; i < n; i++ {
ec2Tag := []*ec2.TagSpecification{
{
ResourceType: aws.String("instance"),
Expand Down

0 comments on commit b698a13

Please sign in to comment.