You need to enable JavaScript to run this app.
NAT Gateway

NAT Gateway

Copy page
Download PDF
Golang
Modifying an SNAT entry
Copy page
Download PDF
Modifying an SNAT entry
This topic desribes how to modify an SNAT entry.​
Example code​
​
// Example Code generated by Beijing Volcanoengine Technology.​
​
package natgatewayexample​
​
import (​
"fmt"​
​
"github.com/volcengine/volcengine-go-sdk/service/natgateway"​
"github.com/volcengine/volcengine-go-sdk/volcengine"​
"github.com/volcengine/volcengine-go-sdk/volcengine/credentials"​
"github.com/volcengine/volcengine-go-sdk/volcengine/session"​
)​
​
func ModifySnatEntryAttributes() {​
// Set the AccessKey ID, AccessKey secret, and Region you want to access.​
ak, sk, region := "Your AK", "Your SK", "Region"​
config := volcengine.NewConfig().​
WithRegion(region).​
WithCredentials(credentials.NewStaticCredentials(ak, sk, ""))​
sess, err := session.NewSession(config)​
if err != nil {​
panic(err)​
}​
svc := natgateway.New(sess)​
​
// Modify SNAT entry​
modifySnatEntryAttributesInput := &natgateway.ModifySnatEntryAttributesInput{​
EipId: volcengine.String("eip-2feaac9wtccn459gp67qe****"), // ID of the public network IP after modification​
SnatEntryId: volcengine.String("snat-2fedi096gdiww59gp680r****"), // ID of the SNAT entry​
}​
​
// Initiate the request and process the response or exception​
resp, err := svc.ModifySnatEntryAttributes(modifySnatEntryAttributesInput)​
if err != nil {​
panic(err)​
}​
fmt.Println(resp)​
}​
​
Related documents​
​
Last updated: 2026.07.10 10:41:30