Skip to main content

environments

Creates, updates, deletes, gets or lists an environments resource.

Overview

Nameenvironments
TypeResource
Idaws.appconfig.environments

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
application_idstringThe application ID. (pattern: <code>[a-z0-9]{4,7}</code>)
descriptionstringThe description of the environment.
idstringThe environment ID. (pattern: <code>[a-z0-9]{4,7}</code>)
monitorsarrayAmazon CloudWatch alarms monitored during the deployment.
namestringThe name of the environment.
statestringThe state of the environment. An environment can be in one of the following states: READY_FOR_DEPLOYMENT, DEPLOYING, ROLLING_BACK, or ROLLED_BACK (READY_FOR_DEPLOYMENT, DEPLOYING, ROLLING_BACK, ROLLED_BACK, REVERTED)

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
get_environmentselectapplication_id, environment_id, regionRetrieves information about an environment. An environment is a deployment group of AppConfig applications, such as applications in a Production environment or in an EU_Region environment. Each configuration deployment targets an environment. You can enable one or more Amazon CloudWatch alarms for an environment. If an alarm is triggered during a deployment, AppConfig roles back the configuration.
list_environmentsselectapplication_id, regionmax_results, next_tokenLists the environments for an application.
create_environmentinsertapplication_id, regionCreates an environment. For each application, you define one or more environments. An environment is a deployment group of AppConfig targets, such as applications in a Beta or Production environment. You can also define environments for application subcomponents such as the Web, Mobile and Back-end components for your application. You can configure Amazon CloudWatch alarms for each environment. The system monitors alarms during a configuration deployment. If an alarm is triggered, the system rolls back the configuration.
update_environmentupdateapplication_id, environment_id, regionUpdates an environment.
delete_environmentdeleteenvironment_id, application_id, regionx-amzn-deletion-protection-checkDeletes an environment. To prevent users from unintentionally deleting actively-used environments, enable deletion protection.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
application_idstringThe application ID that includes the environment that you want to delete.
environment_idstringThe ID of the environment that you want to delete.
regionstringAWS region (default: us-east-1)
max_resultsintegerThe maximum number of items to return for this call. The call also returns a token that you can specify in a subsequent call to get the next set of results.
next_tokenstringA token to start the list. Use this token to get the next set of results.
x-amzn-deletion-protection-checkstringA parameter to configure deletion protection. Deletion protection prevents a user from deleting an environment if your application called either GetLatestConfiguration or in the environment during the specified interval. This parameter supports the following values: BYPASS: Instructs AppConfig to bypass the deletion protection check and delete a configuration profile even if deletion protection would have otherwise prevented it. APPLY: Instructs the deletion protection check to run, even if deletion protection is disabled at the account level. APPLY also forces the deletion protection check to run against resources created in the past hour, which are normally excluded from deletion protection checks. ACCOUNT_DEFAULT: The default setting, which instructs AppConfig to implement the deletion protection value specified in the UpdateAccountSettings API.

SELECT examples

Retrieves information about an environment. An environment is a deployment group of AppConfig applications, such as applications in a Production environment or in an EU_Region environment. Each configuration deployment targets an environment. You can enable one or more Amazon CloudWatch alarms for an environment. If an alarm is triggered during a deployment, AppConfig roles back the configuration.

SELECT
application_id,
description,
id,
monitors,
name,
state
FROM aws.appconfig.environments
WHERE application_id = '{{ application_id }}' -- required
AND environment_id = '{{ environment_id }}' -- required
AND region = '{{ region }}' -- required
;

INSERT examples

Creates an environment. For each application, you define one or more environments. An environment is a deployment group of AppConfig targets, such as applications in a Beta or Production environment. You can also define environments for application subcomponents such as the Web, Mobile and Back-end components for your application. You can configure Amazon CloudWatch alarms for each environment. The system monitors alarms during a configuration deployment. If an alarm is triggered, the system rolls back the configuration.

INSERT INTO aws.appconfig.environments (
Name,
Description,
Monitors,
Tags,
application_id,
region
)
SELECT
'{{ Name }}',
'{{ Description }}',
'{{ Monitors }}',
'{{ Tags }}',
'{{ application_id }}',
'{{ region }}'
RETURNING
application_id,
description,
id,
monitors,
name,
state
;

UPDATE examples

Updates an environment.

UPDATE aws.appconfig.environments
SET
Name = '{{ Name }}',
Description = '{{ Description }}',
Monitors = '{{ Monitors }}'
WHERE
application_id = '{{ application_id }}' --required
AND environment_id = '{{ environment_id }}' --required
AND region = '{{ region }}' --required
RETURNING
application_id,
description,
id,
monitors,
name,
state;

DELETE examples

Deletes an environment. To prevent users from unintentionally deleting actively-used environments, enable deletion protection.

DELETE FROM aws.appconfig.environments
WHERE environment_id = '{{ environment_id }}' --required
AND application_id = '{{ application_id }}' --required
AND region = '{{ region }}' --required
AND `x-amzn-deletion-protection-check` = '{{ x-amzn-deletion-protection-check }}'
;